diff options
author | 2018-11-17 08:37:24 +0000 | |
---|---|---|
committer | 2018-11-17 08:37:24 +0000 | |
commit | 185c651f96c13ed5f5d7dfb324fdc156db7a7186 (patch) | |
tree | f120d137098fac1906033e477737ad320557a9e3 | |
parent | Merge branch 'infraction-notifs' into 'master' (diff) | |
parent | Add aliases, prefix to cmd sig, remove from subcommands (diff) |
Merge branch 'help_aliases_parents' into 'master'
Add aliases. Add prefixes to command sig, but remove from subcommands.
See merge request python-discord/projects/bot!99
-rw-r--r-- | bot/cogs/help.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bot/cogs/help.py b/bot/cogs/help.py index 144286c56..d30ff0dfb 100644 --- a/bot/cogs/help.py +++ b/bot/cogs/help.py @@ -355,10 +355,18 @@ class HelpSession: # Use LinePaginator to restrict embed line height paginator = LinePaginator(prefix='', suffix='', max_lines=self._max_lines) + prefix = constants.Bot.prefix + # show signature if query is a command if isinstance(self.query, commands.Command): signature = self._get_command_params(self.query) - paginator.add_line(f'**```{signature}```**') + parent = self.query.full_parent_name + ' ' if self.query.parent else '' + paginator.add_line(f'**```{prefix}{parent}{signature}```**') + + # show command aliases + aliases = ', '.join(f'`{a}`' for a in self.query.aliases) + if aliases: + paginator.add_line(f'**Can also use:** {aliases}\n') if not await self.query.can_run(self._ctx): paginator.add_line('***You cannot run this command.***\n') @@ -392,6 +400,9 @@ class HelpSession: elif isinstance(self.query, commands.Command): grouped = (('**Subcommands:**', self.query.commands),) + # don't show prefix for subcommands + prefix = '' + # otherwise sort and organise all commands into categories else: cat_sort = sorted(filtered, key=self._category_key) @@ -424,7 +435,6 @@ class HelpSession: strikeout = '~~' signature = self._get_command_params(command) - prefix = constants.Bot.prefix info = f"{strikeout}**`{prefix}{signature}`**{strikeout}" # handle if the command has no docstring |