added requirements.txt

This commit is contained in:
2022-08-28 19:25:39 +03:00
parent a603898f2d
commit 78a477f21a
8 changed files with 175 additions and 125 deletions

View File

@@ -1,5 +1,8 @@
import logging
from os import listdir
from disnake.ext import commands
"""
Loads, unloads Cogs files
cog_list: return list of cog filenames
@@ -18,7 +21,19 @@ def cog_list():
async def work_with_cogs(what_do, bot):
for _filename in cog_list():
if what_do == "load":
bot.load_extension(f'cogs.{_filename}')
try:
bot.load_extension(f'cogs.{_filename}')
logging.info(f'Loaded cog {_filename}')
except commands.ExtensionNotFound:
logging.error(f"Error: {_filename} couldn't be found to load.")
except commands.ExtensionFailed as error:
logging.error(f'Error: {_filename} failed to load properly.', error)
except commands.ExtensionError:
logging.error(f'Error: unknown error with {_filename}')
elif what_do == 'unload':
bot.unload_extension(f'cogs.{_filename}')
elif what_do == 'reload':