def _reload(self, *, cog_name: str):
"""Reloads a module
Example: reload audio"""
module = cog_name.strip()
if "modules." not in module:
module = "modules." + module
try:
self._unload_cog(module, reloading=True)
except:
pass
try:
self._load_cog(module)
except CogNotFoundError:
await ctx.send("That cog cannot be found.")
except NoSetupError:
await ctx.send("That cog does not have a setup function.")
except CogLoadError as e:
logger.exception(e)
traceback.print_exc()
await ctx.send("That cog could not be loaded. Check your"
" console or logs for more information.")
else:
set_cog(module, True)
await self.disable_commands()
await ctx.send("The cog has been reloaded.")
评论列表
文章目录