From 81f6715d7d76f6ae4e23ac3ba980fc04112a6e0b Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 18 Sep 2019 17:45:58 +0100 Subject: [PATCH] move slowvoice.py to bitbot-modules --- modules/slowvoice.py | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 modules/slowvoice.py diff --git a/modules/slowvoice.py b/modules/slowvoice.py deleted file mode 100644 index dfbc40a8..00000000 --- a/modules/slowvoice.py +++ /dev/null @@ -1,44 +0,0 @@ -#--depends-on config - -from src import ModuleManager, utils - -DELAY = 30 # 30 seconds - -@utils.export("channelset", utils.BoolSetting("slowvoice", - "Enable/disable giving +v to new users after a delay")) -@utils.export("channelset", utils.IntSetting("slowvoice-delay", - "Set delay for slowvoice in seconds")) -class Module(ModuleManager.BaseModule): - @utils.hook("timer.slowvoice") - def timer(self, event): - event["channel"].send_mode("+v", [event["user"].nickname]) - - @utils.hook("new.channel") - def new_channel(self, event): - event["channel"]._slowvoice_timers = {} - - @utils.hook("received.join") - def on_join(self, event): - if event["channel"].get_setting("slowvoice", False): - delay = event["channel"].get_setting("slowvoice-delay", DELAY) - timer = self.timers.add("slowvoice", delay, - channel=event["channel"], user=event["user"]) - event["channel"]._slowvoice_timers[event["user"]] = timer - - def _cancel_timer(self, user, channel): - if user in channel._slowvoice_timers: - timer = channel._slowvoice_timers.pop(user) - timer.cancel() - - @utils.hook("received.part") - def on_part(self, event): - self._cancel_timer(event["user"], event["channel"]) - - @utils.hook("received.quit") - def on_quit(self, event): - for channel in event["user"].channels: - self._cancel_timer(event["user"], channel) - - @utils.hook("self.part") - def self_part(self, event): - event["channel"]._slowvoice_timers.clear()