Disable commands at !load !reload

This commit is contained in:
Twentysix 2016-05-07 13:46:02 +02:00
parent def2035f19
commit de5710082e

View File

@ -72,6 +72,7 @@ class Owner:
' Check your logs for more information.') ' Check your logs for more information.')
else: else:
set_cog(module, True) set_cog(module, True)
await self.disable_commands()
await self.bot.say("Module enabled.") await self.bot.say("Module enabled.")
@commands.command() @commands.command()
@ -128,6 +129,7 @@ class Owner:
" logs for more information.") " logs for more information.")
else: else:
set_cog(module, True) set_cog(module, True)
await self.disable_commands()
await self.bot.say("Module reloaded.") await self.bot.say("Module reloaded.")
@commands.command(pass_context=True, hidden=True) @commands.command(pass_context=True, hidden=True)
@ -348,8 +350,11 @@ class Owner:
async def disable_commands(self): # runs at boot async def disable_commands(self): # runs at boot
for cmd in self.disabled_commands: for cmd in self.disabled_commands:
cmd_obj = await self.get_command(cmd) cmd_obj = await self.get_command(cmd)
try:
cmd_obj.enabled = False cmd_obj.enabled = False
cmd_obj.hidden = True cmd_obj.hidden = True
except:
pass
@commands.command() @commands.command()
@checks.is_owner() @checks.is_owner()