global variable for the name of the cog folder

This commit is contained in:
Mylloon 2021-08-19 10:39:24 +02:00
parent 07b671a728
commit 54933adf87

View file

@ -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