1
0
Fork 0
mirror of synced 2024-06-02 18:54:33 +12:00

added cogs. if not included, to make module loading/unloading easier

This commit is contained in:
Phxntxm 2016-07-09 10:02:09 -05:00
parent 26fe9dee67
commit e68fa688c4

View file

@ -27,9 +27,9 @@ class Mod:
async def load(self, *, module : str): async def load(self, *, module : str):
"""Loads a module""" """Loads a module"""
try: try:
if not len(module) > 0: module = module.lower()
await self.bot.say("Please provide a module!") if not module.startswith("cogs"):
return module = "cogs.{}".format(module)
self.bot.load_extension(module) self.bot.load_extension(module)
await self.bot.say("I have just loaded the {} module".format(module)) await self.bot.say("I have just loaded the {} module".format(module))
except Exception as e: except Exception as e:
@ -41,9 +41,9 @@ class Mod:
async def unload(self, *, module : str): async def unload(self, *, module : str):
"""Unloads a module""" """Unloads a module"""
try: try:
if not len(module) > 0: module = module.lower()
await self.bot.say("Please provide a module!") if not module.startswith("cogs"):
return module = "cogs.{}".format(module)
self.bot.unload_extension(module) self.bot.unload_extension(module)
await self.bot.say("I have just unloaded the {} module".format(module)) await self.bot.say("I have just unloaded the {} module".format(module))
except Exception as e: except Exception as e:
@ -55,9 +55,9 @@ class Mod:
async def reload(self, *, module : str): async def reload(self, *, module : str):
"""Reloads a module""" """Reloads a module"""
try: try:
if not len(module) > 0: module = module.lower()
await self.bot.say("Please provide a module!") if not module.startswith("cogs"):
return module = "cogs.{}".format(module)
self.bot.unload_extension(module) self.bot.unload_extension(module)
self.bot.load_extension(module) self.bot.load_extension(module)
await self.bot.say("I have just reloaded the {} module".format(module)) await self.bot.say("I have just reloaded the {} module".format(module))