Skip to content

Commit

Permalink
Use case for same group
Browse files Browse the repository at this point in the history
Signed-off-by: BlueRobin <julianjohnt@Gmail.com>
  • Loading branch information
Blue-Robin-Taken committed Apr 9, 2024
1 parent 270bf96 commit f4c943f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions discord/ext/commands/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit f4c943f

Please sign in to comment.