nag announces can be disabled, just set announceNagInterval to -1, and also, that allows plugin reload without issues

This commit is contained in:
Nicolas Coevoet 2014-11-24 22:10:20 +01:00
parent e33c69219a
commit 82424415d4
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -1165,6 +1165,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
self._ircs = ircutils.IrcDict()
self.getIrc(irc)
self.recaps = re.compile("[A-Z]")
if self.registryValue('announceNagInterval') > 0:
schedule.addEvent(self.checkNag,time.time()+self.registryValue('announceNagInterval'))
def checkNag (self):
@ -1183,6 +1184,7 @@ 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)
if self.registryValue('announceNagInterval') > 0
schedule.addEvent(self.checkNag,time.time()+self.registryValue('announceNagInterval'))
def summary (self,irc,msg,args,channel):