added requirements.txt
This commit is contained in:
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user