ModuleManager's load_module function now takes a ModuleDefinition

This commit is contained in:
jesopo 2019-05-27 14:57:16 +01:00
parent 76b268e60e
commit 5b90a1a1d4

View file

@ -26,8 +26,9 @@ class Module(ModuleManager.BaseModule):
name = event["args_split"][0].lower()
if name in self.bot.modules.modules:
raise utils.EventError("Module '%s' is already loaded" % name)
definition = self.bot.modules.find_module(name)
self._catch(name, lambda: self.bot.modules.load_module(self.bot, name))
self._catch(name, lambda: self.bot.modules.load_module(self.bot, definition))
event["stdout"].write("Loaded '%s'" % name)
@utils.hook("received.command.unloadmodule", min_args=1)
@ -45,8 +46,9 @@ class Module(ModuleManager.BaseModule):
event["stdout"].write("Unloaded '%s'" % name)
def _reload(self, name):
definition = self.bot.modules.find_module(name)
self.bot.modules.unload_module(name)
self.bot.modules.load_module(self.bot, name)
self.bot.modules.load_module(self.bot, definition)
@utils.hook("received.command.reloadmodule", min_args=1)
def reload(self, event):