diff options
| author | 2020-02-26 19:13:48 +0100 | |
|---|---|---|
| committer | 2020-02-26 19:13:48 +0100 | |
| commit | b4a52aded317572d51a0747ed8d74b3fc84c9428 (patch) | |
| tree | b2912858ea4532424cbf8029d53c20ddaa60297f | |
| parent | Make sure tag name contains at least one letter. (diff) | |
Pass error handler tag fallback through TagNameConverter.
The tag fallback didn't convert tags, resulting in possible invalid tag names being passed to the `tags_get_command`. This makes sure they're valid and ignores the risen exception if they are not.
Diffstat (limited to '')
| -rw-r--r-- | bot/cogs/error_handler.py | 8 | 
1 files changed, 6 insertions, 2 deletions
diff --git a/bot/cogs/error_handler.py b/bot/cogs/error_handler.py index 0abb7e521..3486a746c 100644 --- a/bot/cogs/error_handler.py +++ b/bot/cogs/error_handler.py @@ -20,6 +20,7 @@ from sentry_sdk import push_scope  from bot.api import ResponseCodeError  from bot.bot import Bot  from bot.constants import Channels +from bot.converters import TagNameConverter  from bot.decorators import InChannelCheckFailure  log = logging.getLogger(__name__) @@ -88,8 +89,11 @@ class ErrorHandler(Cog):                      return                  # Return to not raise the exception -                with contextlib.suppress(ResponseCodeError): -                    await ctx.invoke(tags_get_command, tag_name=ctx.invoked_with) +                with contextlib.suppress(BadArgument, ResponseCodeError): +                    await ctx.invoke( +                        tags_get_command, +                        tag_name=await TagNameConverter.convert(ctx, ctx.invoked_with) +                    )                      return          elif isinstance(e, BadArgument):              await ctx.send(f"Bad argument: {e}\n")  |