From efed6e001fbee1a5f1f6438e9284eb3f424dcfa6 Mon Sep 17 00:00:00 2001 From: alwayscompiling Date: Thu, 11 Aug 2022 21:55:06 -0400 Subject: [PATCH] Moved all commands into single commands cog. --- cogs/commands/__init__.py | 18 ++++++++++++++++++ .../__init__.py => commands/delete_scores.py} | 7 ------- .../post_highscores.py} | 7 ------- .../__init__.py => commands/register.py} | 7 ------- 4 files changed, 18 insertions(+), 21 deletions(-) create mode 100644 cogs/commands/__init__.py rename cogs/{delete_scores/__init__.py => commands/delete_scores.py} (88%) rename cogs/{post_highscores/__init__.py => commands/post_highscores.py} (92%) rename cogs/{register/__init__.py => commands/register.py} (94%) diff --git a/cogs/commands/__init__.py b/cogs/commands/__init__.py new file mode 100644 index 0000000..e8e2eb0 --- /dev/null +++ b/cogs/commands/__init__.py @@ -0,0 +1,18 @@ +""" +Cog loader. Adds all command classes as cogs to the bot. +""" + +from nextcord.ext import commands + +# Command classes +from .delete_scores import DeleteScores +from .post_highscores import PostHighscores +from .register import Register + +# This function will be called when this extension is loaded. +# It is necessary to add these functions to the bot. +def setup(bot: commands.Bot): + """Adds all command classes to bot.""" + bot.add_cog(DeleteScores()) + bot.add_cog(PostHighscores(bot)) + bot.add_cog(Register()) diff --git a/cogs/delete_scores/__init__.py b/cogs/commands/delete_scores.py similarity index 88% rename from cogs/delete_scores/__init__.py rename to cogs/commands/delete_scores.py index 9c417b5..1c10dd0 100644 --- a/cogs/delete_scores/__init__.py +++ b/cogs/commands/delete_scores.py @@ -42,10 +42,3 @@ class DeleteScores(commands.Cog, name="Delete Scores"): await interaction.response.send_message( "You shouldn't be using this message.", ephemeral=True ) - - -# This function will be called when this extension is loaded. -# It is necessary to add these functions to the bot. -def setup(bot: commands.Bot): - """Adds function to bot""" - bot.add_cog(DeleteScores()) diff --git a/cogs/post_highscores/__init__.py b/cogs/commands/post_highscores.py similarity index 92% rename from cogs/post_highscores/__init__.py rename to cogs/commands/post_highscores.py index b6b39bd..6fa8dba 100644 --- a/cogs/post_highscores/__init__.py +++ b/cogs/commands/post_highscores.py @@ -59,10 +59,3 @@ class PostHighscores(commands.Cog, name="Post Highscores"): highscores_data.save_guild_data(guild) await interaction.followup.send(f"Posted all tables to <#{channel.id}>.", ephemeral=True) - - -# This function will be called when this extension is loaded. -# It is necessary to add these functions to the bot. -def setup(bot: commands.Bot): - """Adds function to bot""" - bot.add_cog(PostHighscores(bot)) diff --git a/cogs/register/__init__.py b/cogs/commands/register.py similarity index 94% rename from cogs/register/__init__.py rename to cogs/commands/register.py index 40ee7c8..88bcfad 100644 --- a/cogs/register/__init__.py +++ b/cogs/commands/register.py @@ -105,10 +105,3 @@ class Register(commands.Cog, name="Register"): await interaction.send(f"Registered <#{channel_id}>.", ephemeral=True) guild.verification_channel = channel_id highscores_data.save_guild_data(guild) - - -# This function will be called when this extension is loaded. -# It is necessary to add these functions to the bot. -def setup(bot: commands.Bot) -> None: - """Adds function to bot""" - bot.add_cog(Register())