1
0
Fork 0
mirror of synced 2024-05-06 21:52:30 +12:00

Added a load, unload, and reload modules for live use to not need to restart the bot

This commit is contained in:
Phxntxm 2016-07-09 09:39:25 -05:00
parent af7f4c8273
commit 2923c9c876

View file

@ -21,6 +21,37 @@ class Mod:
msg = ' '.join(msg)
await self.bot.say(msg)
await self.bot.delete_message(ctx.message)
@commands.command()
@checks.isAdmin()
async def load(self, *, module : str):
"""Loads a module"""
if not len(module) > 0:
await self.bot.say("Please provide a module!")
return
self.bot.load_extension(module)
await self.bot.say("I have just loaded the {} module".format(module))
@commands.command()
@checks.isAdmin()
async def unload(self, *, module : str):
"""Unloads a module"""
if not len(module) > 0:
await self.bot.say("Please provide a module!")
return
self.bot.unload_extension(module)
await self.bot.say("I have just unloaded the {} module".format(module))
@commands.command()
@checks.isAdmin()
async def reload(self, *, module : str):
"""Reloads a module"""
if not len(module) > 0:
await self.bot.say("Please provide a module!")
return
self.bot.unload_extension(module)
self.bot.load_extension(module)
await self.bot.say("I have just reloaded the {} module".format(module))
def setup(bot):