From b36aded9402a1405425b6dd754ef6df2a8a70ed1 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Sun, 1 Jan 2023 17:48:43 +0530 Subject: [PATCH 1/3] Move all slash command cogs to a separate path --- automod.py => cogs/automod.py | 0 economy.py => cogs/economy.py | 0 isobank.py => cogs/isobank.py | 0 levelling.py => cogs/levelling.py | 0 maths.py => cogs/maths.py | 0 minigames.py => cogs/minigames.py | 0 moderation.py => cogs/moderation.py | 0 reddit.py => cogs/reddit.py | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename automod.py => cogs/automod.py (100%) rename economy.py => cogs/economy.py (100%) rename isobank.py => cogs/isobank.py (100%) rename levelling.py => cogs/levelling.py (100%) rename maths.py => cogs/maths.py (100%) rename minigames.py => cogs/minigames.py (100%) rename moderation.py => cogs/moderation.py (100%) rename reddit.py => cogs/reddit.py (100%) diff --git a/automod.py b/cogs/automod.py similarity index 100% rename from automod.py rename to cogs/automod.py diff --git a/economy.py b/cogs/economy.py similarity index 100% rename from economy.py rename to cogs/economy.py diff --git a/isobank.py b/cogs/isobank.py similarity index 100% rename from isobank.py rename to cogs/isobank.py diff --git a/levelling.py b/cogs/levelling.py similarity index 100% rename from levelling.py rename to cogs/levelling.py diff --git a/maths.py b/cogs/maths.py similarity index 100% rename from maths.py rename to cogs/maths.py diff --git a/minigames.py b/cogs/minigames.py similarity index 100% rename from minigames.py rename to cogs/minigames.py diff --git a/moderation.py b/cogs/moderation.py similarity index 100% rename from moderation.py rename to cogs/moderation.py diff --git a/reddit.py b/cogs/reddit.py similarity index 100% rename from reddit.py rename to cogs/reddit.py From e684c6a135d601fd31026e6decf500268c7c301c Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Sun, 1 Jan 2023 17:49:50 +0530 Subject: [PATCH 2/3] Refactor main bot script to support new path for economy cog functions --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 51760128..5db7e3d5 100644 --- a/main.py +++ b/main.py @@ -17,7 +17,7 @@ from discord import ApplicationContext, option from discord.ext import commands from discord.ext.commands import * -from economy import get_wallet, get_bank, new_bank, new_wallet +from cogs.economy import get_wallet, get_bank, new_bank, new_wallet # Slash option types: # Just use variable types to define option types. From 1b37529963989c612866501e88a9f5755b743472 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Sun, 1 Jan 2023 17:51:17 +0530 Subject: [PATCH 3/3] Change cog loading path in cog initializer --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 5db7e3d5..1605dffc 100644 --- a/main.py +++ b/main.py @@ -435,7 +435,7 @@ async def stats(ctx: ApplicationContext, user: discord.User): for x in active_cogs: print(f"[main/Cogs] Loading isobot Cog ({i}/{len(active_cogs)})") i += 1 - try: client.load_extension(x) + try: client.load_extension(f"cogs.{x}") except Exception as e: cog_errors += 1 print(f"[main/Cogs] {colors.red}ERROR: Cog \"{x}\" failed to load: {e}{colors.end}")