File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -457,10 +457,11 @@ Any error from interactions will trigger `on_command_error`. That includes conte
457457In this example, we are logging the error and responding to the interaction if not done so yet:
458458``` python
459459class CustomClient (Client ):
460- async def on_command_error (self , ctx : InteractionContext, error : Exception ):
461- logger.error(error)
462- if not ctx.responded:
463- await ctx.send(" Something went wrong." )
460+ @listen (disable_default_listeners = True ) # tell the dispatcher that this replaces the default listener
461+ async def on_command_error (self , event : CommandError):
462+ logger.error(event.error)
463+ if not event.ctx.responded:
464+ await event.ctx.send(" Something went wrong." )
464465
465466client = CustomErrorClient(... )
466467```
You can’t perform that action at this time.
0 commit comments