def unload(self, *, cog_name: str):
"""Unloads a module
Example: unload mod"""
module = cog_name.strip()
if "modules." not in module:
module = "modules." + module
if not self._does_cogfile_exist(module):
await ctx.send("That cog file doesn't exist. I will not"
" turn off autoloading at start just in case"
" this isn't supposed to happen.")
else:
set_cog(module, False)
try: # No matter what we should try to unload it
self._unload_cog(module)
except OwnerUnloadWithoutReloadError:
await ctx.send("I cannot allow you to unload the Owner plugin"
" unless you are in the process of reloading.")
except CogUnloadError as e:
logger.exception(e)
traceback.print_exc()
await ctx.send('Unable to safely unload that cog.')
else:
await ctx.send("The cog has been unloaded.")
评论列表
文章目录