diff options
| author | 2021-01-17 01:19:57 -0500 | |
|---|---|---|
| committer | 2021-01-17 01:19:57 -0500 | |
| commit | 312d0dbb3e2af818a8a486d19a0166b84e28e82f (patch) | |
| tree | d95c48823502b7b37c285a769e06121d4491c1be | |
| parent | Update to use Member.pending instead of bot.http.get_member (diff) | |
| parent | Checks If Similar Command Is None (diff) | |
Merge pull request #1360 from HassanAbouelela/fixes_tag_suggestions
Fixes Error Handler Tag Dispatching
| -rw-r--r-- | bot/exts/backend/error_handler.py | 6 | ||||
| -rw-r--r-- | bot/exts/info/tags.py | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py index 14147398b..da264ce2f 100644 --- a/bot/exts/backend/error_handler.py +++ b/bot/exts/backend/error_handler.py @@ -155,7 +155,8 @@ class ErrorHandler(Cog): ) else: with contextlib.suppress(ResponseCodeError): - await ctx.invoke(tags_get_command, tag_name=tag_name) + if await ctx.invoke(tags_get_command, tag_name=tag_name): + return if not any(role.id in MODERATION_ROLES for role in ctx.author.roles): tags_cog = self.bot.get_cog("Tags") @@ -180,6 +181,9 @@ class ErrorHandler(Cog): similar_command_name = similar_command_data[0] similar_command = self.bot.get_command(similar_command_name) + if not similar_command: + return + log_msg = "Cancelling attempt to suggest a command due to failed checks." try: if not await similar_command.can_run(ctx): diff --git a/bot/exts/info/tags.py b/bot/exts/info/tags.py index 639286d90..00b4d1a78 100644 --- a/bot/exts/info/tags.py +++ b/bot/exts/info/tags.py @@ -281,9 +281,13 @@ class Tags(Cog): return False @tags_group.command(name='get', aliases=('show', 'g')) - async def get_command(self, ctx: Context, *, tag_name: TagNameConverter = None) -> None: - """Get a specified tag, or a list of all tags if no tag is specified.""" - await self.display_tag(ctx, tag_name) + async def get_command(self, ctx: Context, *, tag_name: TagNameConverter = None) -> bool: + """ + Get a specified tag, or a list of all tags if no tag is specified. + + Returns False if a tag is on cooldown, or if no matches are found. + """ + return await self.display_tag(ctx, tag_name) def setup(bot: Bot) -> None: |