aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar scragly <[email protected]>2019-12-12 16:50:28 +1000
committerGravatar GitHub <[email protected]>2019-12-12 16:50:28 +1000
commit3bffbc151d69d3db72061498f51b9c48ca823909 (patch)
tree9cfa8248f517352870ceeeea82e00f8867228fd4
parentMerge pull request #682 from manusaurio/master (diff)
parentErrorHandler: fix #650 tag fallback not respecting checks (diff)
Fix tag fallback not respecting checks (#687)
Fix tag fallback not respecting checks
-rw-r--r--bot/cogs/error_handler.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/bot/cogs/error_handler.py b/bot/cogs/error_handler.py
index 49411814c..5fba9633b 100644
--- a/bot/cogs/error_handler.py
+++ b/bot/cogs/error_handler.py
@@ -75,6 +75,16 @@ class ErrorHandler(Cog):
tags_get_command = self.bot.get_command("tags get")
ctx.invoked_from_error_handler = True
+ log_msg = "Cancelling attempt to fall back to a tag due to failed checks."
+ try:
+ if not await tags_get_command.can_run(ctx):
+ log.debug(log_msg)
+ return
+ except CommandError as tag_error:
+ log.debug(log_msg)
+ await self.on_command_error(ctx, tag_error)
+ return
+
# Return to not raise the exception
with contextlib.suppress(ResponseCodeError):
await ctx.invoke(tags_get_command, tag_name=ctx.invoked_with)