Discord Python Handle Cogs
@commands.command(hidden=True)
async def load(self, ctx, *, module: str):
"""Loads a module."""
try:
await self.bot.load_extension(module)
except commands.ExtensionError as e:
await ctx.send(f'{e.__class__.__name__}: {e}')
else:
await ctx.send('\N{OK HAND SIGN}')
@commands.command(hidden=True)
async def unload(self, ctx, *, module: str):
"""Unloads a module."""
try:
await self.bot.unload_extension(module)
except commands.ExtensionError as e:
await ctx.send(f'{e.__class__.__name__}: {e}')
else:
await ctx.send('\N{OK HAND SIGN}')
@commands.group(name='reload', hidden=True, invoke_without_command=True)
async def _reload(self, ctx, *, module: str):
"""Reloads a module."""
try:
await self.bot.reload_extension(module)
except commands.ExtensionError as e:
await ctx.send(f'{e.__class__.__name__}: {e}')
else:
await ctx.send('\N{OK HAND SIGN}')
Hadi Zorkot