optimised imports
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user