Exception in giftaway when user has limited DM contact
DJTOMATO opened this issue · comments
Glas commented
Describe the bug
user won't receive the giftaway prize upon click on ✅ , I guess it's because the user has limited/blocked to receive DM's from non-friends, but still would be nice if the cog could catch this exception and report it
To Reproduce
Commands or inputs given before the bug occurred
I assume it happened beacuse the user has restricted DM's from non-friends in this case the bot.
Error code
Result of [p]traceback
(if applicable)
I found a bug in giftaway
Ignoring exception in on_raw_reaction_add
Mar 15 14:14:48 lena python[2826694]: Traceback (most recent call last):
Mar 15 14:14:48 lena python[2826694]: File "/home/glas/redenv/lib/python3.9/site-packages/discord/client.py", line 343, in _run_event
Mar 15 14:14:48 lena python[2826694]: await coro(*args, **kwargs)
Mar 15 14:14:48 lena python[2826694]: File "/mnt/hdd/data/lenabot/cogs/CogManager/cogs/giftaway/giftaway.py", line 458, in on_raw_reaction_add
Mar 15 14:14:48 lena python[2826694]: await gift.give_key(member)
Mar 15 14:14:48 lena python[2826694]: File "/mnt/hdd/data/lenabot/cogs/CogManager/cogs/giftaway/giftaway.py", line 237, in give_key
Mar 15 14:14:48 lena python[2826694]: await member.send(_('Here is your key for `{game}`: `{key}`').format(game=self.game_name, key=key))
Mar 15 14:14:48 lena python[2826694]: File "/home/glas/redenv/lib/python3.9/site-packages/discord/abc.py", line 1065, in send
Mar 15 14:14:48 lena python[2826694]: data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
Mar 15 14:14:48 lena python[2826694]: File "/home/glas/redenv/lib/python3.9/site-packages/discord/http.py", line 248, in request
Mar 15 14:14:48 lena python[2826694]: raise Forbidden(r, data)
Mar 15 14:14:48 lena python[2826694]: discord.errors.Forbidden: 403 Forbidden (error code: 50007): Cannot send messages to this user
Additional information
Any other relevant information
Michael Oliveira commented
Fixed in the dpy2
branch, which will be merged for Red version 3.5.