Open ZRunner opened 1 year ago
EDIT: my bad, the on_interaction_error
is not a native d.py event but one I had to create myself for the needs of my bot, sorry for the confusion.
Here is how I did it:
Client.tree
attribute has an on_error
method called "when any command raises an AppCommandError
" (from the d.py doc)self.dispatch("interaction_error", interaction, error)
I believe this is the best way to do things and will allow us to more easily catch interaction-related errors
Discord.py added a long time ago a new
on_interaction_error
event handler, specifically made to handle errors from app commands, buttons, modals, autocompletion etc.This handled has not been added to our Error cog, so these errors are only printed into the bot console and will never show in our error channel for example.
Check https://github.com/ZRunner/Axobot/blob/ccdbb05d59cc0b688080e7f6c3ef944fda459888/fcts/errors.py#L233 for an example of implementation (could be done better)