Added a load, unload, and reload modules for live use to not need to restart the bot
This commit is contained in:
parent
af7f4c8273
commit
2923c9c876
31
cogs/mod.py
31
cogs/mod.py
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue