diff options
| author | 2019-09-14 16:24:38 +0200 | |
|---|---|---|
| committer | 2019-09-14 16:24:38 +0200 | |
| commit | d97e0355818fd994b24a6057a43fda3b5c66cb2f (patch) | |
| tree | 5cb3efee3e73414c7d1a4481369b1bf90a3e8a04 | |
| parent | Allow multiple words for !otn a (diff) | |
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.
| -rw-r--r-- | bot/cogs/error_handler.py | 13 |
1 files 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) |