diff options
Diffstat (limited to 'src/core_modules/commands')
| -rw-r--r-- | src/core_modules/commands/__init__.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/core_modules/commands/__init__.py b/src/core_modules/commands/__init__.py index a7b55f2b..b22541d5 100644 --- a/src/core_modules/commands/__init__.py +++ b/src/core_modules/commands/__init__.py @@ -73,11 +73,12 @@ class Module(ModuleManager.BaseModule): server.get_setting(COMMAND_METHOD, self.bot.get_setting(COMMAND_METHOD, default))).upper() - def _find_command_hook(self, server, target, is_channel, command, args): + def _find_command_hook(self, server, target, is_channel, command, user, + args): if not self.has_command(command): command_event = CommandEvent(command, args) self.events.on("get.command").call(command=command_event, - server=server, target=target, is_channel=is_channel) + server=server, target=target, is_channel=is_channel, user=user) command = command_event.command args = command_event.args @@ -303,7 +304,8 @@ class Module(ModuleManager.BaseModule): if command: try: hook, command, args_split = self._find_command_hook( - event["server"], event["channel"], True, command, args) + event["server"], event["channel"], True, command, + event["user"], args) except BadContextException: event["channel"].send_message( "%s: That command is not valid in a channel" % @@ -318,7 +320,7 @@ class Module(ModuleManager.BaseModule): self.command(event["server"], event["channel"], event["target_str"], True, event["user"], command, args_split, event["line"], hook, - command_prefix=command_prefix, + command_prefix=command_prefix, expect_output=True, buffer_line=event["buffer_line"]) else: self.events.on("unknown.command").call(server=event["server"], @@ -330,6 +332,9 @@ class Module(ModuleManager.BaseModule): for hook in regex_hooks: if event["action"] and hook.get_kwarg("ignore_action", True): continue + if event["statusmsg"] and not hook.get_kwarg("statusmsg", False + ): + continue pattern = hook.get_kwarg("pattern", None) if pattern: @@ -340,7 +345,7 @@ class Module(ModuleManager.BaseModule): event["target_str"], True, event["user"], command, "", event["line"], hook, match=match, message=event["message"], command_prefix="", - action=event["action"], + action=event["action"], expect_output=False, buffer_line=event["buffer_line"]) if res: @@ -361,7 +366,8 @@ class Module(ModuleManager.BaseModule): try: hook, command, args_split = self._find_command_hook( - event["server"], event["user"], False, command, args) + event["server"], event["user"], False, command, + event["user"], args) except BadContextException: event["user"].send_message( "That command is not valid in a PM") @@ -371,7 +377,7 @@ class Module(ModuleManager.BaseModule): self.command(event["server"], event["user"], event["user"].nickname, False, event["user"], command, args_split, event["line"], hook, command_prefix="", - buffer_line=event["buffer_line"]) + buffer_line=event["buffer_line"], expect_output=True) else: self.events.on("unknown.command").call(server=event["server"], target=event["user"], user=event["user"], command=command, |
