From 54933adf87841c1b07a3c4cc64bb89430efc249a Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 19 Aug 2021 10:39:24 +0200 Subject: [PATCH] global variable for the name of the cog folder --- src/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index 2943097..6a524b7 100644 --- a/src/main.py +++ b/src/main.py @@ -12,18 +12,20 @@ customPrefix = keys["PREFIX"] client = commands.Bot(command_prefix = customPrefix, case_insensitive = True, intents = discord.Intents.all()) slash = SlashCommand(client, sync_commands = True) +client.cogs_folder = "cogs" + if keys["DEACTIVATE"] != "None": path = getcwd() for file in keys["DEACTIVATE"]: try: - rename(f"{path}/cogs/{file}.py", f"{path}/cogs/-{file}.py") # désactivation + rename(f"{path}/{client.cogs_folder}/{file}.py", f"{path}/{client.cogs_folder}/-{file}.py") # désactivation except: print(f"No file {file} found, check your \"DEACTIVATE\" variable.") exit(1) -for file in listdir("cogs"): +for file in listdir(client.cogs_folder): if file.endswith(".py") and file.startswith("-") == False: - client.load_extension(f"cogs.{file[:-3]}") + client.load_extension(f"{client.cogs_folder}.{file[:-3]}") print("Terminé !") @client.event