Make sure to call the specific hook we've decided is valid (commands.py)

This commit is contained in:
jesopo 2019-01-30 19:35:43 +00:00
parent 8ac989fa96
commit 72072bbd3d
2 changed files with 12 additions and 5 deletions

View file

@ -216,12 +216,17 @@ class Module(ModuleManager.BaseModule):
args = " ".join(args_split)
server = event["server"]
user = event["user"]
new_event = self.events.on("received.command").on(command
).make_event(user=user, server=server, target=target,
args=args, tags=event["tags"], args_split=args_split,
stdout=stdout, stderr=stderr, command=command.lower(),
is_channel=is_channel)
self.log.trace("calling command '%s': %s" % (command,
new_event.kwargs))
try:
self.events.on("received.command").on(command
).call_unsafe_limited(1, user=user, server=server,
target=target, args=args, tags=event["tags"],
args_split=args_split, stdout=stdout, stderr=stderr,
command=command.lower(), is_channel=is_channel)
hook.call(new_event)
except utils.EventError as e:
stderr.write(str(e))

View file

@ -55,6 +55,8 @@ class EventHook(object):
def _make_event(self, kwargs: dict) -> Event:
return Event(self._get_path(), **kwargs)
def make_event(self, **kwargs):
return self._make_event(kwargs)
def _get_path(self) -> str:
path = []