diff options
| author | 2019-12-11 02:05:18 -0800 | |
|---|---|---|
| committer | 2019-12-11 02:05:18 -0800 | |
| commit | 9a3e83116e145b720fc47b0686b357fa6ae9e488 (patch) | |
| tree | 9cfa8248f517352870ceeeea82e00f8867228fd4 | |
| parent | Merge pull request #682 from manusaurio/master (diff) | |
ErrorHandler: fix #650 tag fallback not respecting checks
| -rw-r--r-- | bot/cogs/error_handler.py | 10 |
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) |