diff --git a/cogs/economy/core.py b/cogs/economy/core.py index ddc0565..7974914 100644 --- a/cogs/economy/core.py +++ b/cogs/economy/core.py @@ -28,6 +28,7 @@ def __init__(self, bot): self.bot.loop.create_task(init_db()) self.bot.loop.create_task(self.load_config()) self.refresh_settings.start() + self.clear_old_cooldowns.start() self.work_cooldown = {} self.daily_cooldown = {} self.economy_config = {} diff --git a/cogs/giveaway.py b/cogs/giveaway.py index 1a71cac..0ef297b 100644 --- a/cogs/giveaway.py +++ b/cogs/giveaway.py @@ -121,4 +121,9 @@ async def end_giveaway(self, view, giveaway_message): print(f"Error ending giveaway: {e}") def setup(bot): - bot.add_cog(GiveawayCog(bot)) + cog = GiveawayCog(bot) + bot.add_cog(cog) + + if not hasattr(bot, "all_slash_commands"): + bot.all_slash_commands = [] + bot.all_slash_commands.append(cog.giveaway) diff --git a/cogs/help.py b/cogs/help.py index b30f51e..3698aac 100644 --- a/cogs/help.py +++ b/cogs/help.py @@ -16,13 +16,8 @@ async def generate_help_embed(self): description="List of all available commands.", color=nextcord.Color.blue(), ) - embed.set_footer( - text=f"{constants.FOOTER_TEXT}: Page {self.current_page + 1}", - icon_url=constants.FOOTER_IMAGE, - ) - + commands_with_paths = [] - for cmd in self.bot.all_slash_commands: if hasattr(cmd, 'children') and cmd.children: for subcmd in cmd.children.values(): @@ -31,6 +26,13 @@ async def generate_help_embed(self): commands_with_paths.append((cmd.name, cmd)) commands_with_paths.sort(key=lambda x: x[0]) + total_pages = (len(commands_with_paths) - 1) // 9 + 1 + + embed.set_footer( + text=f"{constants.FOOTER_TEXT}: Page {self.current_page + 1}/{total_pages}", + icon_url=constants.FOOTER_IMAGE, + ) + start = self.current_page * 9 end = min(start + 9, len(commands_with_paths)) @@ -50,11 +52,15 @@ async def previous_button_callback(self, button, interaction): @nextcord.ui.button(label="Next", style=nextcord.ButtonStyle.blurple) async def next_button_callback(self, button, interaction): - if (self.current_page + 1) * 9 < len( - 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)) + + if (self.current_page + 1) * 9 < len(commands_with_paths): self.current_page += 1 await self.update_help_message(interaction) @@ -129,4 +135,13 @@ async def about(self, interaction: nextcord.Interaction): await interaction.response.send_message(embed=embed, view=view, ephemeral=True) def setup(bot): - bot.add_cog(HelpCog(bot)) \ No newline at end of file + cog = HelpCog(bot) + bot.add_cog(cog) + if not hasattr(bot, "all_slash_commands"): + bot.all_slash_commands = [] + bot.all_slash_commands.extend( + [ + cog.help, + cog.about, + ] + ) \ No newline at end of file diff --git a/cogs/playerlist.py b/cogs/playerlist.py index ec33c4c..9437af3 100644 --- a/cogs/playerlist.py +++ b/cogs/playerlist.py @@ -149,4 +149,8 @@ def setup(bot): bot.add_cog(cog) if not hasattr(bot, "all_slash_commands"): bot.all_slash_commands = [] - bot.all_slash_commands.append(cog.playerslist) + bot.all_slash_commands.extend( + [ + cog.playerslist + ] + )