mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-22 10:47:58 -05:00
Bump discord.py to 1.7.0 (#4928)
* Bump discord.py, but to the git version for now * Import GuildConverter from d.py and deprecate our implementation * Import PartialMessageConverter in our commands extension * Use newly added `Cog.has_error_handler()` rather than private method * Update snowflake regex to use 20 as max length See Rapptz/discord.py#6501 * Use new supported way for custom cooldown buckets * Include group args in command signature * Update code to use `Client.close()` over `Client.logout()` * Add StageChannelConverter and StoreChannelConverter * Fix AttributeError in licenseinfo
This commit is contained in:
@@ -275,6 +275,20 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
"You can also type {ctx.clean_prefix}help <category> for more info on a category."
|
||||
).format(ctx=ctx)
|
||||
|
||||
@staticmethod
|
||||
def get_command_signature(ctx: Context, command: commands.Command) -> str:
|
||||
parent = command.parent
|
||||
entries = []
|
||||
while parent is not None:
|
||||
if not parent.signature or parent.invoke_without_command:
|
||||
entries.append(parent.name)
|
||||
else:
|
||||
entries.append(parent.name + " " + parent.signature)
|
||||
parent = parent.parent
|
||||
parent_sig = (" ".join(reversed(entries)) + " ") if entries else ""
|
||||
|
||||
return f"{ctx.clean_prefix}{parent_sig}{command.name} {command.signature}"
|
||||
|
||||
async def format_command_help(
|
||||
self, ctx: Context, obj: commands.Command, help_settings: HelpSettings
|
||||
):
|
||||
@@ -300,9 +314,9 @@ class RedHelpFormatter(HelpFormatterABC):
|
||||
description = command.description or ""
|
||||
|
||||
tagline = (help_settings.tagline) or self.get_default_tagline(ctx)
|
||||
signature = _(
|
||||
"Syntax: {ctx.clean_prefix}{command.qualified_name} {command.signature}"
|
||||
).format(ctx=ctx, command=command)
|
||||
signature = _("Syntax: {command_signature}").format(
|
||||
command_signature=self.get_command_signature(ctx, command)
|
||||
)
|
||||
|
||||
aliases = command.aliases
|
||||
if help_settings.show_aliases and aliases:
|
||||
|
||||
Reference in New Issue
Block a user