global variable for the name of the cog folder
This commit is contained in:
parent
07b671a728
commit
54933adf87
1 changed files with 5 additions and 3 deletions
|
@ -12,18 +12,20 @@ customPrefix = keys["PREFIX"]
|
||||||
client = commands.Bot(command_prefix = customPrefix, case_insensitive = True, intents = discord.Intents.all())
|
client = commands.Bot(command_prefix = customPrefix, case_insensitive = True, intents = discord.Intents.all())
|
||||||
slash = SlashCommand(client, sync_commands = True)
|
slash = SlashCommand(client, sync_commands = True)
|
||||||
|
|
||||||
|
client.cogs_folder = "cogs"
|
||||||
|
|
||||||
if keys["DEACTIVATE"] != "None":
|
if keys["DEACTIVATE"] != "None":
|
||||||
path = getcwd()
|
path = getcwd()
|
||||||
for file in keys["DEACTIVATE"]:
|
for file in keys["DEACTIVATE"]:
|
||||||
try:
|
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:
|
except:
|
||||||
print(f"No file {file} found, check your \"DEACTIVATE\" variable.")
|
print(f"No file {file} found, check your \"DEACTIVATE\" variable.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
for file in listdir("cogs"):
|
for file in listdir(client.cogs_folder):
|
||||||
if file.endswith(".py") and file.startswith("-") == False:
|
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é !")
|
print("Terminé !")
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
|
|
Reference in a new issue