From 2fd92ce2fadfc3c21291e44c03039e34897aaddd Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 3 May 2019 15:42:39 +0100 Subject: bootstrap old channels for ducks.py --- modules/ducks.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/ducks.py b/modules/ducks.py index 90320dcc..601565ac 100644 --- a/modules/ducks.py +++ b/modules/ducks.py @@ -15,11 +15,18 @@ NO_DUCK = "There was no duck!" class Module(ModuleManager.BaseModule): @utils.hook("new.channel") def new_channel(self, event): - event["channel"].duck_active = False - event["channel"].duck_lines = 0 + self.bootstrap_channel(event["channel"]) + + def bootstrap_channel(self, channel): + if not hasattr(event["channel"], "duck_active"): + event["channel"].duck_active = False + event["channel"].duck_lines = 0 def _activity(self, channel): + self.bootstrap_channel(channel) + ducks_enabled = channel.get_setting("ducks-enabled", False) + if ducks_enabled and not channel.duck_active: channel.duck_lines += 1 min_lines = channel.get_setting("ducks-min-messages", 20) -- cgit v1.3.1-10-gc9f91