Change duck-triggering to be through regex commands that catch ALL messages;

this will make is-silenced and ignores work automatically
This commit is contained in:
jesopo 2019-06-05 14:18:41 +01:00
parent 74c3d3a009
commit 7e3375cfbd

View file

@ -44,16 +44,15 @@ class Module(ModuleManager.BaseModule):
if show_duck: if show_duck:
self._trigger_duck(channel) self._trigger_duck(channel)
@utils.hook("received.message.channel", @utils.hook("command.regex")
priority=EventManager.PRIORITY_MONITOR)
def channel_message(self, event): def channel_message(self, event):
self._activity(event["channel"]) """
:pattern: .+
:command: duck-trigger
"""
self._activity(event["target"])
def _trigger_duck(self, channel): 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_lines = 0
channel.duck_active = True channel.duck_active = True
channel.send_message(DUCK) channel.send_message(DUCK)