optimised imports

This commit is contained in:
bacon
2024-03-14 23:56:04 +03:00
parent 3710773d7b
commit eca1f01c16
7 changed files with 67 additions and 65 deletions

View File

@@ -6,11 +6,11 @@ cog_list: return list of cog filenames
work_with_cogs: loads, reloads and unloads cogs files
"""
import os
from os import listdir
from os import listdir, rename
from typing import List
from disnake.ext import commands
from .Logger import logger
@@ -37,9 +37,9 @@ async def work_with_cogs(what_do, bot: commands.Bot, cog):
logger.info(f'Cog {_filename} reloaded')
elif what_do == 'disable':
bot.unload_extension(f'cogs.{_filename}')
os.rename(f'cogs/{_filename}.py', f'cogs/disabled/{_filename}.py')
rename(f'cogs/{_filename}.py', f'cogs/disabled/{_filename}.py')
logger.info(f'Cog {_filename} stopped and disabled')
elif what_do == 'enable':
os.rename(f'cogs/disabled/{_filename}.py', f'cogs/{_filename}.py')
rename(f'cogs/disabled/{_filename}.py', f'cogs/{_filename}.py')
bot.load_extension(f'cogs.{_filename}')
logger.info(f'Cog {_filename} started and enabled')