aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-17 17:17:30 -0500
committerRapptz <[email protected]>2016-01-17 17:17:30 -0500
commita82176120ce1122d38620740286d7d215b75f56c (patch)
tree741333dc69db28c9bc0130e65ff957ff0a4ece54
parent[commands] Fix indentation error in commands.bot_has_role docstring. (diff)
downloaddiscord.py-a82176120ce1122d38620740286d7d215b75f56c.tar.xz
discord.py-a82176120ce1122d38620740286d7d215b75f56c.zip
[commands] help command now uses the full name in the signature.
-rw-r--r--discord/ext/commands/formatter.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/discord/ext/commands/formatter.py b/discord/ext/commands/formatter.py
index 13d82ae2..f06c487b 100644
--- a/discord/ext/commands/formatter.py
+++ b/discord/ext/commands/formatter.py
@@ -118,17 +118,33 @@ class HelpFormatter:
# odd one.
return self.context.prefix.replace(user.mention, '@' + user.name)
+ def get_qualified_command_name(self):
+ """Retrieves the fully qualified command name, i.e. the base command name
+ required to execute it. This does not contain the command name itself.
+ """
+ entries = []
+ command = self.command
+ while command.parent is not None:
+ command = command.parent
+ entries.append(command.name)
+
+ return ' '.join(reversed(entries))
+
def get_command_signature(self):
"""Retrieves the signature portion of the help page."""
result = []
prefix = self.clean_prefix
+ qualified = self.get_qualified_command_name()
cmd = self.command
if len(cmd.aliases) > 0:
aliases = '|'.join(cmd.aliases)
- name = '{0}[{1.name}|{2}]'.format(prefix, cmd, aliases)
- result.append(name)
+ fmt = '{0}[{1.name}|{2}]'
+ if qualified:
+ fmt = '{0}{3} [{1.name}|{2}]'
+ result.append(fmt.format(prefix, cmd, aliases, qualified))
else:
- result.append(prefix + cmd.name)
+ name = prefix + cmd.name if not qualified else prefix + qualified + ' ' + cmd.name
+ result.append(name)
params = cmd.clean_params
if len(params) > 0: