aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2019-05-03 15:42:39 +0100
committerGravatar jesopo2019-05-03 15:42:39 +0100
commit2fd92ce2fadfc3c21291e44c03039e34897aaddd (patch)
tree2085c98007c97a6141b22f2f515611e6e2b41879 /modules
parentRefector ducks.py (diff)
signature
bootstrap old channels for ducks.py
Diffstat (limited to 'modules')
-rw-r--r--modules/ducks.py11
1 files 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)