Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
cringe-neko-girl committed Feb 15, 2025
1 parent 4d56e3f commit d20695c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
42 changes: 23 additions & 19 deletions Cogs/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,33 +163,38 @@ async def callback(self, interaction: discord.Interaction):
self.cog_embed2.set_image(url="attachment://cog_image.png")


# Add the commands for the selected cog
cog = self.bot.get_cog(cog_name)
if cog:
cog_commands = [
cmd for cmd in cog.get_commands() if not cmd.hidden]
cog_commands = [cmd for cmd in cog.get_commands() if not cmd.hidden]
if cog_commands:
command_mapping = self._load_command_mapping().get(cog_name, {})

commands_info = "```\n"


commands_info = ""
sorted_commands = sorted(cog_commands, key=lambda cmd: cmd.name)

for cmd in sorted_commands:
cmd_args = [
(
f"[{param.name}]"
if param.default is not param.empty
else f"<{param.name}>"
)
{
"parameter": param.name,
"type": "[]" if param.default is not param.empty else "<>"
}
for param in cmd.clean_params.values()
]
args_str = " ".join(cmd_args)
command_info = (
f"{cmd.name} {args_str}"
)
commands_info += f"{command_info}\n"
commands_info += "```"

# Prepare the formatted structure for each command
command_info = {
"command": cmd.name,
"args": cmd_args
}

# Formatting each command as required
command_str = f"{command_info['command']}:\n"
for arg in command_info['args']:
command_str += f" - {arg['type']} {arg['parameter']}\n"
commands_info += f"{command_str}\n"

self.cog_embed2.description = commands_info
self.cog_embed2.description = f"```\n{commands_info}```"
else:
logger.info(f"No visible commands found for cog: {cog_name}")
else:
Expand All @@ -210,8 +215,7 @@ async def callback(self, interaction: discord.Interaction):
traceback_str = traceback.format_exc()
print(traceback_str)
logger.debug(f"An error occurred: {traceback_str}")
pass

pass

class HelpMenu(discord.ui.View):
def __init__(self, bot, primary_color, select_view, *, timeout=None):
Expand Down
2 changes: 1 addition & 1 deletion Data/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class Help_Select_Embed_Mapping:
# "<:system_icon:1238536111266201610>",
"system": "<:system:1261208067085959320>",
"quest": "<:anyasus:1258563706518765669> ",
"ai": "<:ai:1258206841737973842> ",
"ai": "",
"pokemon": "<:Pokeball:1261208239891156992>",
"anime": "<:neko_lurk:1320306198075015201>",
"information": "<:help_info:1268971820988764272>",
Expand Down

0 comments on commit d20695c

Please sign in to comment.