From 5836e27f209edc9aa8f5fac4cefec4ea7844937e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C2=96Blue-Robin-Taken?= Date: Fri, 5 Apr 2024 08:03:15 -0500 Subject: [PATCH 1/5] fix help.py --- discord/ext/commands/help.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py index 90899ef6a8..2e01ceb3ad 100644 --- a/discord/ext/commands/help.py +++ b/discord/ext/commands/help.py @@ -995,10 +995,13 @@ def add_indented_commands(self, commands, *, heading, max_size=None): max_size = max_size or self.get_max_size(commands) get_width = discord.utils._string_width - for command in commands: - name = command.name - width = max_size - (get_width(name) - len(name)) - entry = f'{self.indent * " "}{name:<{width}} {command.short_doc}' + last_name = "" + for command_name, command in [(command.name, command) for command in commands]: + if last_name == command_name: + continue + last_name = command_name + width = max_size - (get_width(command_name) - len(command_name)) + entry = f'{self.indent * " "}{command_name:<{width}} {command.short_doc}' self.paginator.add_line(self.shorten_text(entry)) async def send_pages(self): From 270bf96224b84e8532ea86b09a3ac8719dab29da Mon Sep 17 00:00:00 2001 From: BlueRobin Date: Fri, 5 Apr 2024 10:36:43 -0500 Subject: [PATCH 2/5] Update CHANGELOG.md Signed-off-by: BlueRobin --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d22818f1d..38fb72491f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2407](https://github.com/Pycord-Development/pycord/pull/2407)) - Fixed invalid data being passed to `Interaction._guild` in certain cases. ([#2411](https://github.com/Pycord-Development/pycord/pull/2411)) +- Fixed duplication in bridge command help. + ([#2415](https://github.com/Pycord-Development/pycord/pull/2415)) ### Changed From f4c943f045dd8f9f49f184b08d17d8082929c45f Mon Sep 17 00:00:00 2001 From: BlueRobin Date: Tue, 9 Apr 2024 15:22:14 -0500 Subject: [PATCH 3/5] Use case for same group Signed-off-by: BlueRobin --- discord/ext/commands/help.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py index 2e01ceb3ad..515e4b2c6b 100644 --- a/discord/ext/commands/help.py +++ b/discord/ext/commands/help.py @@ -995,11 +995,13 @@ def add_indented_commands(self, commands, *, heading, max_size=None): max_size = max_size or self.get_max_size(commands) get_width = discord.utils._string_width - last_name = "" - for command_name, command in [(command.name, command) for command in commands]: - if last_name == command_name: + last_name = "" # check name duplicates + last_parent = "" # make sure those duplicates are under the same parent + for command_name, command_parent, command in [(command.name, command.parent, command) for command in commands]: # unpack parameters of command for each of the commands + if last_name == command_name and command_parent == last_parent: # check if the last command is the same group and name continue last_name = command_name + last_parent = command_parent width = max_size - (get_width(command_name) - len(command_name)) entry = f'{self.indent * " "}{command_name:<{width}} {command.short_doc}' self.paginator.add_line(self.shorten_text(entry)) From f9146ba03375d0bc4d093539a8f69d395f6dc0d1 Mon Sep 17 00:00:00 2001 From: BlueRobin Date: Tue, 9 Apr 2024 15:22:49 -0500 Subject: [PATCH 4/5] Update CHANGELOG.md Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com> Signed-off-by: BlueRobin --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38fb72491f..607a693050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ These changes are available on the `master` branch, but have not yet been releas ([#2407](https://github.com/Pycord-Development/pycord/pull/2407)) - Fixed invalid data being passed to `Interaction._guild` in certain cases. ([#2411](https://github.com/Pycord-Development/pycord/pull/2411)) -- Fixed duplication in bridge command help. +- Fixed `BridgeCommand` duplication in default help commands. ([#2415](https://github.com/Pycord-Development/pycord/pull/2415)) ### Changed From a730a694364d5ab658acd0a5479280d939912e52 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:25:51 +0000 Subject: [PATCH 5/5] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/ext/commands/help.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py index 515e4b2c6b..7210637cfa 100644 --- a/discord/ext/commands/help.py +++ b/discord/ext/commands/help.py @@ -997,8 +997,12 @@ def add_indented_commands(self, commands, *, heading, max_size=None): get_width = discord.utils._string_width last_name = "" # check name duplicates last_parent = "" # make sure those duplicates are under the same parent - for command_name, command_parent, command in [(command.name, command.parent, command) for command in commands]: # unpack parameters of command for each of the commands - if last_name == command_name and command_parent == last_parent: # check if the last command is the same group and name + for command_name, command_parent, command in [ + (command.name, command.parent, command) for command in commands + ]: # unpack parameters of command for each of the commands + if ( + last_name == command_name and command_parent == last_parent + ): # check if the last command is the same group and name continue last_name = command_name last_parent = command_parent