diff options
| -rw-r--r-- | modules/commands/__init__.py | 16 | ||||
| -rw-r--r-- | modules/ducks.py | 2 | ||||
| -rw-r--r-- | modules/factoids.py | 2 | ||||
| -rw-r--r-- | modules/github/__init__.py | 4 | ||||
| -rw-r--r-- | modules/imgur.py | 4 | ||||
| -rw-r--r-- | modules/title.py | 2 | ||||
| -rw-r--r-- | modules/tweets/__init__.py | 2 | ||||
| -rw-r--r-- | modules/youtube.py | 2 |
8 files changed, 18 insertions, 16 deletions
diff --git a/modules/commands/__init__.py b/modules/commands/__init__.py index 9cc1c8fe..0500b5ae 100644 --- a/modules/commands/__init__.py +++ b/modules/commands/__init__.py @@ -263,19 +263,15 @@ class Module(ModuleManager.BaseModule): @utils.hook("received.message.channel", priority=EventManager.PRIORITY_LOW) def channel_message(self, event): - if event["action"]: - return - commands_enabled = event["channel"].get_setting("commands", True) if not commands_enabled: return - prefixed_commands = event["channel"].get_setting("prefixed-commands", True) command_prefix = self._command_prefix(event["server"], event["channel"]) command = None args_split = None if event["message_split"][0].startswith(command_prefix): - if not prefixed_commands: + if not event["channel"].get_setting("prefixed-commands",True): return command = event["message_split"][0].replace( command_prefix, "", 1).lower() @@ -286,6 +282,9 @@ class Module(ModuleManager.BaseModule): args_split = event["message_split"][2:] if command: + if event["action"]: + return + hook, args_split = self._find_command_hook(event["server"], command, True, args_split) if hook: @@ -295,8 +294,11 @@ class Module(ModuleManager.BaseModule): command_prefix=command_prefix) event["channel"].buffer.skip_next() else: - regex_hook = self.events.on("command.regex").get_hooks() - for hook in regex_hook: + regex_hooks = self.events.on("command.regex").get_hooks() + for hook in regex_hooks: + if event["action"] and hook.get_kwarg("ignore_action", True): + continue + pattern = hook.get_kwarg("pattern", None) if not pattern and hook.get_kwarg("pattern-url", None) == "1": pattern = utils.http.REGEX_URL diff --git a/modules/ducks.py b/modules/ducks.py index cbf65eba..1fa4d854 100644 --- a/modules/ducks.py +++ b/modules/ducks.py @@ -44,7 +44,7 @@ class Module(ModuleManager.BaseModule): if show_duck: self._trigger_duck(channel) - @utils.hook("command.regex", expect_output=False) + @utils.hook("command.regex", expect_output=False, ignore_action=False) def channel_message(self, event): """ :pattern: .+ diff --git a/modules/factoids.py b/modules/factoids.py index 3dbb7498..e4c93d34 100644 --- a/modules/factoids.py +++ b/modules/factoids.py @@ -26,7 +26,7 @@ class Module(ModuleManager.BaseModule): raise utils.EventError("Unknown factoid '%s'" % name) event["stdout"].write("%s: %s" % (name, value)) - @utils.hook("command.regex") + @utils.hook("command.regex", ignore_action=False) def channel_message(self, event): """ :command: factoid diff --git a/modules/github/__init__.py b/modules/github/__init__.py index 7f3ff8f7..3dee37d5 100644 --- a/modules/github/__init__.py +++ b/modules/github/__init__.py @@ -252,7 +252,7 @@ class Module(ModuleManager.BaseModule): else: return True - @utils.hook("command.regex") + @utils.hook("command.regex", ignore_action=False) def url_regex(self, event): """ :command: github @@ -272,7 +272,7 @@ class Module(ModuleManager.BaseModule): event["stdout"].hide_prefix() event["stdout"].write(result) - @utils.hook("command.regex") + @utils.hook("command.regex", ignore_action=False) def ref_regex(self, event): """ :command: github diff --git a/modules/imgur.py b/modules/imgur.py index 94172513..2cccaac6 100644 --- a/modules/imgur.py +++ b/modules/imgur.py @@ -28,7 +28,7 @@ class Module(ModuleManager.BaseModule): text += "%s " % data["account_url"] return text - @utils.hook("command.regex", pattern=REGEX_IMAGE) + @utils.hook("command.regex", pattern=REGEX_IMAGE, ignore_action=False) def _regex_image(self, event): """ :command: imgur @@ -36,7 +36,7 @@ class Module(ModuleManager.BaseModule): if event["target"].get_setting("auto-imgur", False): event["stdout"].write(self._parse_image(event["match"].group(1))) event.eat() - @utils.hook("command.regex", pattern=REGEX_GALLERY) + @utils.hook("command.regex", pattern=REGEX_GALLERY, ignore_action=False) def _regex_gallery(self, event): """ :command: imgur diff --git a/modules/title.py b/modules/title.py index e1757f33..6e1e729e 100644 --- a/modules/title.py +++ b/modules/title.py @@ -47,7 +47,7 @@ class Module(ModuleManager.BaseModule): else: return None - @utils.hook("command.regex", + @utils.hook("command.regex", ignore_action=False, priority=EventManager.PRIORITY_MONITOR) def channel_message(self, event): """ diff --git a/modules/tweets/__init__.py b/modules/tweets/__init__.py index edc4fcd2..afe9ea4c 100644 --- a/modules/tweets/__init__.py +++ b/modules/tweets/__init__.py @@ -166,7 +166,7 @@ class Module(ModuleManager.BaseModule): else: event["stderr"].write("No tweet provided to get information about") - @utils.hook("command.regex", pattern=REGEX_TWITTERURL) + @utils.hook("command.regex", pattern=REGEX_TWITTERURL, ignore_action=False) def regex(self, event): """ :command: tweet diff --git a/modules/youtube.py b/modules/youtube.py index 8742ad65..2b89d021 100644 --- a/modules/youtube.py +++ b/modules/youtube.py @@ -130,7 +130,7 @@ class Module(ModuleManager.BaseModule): else: event["stderr"].write("No search phrase provided") - @utils.hook("command.regex", + @utils.hook("command.regex", ignore_action=False, priority=EventManager.PRIORITY_LOW) def channel_message(self, event): """ |
