diff --git a/cogs/gamedata.py b/cogs/gamedata.py index 39bf644..ced9183 100644 --- a/cogs/gamedata.py +++ b/cogs/gamedata.py @@ -92,8 +92,6 @@ def setup(bot): bot.all_slash_commands = [] bot.all_slash_commands.extend( [ - cog.search, - cog.pal, - cog.item, + cog.search ] ) diff --git a/cogs/help.py b/cogs/help.py index 83a2485..50ceddf 100644 --- a/cogs/help.py +++ b/cogs/help.py @@ -2,6 +2,7 @@ from nextcord.ext import commands from nextcord.ui import Button, View import utils.constants as constants +import logging class HelpView(View): def __init__(self, bot): @@ -20,17 +21,22 @@ async def generate_help_embed(self): icon_url=constants.FOOTER_IMAGE, ) - commands = ( - self.bot.all_slash_commands - if hasattr(self.bot, "all_slash_commands") - else [] - ) + commands_with_paths = [] + + for cmd in self.bot.all_slash_commands: + if hasattr(cmd, 'children') and cmd.children: + for subcmd in cmd.children.values(): + commands_with_paths.append((f"{cmd.name} {subcmd.name}", subcmd)) + elif not hasattr(cmd, 'children') or not cmd.children: + commands_with_paths.append((cmd.name, cmd)) + + commands_with_paths.sort(key=lambda x: x[0]) start = self.current_page * 9 - end = min(start + 9, len(commands)) + end = min(start + 9, len(commands_with_paths)) - for command in commands[start:end]: + for cmd_path, command in commands_with_paths[start:end]: embed.add_field( - name=f"`/{command.name}`", + name=f"/{cmd_path}", value=command.description or "No description", inline=True, ) @@ -63,9 +69,14 @@ def __init__(self, bot): @nextcord.slash_command(description="Shows a list of available commands.") async def help(self, interaction: nextcord.Interaction): - view = HelpView(self.bot) - embed = await view.generate_help_embed() - await interaction.response.send_message(embed=embed, view=view, ephemeral=True) + try: + await interaction.response.defer(ephemeral=True) + view = HelpView(self.bot) + embed = await view.generate_help_embed() + await interaction.followup.send(embed=embed, view=view) + except Exception as e: + await interaction.followup.send(f"Error in help command: {e}") + logging.error(f"Error in help command: {e}") # Please do not remove the about me section. I've spent a lot of time on this bot and I would appreciate it if you left it in. @nextcord.slash_command(description="Information about the Palworld bot.") diff --git a/cogs/palcon.py b/cogs/palcon.py index 9c8764b..d9e48ec 100644 --- a/cogs/palcon.py +++ b/cogs/palcon.py @@ -320,14 +320,6 @@ def setup(bot): bot.all_slash_commands = [] bot.all_slash_commands.extend( [ - cog.command, - cog.showplayers, - cog.kickplayer, - cog.banplayer, - cog.unbanplayer, - cog.info, - cog.shutdown, - cog.save, - cog.broadcast, + cog.palcon, ] ) diff --git a/cogs/palguard.py b/cogs/palguard.py index 5e1a3cb..40003c7 100644 --- a/cogs/palguard.py +++ b/cogs/palguard.py @@ -502,17 +502,6 @@ def setup(bot): bot.all_slash_commands.extend( [ cog.palguard, - cog.reloadcfg, - cog.givepal, - cog.giveitem, - cog.delitem, - cog.giveexp, - cog.giveegg, - cog.palguardhelp, - cog.giverelic, - cog.whitelist, - cog.whitelistadd, - cog.whitelistremove, - cog.whitelistget, + cog.whitelist ] ) diff --git a/cogs/playerlog.py b/cogs/playerlog.py index d458c9d..d9479fb 100644 --- a/cogs/playerlog.py +++ b/cogs/playerlog.py @@ -151,8 +151,6 @@ def setup(bot): bot.all_slash_commands = [] bot.all_slash_commands.extend( [ - cog.userdb, - cog.search, - cog.searchname, + cog.userdb ] ) \ No newline at end of file diff --git a/cogs/query.py b/cogs/query.py index a708308..eb4096c 100644 --- a/cogs/query.py +++ b/cogs/query.py @@ -226,7 +226,6 @@ def setup(bot): bot.all_slash_commands = [] bot.all_slash_commands.extend( [ - cog.querylogs, - cog.removequerylogs + cog.query ] )