Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot errors if a channel is deleted #126

Open
mklarz opened this issue Jul 23, 2021 · 0 comments
Open

Bot errors if a channel is deleted #126

mklarz opened this issue Jul 23, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@mklarz
Copy link
Contributor

mklarz commented Jul 23, 2021

Whenever the bot errors, it sends a message to the channel where the error happened. It will then remove the error message after x seconds.

If that channel gets deleted before the bot removes the error message the bot will error out. See log below.

bot_1    | _ClientEventTask exception was never retrieved
bot_1    | future: <ClientEventTask state=finished event=on_command_error coro=<function on_command_error at 0x7f872b8d5040> exception=TypeError('on_error() takes from 1 to 2 positional arguments but 3 were given')>
bot_1    | Traceback (most recent call last):
bot_1    |   File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 343, in _run_event
bot_1    |     await coro(*args, **kwargs)
bot_1    |   File "/home/bot/bot.py", line 83, in on_command_error
bot_1    |     await msg.delete()
bot_1    |   File "/usr/local/lib/python3.9/site-packages/discord/message.py", line 1023, in delete
bot_1    |     await self._state.http.delete_message(self.channel.id, self.id)
bot_1    |   File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 250, in request
bot_1    |     raise NotFound(r, data)
bot_1    | discord.errors.NotFound: 404 Not Found (error code: 10003): Unknown Channel
bot_1    |
bot_1    | During handling of the above exception, another exception occurred:
bot_1    |
bot_1    | Traceback (most recent call last):
bot_1    |   File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 348, in _run_event
bot_1    |     await self.on_error(event_name, *args, **kwargs)
bot_1    | TypeError: on_error() takes from 1 to 2 positional arguments but 3 were given
@mklarz mklarz added the bug Something isn't working label Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant