aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-12-02 16:36:30 +0200
committerGravatar ks129 <[email protected]>2020-12-02 16:36:30 +0200
commit85a115ae4c029397c8cefee6262e866d264fd681 (patch)
treed8342deccc55d5bb875507d68b7008ad2235d28a
parentDon't log CommandError, handle it as check fail (diff)
Move not allowed to run message to constant and match comment with code
-rw-r--r--bot/exts/info/help.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/bot/exts/info/help.py b/bot/exts/info/help.py
index 518330370..6c262e355 100644
--- a/bot/exts/info/help.py
+++ b/bot/exts/info/help.py
@@ -20,6 +20,8 @@ log = logging.getLogger(__name__)
COMMANDS_PER_PAGE = 8
PREFIX = constants.Bot.prefix
+NOT_ALLOWED_TO_RUN_MESSAGE = "***You cannot run this command.***\n\n"
+
Category = namedtuple("Category", ["name", "description", "cogs"])
@@ -174,15 +176,15 @@ class CustomHelpCommand(HelpCommand):
command_details += f"**Can also use:** {aliases}\n\n"
# 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
+ # when other CommandError or user is not allowed to run command,
+ # add this to help message.
try:
if not await command.can_run(self.context):
- command_details += "***You cannot run this command.***\n\n"
+ command_details += NOT_ALLOWED_TO_RUN_MESSAGE
except DisabledCommand:
command_details += "***This command is disabled.***\n\n"
except CommandError:
- command_details += "***You cannot run this command.***\n\n"
+ command_details += NOT_ALLOWED_TO_RUN_MESSAGE
command_details += f"*{command.help or 'No details provided.'}*\n"
embed.description = command_details