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
457
457
In this example, we are logging the error and responding to the interaction if not done so yet:
458
458
``` python
459
459
class 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." )
464
465
465
466
client = CustomErrorClient(... )
466
467
```
You can’t perform that action at this time.
0 commit comments