diff options
| author | Rapptz <[email protected]> | 2016-01-10 02:26:57 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-01-10 02:26:57 -0500 |
| commit | efcc55bd3267a10a9873d16e33d768e409c135ca (patch) | |
| tree | 65b9cc1738467be1bacef6566ad0dc773be7726e | |
| parent | [commands] Add Group.invoke_without_command. (diff) | |
| download | discord.py-efcc55bd3267a10a9873d16e33d768e409c135ca.tar.xz discord.py-efcc55bd3267a10a9873d16e33d768e409c135ca.zip | |
[commands] Proper cleanup of cogs.
| -rw-r--r-- | discord/ext/commands/bot.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 2515a833..e09362ea 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -377,6 +377,8 @@ class Bot(GroupMixin, discord.Client): if name.startswith('on_'): self.remove_listener(member) + del cog + # extensions def load_extension(self, name): @@ -400,7 +402,7 @@ class Bot(GroupMixin, discord.Client): # remove the cogs registered from the module for cogname, cog in self.cogs.copy().items(): - if cog.__module__ is lib: + if inspect.getmodule(cog) is lib: self.remove_cog(cogname) # first remove all the commands from the module |