Unload a module now unsubscribe auto-registered hooks

This commit is contained in:
Némunaire 2012-09-01 11:23:41 +02:00
parent 4055025160
commit fc396ef313
3 changed files with 35 additions and 5 deletions

3
bot.py
View file

@ -158,6 +158,9 @@ class Bot:
self.modules[name].save()
if hasattr(self.modules[name], "unload"):
self.modules[name].unload()
# Remove registered hooks
for (s, h) in self.modules[name].REGISTERED_HOOKS:
self.hooks.del_hook(s, h)
# Remove from the dict
del self.modules[name]
return True