Skip to content

Commit

Permalink
[commands] Proper cleanup of cogs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapptz committed Jan 10, 2016
1 parent 38bac7f commit efcc55b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion discord/ext/commands/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ def remove_cog(self, name):
if name.startswith('on_'):
self.remove_listener(member)

del cog

# extensions

def load_extension(self, name):
Expand All @@ -400,7 +402,7 @@ def unload_extension(self, name):

# 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
Expand Down

0 comments on commit efcc55b

Please sign in to comment.