Correctly scope 'filename' in modules/script.py._load_scripts

This commit is contained in:
jesopo 2018-10-06 16:18:59 +01:00
parent 90680c11ef
commit 930a4bcbc2

View file

@ -16,10 +16,13 @@ class Module(object):
if hashflag == "name" and value:
name = value
elif hashflag == "hook" and value:
hook = self.events.on(value).hook(
lambda x: self.call(x, filename, name))
hook_fn = self._make_hook(filename, name)
hook = self.events.on(value).hook(hook_fn)
self._hooks.append([value, hook])
def _make_hook(self, filename, name):
return lambda event: self.call(event, filename, name)
@utils.hook("received.command.reloadscripts", permission="reloadscripts")
def reload(self, event):
for event_name, hook in self._hooks: