Unload a module now unsubscribe auto-registered hooks
This commit is contained in:
parent
4055025160
commit
fc396ef313
3 changed files with 35 additions and 5 deletions
3
bot.py
3
bot.py
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue