mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-16 10:49:24 +00:00
[commands] help command now uses the full name in the signature.
This commit is contained in:
parent
d1508bc739
commit
a82176120c
@ -118,17 +118,33 @@ class HelpFormatter:
|
|||||||
# odd one.
|
# odd one.
|
||||||
return self.context.prefix.replace(user.mention, '@' + user.name)
|
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):
|
def get_command_signature(self):
|
||||||
"""Retrieves the signature portion of the help page."""
|
"""Retrieves the signature portion of the help page."""
|
||||||
result = []
|
result = []
|
||||||
prefix = self.clean_prefix
|
prefix = self.clean_prefix
|
||||||
|
qualified = self.get_qualified_command_name()
|
||||||
cmd = self.command
|
cmd = self.command
|
||||||
if len(cmd.aliases) > 0:
|
if len(cmd.aliases) > 0:
|
||||||
aliases = '|'.join(cmd.aliases)
|
aliases = '|'.join(cmd.aliases)
|
||||||
name = '{0}[{1.name}|{2}]'.format(prefix, cmd, aliases)
|
fmt = '{0}[{1.name}|{2}]'
|
||||||
result.append(name)
|
if qualified:
|
||||||
|
fmt = '{0}{3} [{1.name}|{2}]'
|
||||||
|
result.append(fmt.format(prefix, cmd, aliases, qualified))
|
||||||
else:
|
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
|
params = cmd.clean_params
|
||||||
if len(params) > 0:
|
if len(params) > 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user