Correctly scope 'filename' in modules/script.py._load_scripts
This commit is contained in:
parent
90680c11ef
commit
930a4bcbc2
1 changed files with 5 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue