aboutsummaryrefslogtreecommitdiff
path: root/modules/ducks.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-10-08 13:57:26 +0100
committerGravatar jesopo2019-10-08 13:57:26 +0100
commit355689bb3547b37f73ad64916bf2f7db6d99649c (patch)
tree13bf77566bcb9301c37c4f29a5feffe0e1ce4990 /modules/ducks.py
parenttransient timers shouldn't use the event system (diff)
signature
send ducks 5-20 seconds after the message that triggered it
Diffstat (limited to 'modules/ducks.py')
-rw-r--r--modules/ducks.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/ducks.py b/modules/ducks.py
index 8fb62ebf..0312f01d 100644
--- a/modules/ducks.py
+++ b/modules/ducks.py
@@ -52,7 +52,11 @@ class Module(ModuleManager.BaseModule):
def _trigger_duck(self, channel):
channel.duck_lines = 0
channel.duck_active = time.time()
- channel.send_message(DUCK)
+ delay = random.SystemRandom().randint(5, 20)
+ self.timers.add("duck", self._send_duck, delay, channel=channel)
+
+ def _send_duck(self, timer):
+ timer.kwargs["channel"].send_message(DUCK)
def _duck_action(self, channel, user, action, setting):
duck_timestamp = channel.duck_active