From 7e3375cfbd099915d80e9485bf9e423a13372ecb Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 5 Jun 2019 14:18:41 +0100 Subject: [PATCH] Change duck-triggering to be through regex commands that catch ALL messages; this will make is-silenced and ignores work automatically --- modules/ducks.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/ducks.py b/modules/ducks.py index 5a3d02db..ce4af8ca 100644 --- a/modules/ducks.py +++ b/modules/ducks.py @@ -44,16 +44,15 @@ class Module(ModuleManager.BaseModule): if show_duck: self._trigger_duck(channel) - @utils.hook("received.message.channel", - priority=EventManager.PRIORITY_MONITOR) + @utils.hook("command.regex") def channel_message(self, event): - self._activity(event["channel"]) + """ + :pattern: .+ + :command: duck-trigger + """ + self._activity(event["target"]) def _trigger_duck(self, channel): - is_silenced_f = self.exports.get_one("is-silenced", lambda _: False) - if is_silenced_f(channel): - return - channel.duck_lines = 0 channel.duck_active = True channel.send_message(DUCK)