From 21fa2120df233ddea6fa4ac8e675f8fb6835447b Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 15 Sep 2019 22:22:41 +0100 Subject: [PATCH] support "0" kickrejoin delay without creating a timer --- modules/kick-rejoin.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/kick-rejoin.py b/modules/kick-rejoin.py index 5e9555e3..1082f79f 100644 --- a/modules/kick-rejoin.py +++ b/modules/kick-rejoin.py @@ -25,9 +25,15 @@ class Module(ModuleManager.BaseModule): def on_kick(self, event): if self._should_rejoin(event["server"], event["channel"]): delay = self._get_delay(event["server"], event["channel"]) - self.timers.add("kick-rejoin", delay, server=event["server"], - channel_name=event["channel"].name) + if delay == 0: + self._rejoin(event["server"], event["channel"].name) + else: + self.timers.add("kick-rejoin", delay, server=event["server"], + channel_name=event["channel"].name) @utils.hook("timer.kick-rejoin") def timer(self, event): - event["server"].send_join(event["channel_name"]) + self._rejoin(event["server"], event["channel_name"]) + + def _rejoin(self, server, channel_name): + server.send_join(channel_name)