aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-02-16 19:06:22 -0800
committerGravatar MarkKoz <[email protected]>2020-02-16 19:06:22 -0800
commitb3fdfa71ceeecbd9fe62cadc240fcad27bad7a32 (patch)
treed4715822c0047993a94a28fbc3b7737f5cadefb1
parentError handler: update docstrings to reflect recent changes (diff)
Error handler: handle CommandOnCooldown errors
Simply send the error's default message to the invoking context.
-rw-r--r--bot/cogs/error_handler.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/bot/cogs/error_handler.py b/bot/cogs/error_handler.py
index d2c806566..347ce93ae 100644
--- a/bot/cogs/error_handler.py
+++ b/bot/cogs/error_handler.py
@@ -36,9 +36,9 @@ class ErrorHandler(Cog):
* Commands in the verification channel are ignored
2. UserInputError: see `handle_user_input_error`
3. CheckFailure: see `handle_check_failure`
- 4. ResponseCodeError: see `handle_api_error`
- 5. Otherwise, if not a CommandOnCooldown or DisabledCommand, handling is deferred to
- `handle_unexpected_error`
+ 4. CommandOnCooldown: send an error message in the invoking context
+ 5. ResponseCodeError: see `handle_api_error`
+ 6. Otherwise, if not a DisabledCommand, handling is deferred to `handle_unexpected_error`
"""
command = ctx.command
@@ -55,13 +55,15 @@ class ErrorHandler(Cog):
await self.handle_user_input_error(ctx, e)
elif isinstance(e, errors.CheckFailure):
await self.handle_check_failure(ctx, e)
+ elif isinstance(e, errors.CommandOnCooldown):
+ await ctx.send(e)
elif isinstance(e, errors.CommandInvokeError):
if isinstance(e.original, ResponseCodeError):
await self.handle_api_error(ctx, e.original)
else:
await self.handle_unexpected_error(ctx, e.original)
return # Exit early to avoid logging.
- elif not isinstance(e, (errors.CommandOnCooldown, errors.DisabledCommand)):
+ elif not isinstance(e, errors.DisabledCommand):
# ConversionError, MaxConcurrencyReached, ExtensionError
await self.handle_unexpected_error(ctx, e)
return # Exit early to avoid logging.