From 94d2f103b05acd9e4dd67ca039020318f7fd44b0 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 15 May 2019 16:48:20 +0100 Subject: Don't show ducks when the bot is silenced --- modules/ducks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/ducks.py b/modules/ducks.py index 01b46457..072bbb57 100644 --- a/modules/ducks.py +++ b/modules/ducks.py @@ -38,7 +38,6 @@ class Module(ModuleManager.BaseModule): show_duck = random.SystemRandom().randint(1, 20) == 1 if show_duck: - channel.duck_lines = 0 self._trigger_duck(channel) @utils.hook("received.join") @@ -50,6 +49,11 @@ class Module(ModuleManager.BaseModule): self._activity(event["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_active = True channel.send_message(DUCK) -- cgit v1.3.1-10-gc9f91