Skip to content
Discussion options

You must be logged in to vote

You can attach an error handler to the CommandTree of your client by either using the error decorator or subclassing CommandTree and overwriting the on_error callback. Here is an example of the former:

client = discord.Client(...)
tree = discord.app_commands.CommandTree(client)


@tree.error
async def on_app_command_error(interaction: discord.Interaction, error: discord.app_commands.AppCommandError) -> None:
    ...

You can check which exact subclass of AppCommandError was raised here to handle it, they are listed in the Interactions API Documentation.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@IIDarkNessYT
Comment options

@M9-SD
Comment options

@Soheab
Comment options

Answer selected by IIDarkNessYT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants