aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/info/help.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/bot/exts/info/help.py b/bot/exts/info/help.py
index 5e0651f8a..44bff1f88 100644
--- a/bot/exts/info/help.py
+++ b/bot/exts/info/help.py
@@ -5,7 +5,7 @@ from contextlib import suppress
from typing import List, Union
from discord import Colour, Embed
-from discord.ext.commands import Bot, Cog, Command, Context, Group, HelpCommand
+from discord.ext.commands import Bot, Cog, Command, Context, Group, HelpCommand, DisabledCommand, CommandError
from fuzzywuzzy import fuzz, process
from fuzzywuzzy.utils import full_process
@@ -173,12 +173,16 @@ class CustomHelpCommand(HelpCommand):
if aliases:
command_details += f"**Can also use:** {aliases}\n\n"
- # when command is disabled, show message about it
+ # when command is disabled, show message about it,
+ # when other CommandError instance is raised, log warning about it
# otherwise check if the user is allowed to run this command
- if not command.enabled:
+ try:
+ if not await command.can_run(self.context):
+ command_details += "***You cannot run this command.***\n\n"
+ except DisabledCommand:
command_details += "***This command is disabled.***\n\n"
- elif not await command.can_run(self.context):
- command_details += "***You cannot run this command.***\n\n"
+ except CommandError as e:
+ log.warning(f"An exception raised when trying to check {command.name} command running permission: {e}")
command_details += f"*{command.help or 'No details provided.'}*\n"
embed.description = command_details