From 82424415d459281d7a40e065d587cd20776ac178 Mon Sep 17 00:00:00 2001 From: Nicolas Coevoet Date: Mon, 24 Nov 2014 22:10:20 +0100 Subject: [PATCH] nag announces can be disabled, just set announceNagInterval to -1, and also, that allows plugin reload without issues --- config.py | 2 +- plugin.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index eab1bd9..b381037 100644 --- a/config.py +++ b/config.py @@ -132,7 +132,7 @@ conf.registerChannelValue(ChanTracker, 'announceNagMode', registry.CommaSeparatedListOfStrings([], """bot will announce that channel has such mode at announceNagInterval""")) conf.registerGlobalValue(ChanTracker, 'announceNagInterval', - registry.PositiveInteger(300,"""interval between two check about announceNagMode, this setting is global.""")) + registry.Integer(300,"""interval between two check about announceNagMode, this setting is global.""")) # others settings diff --git a/plugin.py b/plugin.py index f3e44f1..8357626 100644 --- a/plugin.py +++ b/plugin.py @@ -1165,7 +1165,8 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): self._ircs = ircutils.IrcDict() self.getIrc(irc) self.recaps = re.compile("[A-Z]") - schedule.addEvent(self.checkNag,time.time()+self.registryValue('announceNagInterval')) + if self.registryValue('announceNagInterval') > 0: + schedule.addEvent(self.checkNag,time.time()+self.registryValue('announceNagInterval')) def checkNag (self): if world: @@ -1183,7 +1184,8 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): if self.registryValue('useColorForAnnounces',channel=channel): message = '[%s] has %s mode' % (ircutils.bold(channel),toNag) self._logChan(irc,channel,message) - schedule.addEvent(self.checkNag,time.time()+self.registryValue('announceNagInterval')) + if self.registryValue('announceNagInterval') > 0 + schedule.addEvent(self.checkNag,time.time()+self.registryValue('announceNagInterval')) def summary (self,irc,msg,args,channel): """[]