albertopoljak / Licensy

Discord bot that manages expiration of roles with subscriptions!
Other
58 stars 29 forks source link

Using commands in private channels stop their execution due to failure for bot to reply. #7

Closed albertopoljak closed 3 years ago

albertopoljak commented 4 years ago

Way to many people use the bot in private channels expecting to get reply.. All those replies are processed by error handler and showed in error log.

So just wrap those errors and ignore them, as some commands send info to user DMs so they failing to do that because the bot couldn't reply in ctx channel needs to be fixed, if fails just ignore and continue to send to DMs.

albertopoljak commented 4 years ago
Traceback
Traceback (most recent call last):
File "/root/Licensy/env/lib/python3.6/site-packages/discord/client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "/root/Licensy/cogs/cmd_errors.py", line 79, in on_command_error
await ctx.send(embed=failure(f"Invalid command input: {error}"))
File "/root/Licensy/env/lib/python3.6/site-packages/discord/abc.py", line 823, in send
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed, nonce=nonce)
File "/root/Licensy/env/lib/python3.6/site-packages/discord/http.py", line 218, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

Could also be because of common prefix and because the bot is muted in that specific channel but can see the messages. So using prefix ! would give this error if another bot uses the same, altho this specific error states that command is found but used with wrong arguments meaning the other bot would have to have the same prefix and command name too.