diff options
| author | 2020-12-02 16:36:30 +0200 | |
|---|---|---|
| committer | 2020-12-02 16:36:30 +0200 | |
| commit | 85a115ae4c029397c8cefee6262e866d264fd681 (patch) | |
| tree | d8342deccc55d5bb875507d68b7008ad2235d28a | |
| parent | Don'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.py | 10 |
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 |