mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 03:40:11 +01:00
fix(help): only show subcommands
This commit is contained in:
19
cogs/help.py
19
cogs/help.py
@@ -121,6 +121,9 @@ class Help(commands.Cog, name="help"):
|
|||||||
if cog:
|
if cog:
|
||||||
commands_list = cog.get_commands()
|
commands_list = cog.get_commands()
|
||||||
for command in commands_list:
|
for command in commands_list:
|
||||||
|
has_prefix_subcommands = hasattr(command, 'commands') and len(getattr(command, 'commands', [])) > 0
|
||||||
|
if has_prefix_subcommands:
|
||||||
|
continue
|
||||||
name = command.name
|
name = command.name
|
||||||
if name in seen_names:
|
if name in seen_names:
|
||||||
continue
|
continue
|
||||||
@@ -135,19 +138,21 @@ class Help(commands.Cog, name="help"):
|
|||||||
bound_cog_name = getattr(bound_cog, "qualified_name", "").lower()
|
bound_cog_name = getattr(bound_cog, "qualified_name", "").lower()
|
||||||
if category_mapping.get(bound_cog_name) != category:
|
if category_mapping.get(bound_cog_name) != category:
|
||||||
continue
|
continue
|
||||||
if app_command.name in seen_names:
|
has_subcommands = hasattr(app_command, 'commands') and len(getattr(app_command, 'commands', [])) > 0
|
||||||
continue
|
|
||||||
description = app_command.description.partition("\n")[0] if getattr(app_command, "description", None) else "No description available"
|
if has_subcommands and category not in ["owner"]:
|
||||||
commands_in_category.append((app_command.name, description))
|
|
||||||
seen_names.add(app_command.name)
|
|
||||||
|
|
||||||
if hasattr(app_command, 'commands') and category not in ["owner"]:
|
|
||||||
for subcommand in app_command.commands:
|
for subcommand in app_command.commands:
|
||||||
if subcommand.name in seen_names:
|
if subcommand.name in seen_names:
|
||||||
continue
|
continue
|
||||||
sub_desc = subcommand.description.partition("\n")[0] if getattr(subcommand, "description", None) else "No description available"
|
sub_desc = subcommand.description.partition("\n")[0] if getattr(subcommand, "description", None) else "No description available"
|
||||||
commands_in_category.append((f"{app_command.name} {subcommand.name}", sub_desc))
|
commands_in_category.append((f"{app_command.name} {subcommand.name}", sub_desc))
|
||||||
seen_names.add(f"{app_command.name} {subcommand.name}")
|
seen_names.add(f"{app_command.name} {subcommand.name}")
|
||||||
|
else:
|
||||||
|
if app_command.name in seen_names:
|
||||||
|
continue
|
||||||
|
description = app_command.description.partition("\n")[0] if getattr(app_command, "description", None) else "No description available"
|
||||||
|
commands_in_category.append((app_command.name, description))
|
||||||
|
seen_names.add(app_command.name)
|
||||||
|
|
||||||
if not commands_in_category:
|
if not commands_in_category:
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
|
|||||||
Reference in New Issue
Block a user