ModuleManager's load_module function now takes a ModuleDefinition
This commit is contained in:
parent
76b268e60e
commit
5b90a1a1d4
1 changed files with 4 additions and 2 deletions
|
@ -26,8 +26,9 @@ class Module(ModuleManager.BaseModule):
|
||||||
name = event["args_split"][0].lower()
|
name = event["args_split"][0].lower()
|
||||||
if name in self.bot.modules.modules:
|
if name in self.bot.modules.modules:
|
||||||
raise utils.EventError("Module '%s' is already loaded" % name)
|
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)
|
event["stdout"].write("Loaded '%s'" % name)
|
||||||
|
|
||||||
@utils.hook("received.command.unloadmodule", min_args=1)
|
@utils.hook("received.command.unloadmodule", min_args=1)
|
||||||
|
@ -45,8 +46,9 @@ class Module(ModuleManager.BaseModule):
|
||||||
event["stdout"].write("Unloaded '%s'" % name)
|
event["stdout"].write("Unloaded '%s'" % name)
|
||||||
|
|
||||||
def _reload(self, name):
|
def _reload(self, name):
|
||||||
|
definition = self.bot.modules.find_module(name)
|
||||||
self.bot.modules.unload_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)
|
@utils.hook("received.command.reloadmodule", min_args=1)
|
||||||
def reload(self, event):
|
def reload(self, event):
|
||||||
|
|
Loading…
Reference in a new issue