From d97e0355818fd994b24a6057a43fda3b5c66cb2f Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Sat, 14 Sep 2019 16:24:38 +0200 Subject: Don't allow tag invocations in #checkpoint. There was a bug which would permit tag invocations here, because these were triggered by an error handler on CommandNotFound. This commit prevents that from being possible. --- bot/cogs/error_handler.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bot/cogs/error_handler.py b/bot/cogs/error_handler.py index d2a67fd76..a57cabf1e 100644 --- a/bot/cogs/error_handler.py +++ b/bot/cogs/error_handler.py @@ -17,7 +17,7 @@ from discord.ext.commands import ( from discord.ext.commands import Bot, Context from bot.api import ResponseCodeError - +from bot.constants import Channels log = logging.getLogger(__name__) @@ -47,12 +47,13 @@ class ErrorHandler: return if isinstance(e, CommandNotFound) and not hasattr(ctx, "invoked_from_error_handler"): - tags_get_command = self.bot.get_command("tags get") - ctx.invoked_from_error_handler = True + if not ctx.channel.id == Channels.verification: + tags_get_command = self.bot.get_command("tags get") + ctx.invoked_from_error_handler = True - # Return to not raise the exception - with contextlib.suppress(ResponseCodeError): - return await ctx.invoke(tags_get_command, tag_name=ctx.invoked_with) + # Return to not raise the exception + with contextlib.suppress(ResponseCodeError): + return await ctx.invoke(tags_get_command, tag_name=ctx.invoked_with) elif isinstance(e, BadArgument): await ctx.send(f"Bad argument: {e}\n") await ctx.invoke(*help_command) -- cgit v1.2.3