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:
jack1142
2021-04-05 21:33:19 +02:00
committed by GitHub
parent 9008410fa4
commit adda30cbee
13 changed files with 69 additions and 56 deletions

View File

@@ -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: