mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-26 21:11:13 -05:00
added 'nag' feature, which can announce in logChannel at regular interval that some modes are setted
This commit is contained in:
parent
c6014c3902
commit
e76b5665bf
@ -128,6 +128,12 @@ conf.registerChannelValue(ChanTracker, 'announceNotice',
|
|||||||
conf.registerChannelValue(ChanTracker, 'announceCtcp',
|
conf.registerChannelValue(ChanTracker, 'announceCtcp',
|
||||||
registry.Boolean(True,"""announce channel ctcps to logChannel"""))
|
registry.Boolean(True,"""announce channel ctcps to logChannel"""))
|
||||||
|
|
||||||
|
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."""))
|
||||||
|
|
||||||
# others settings
|
# others settings
|
||||||
|
|
||||||
conf.registerChannelValue(ChanTracker, 'doNothingAboutOwnOpStatus',
|
conf.registerChannelValue(ChanTracker, 'doNothingAboutOwnOpStatus',
|
||||||
|
18
plugin.py
18
plugin.py
@ -1100,7 +1100,25 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
self._ircs = ircutils.IrcDict()
|
self._ircs = ircutils.IrcDict()
|
||||||
self.getIrc(irc)
|
self.getIrc(irc)
|
||||||
self.recaps = re.compile("[A-Z]")
|
self.recaps = re.compile("[A-Z]")
|
||||||
|
schedule.addEvent(self.checkNag,time.time()+self.registryValue('announceNagInterval'))
|
||||||
|
|
||||||
|
def checkNag (self):
|
||||||
|
if world:
|
||||||
|
if world.ircs:
|
||||||
|
for irc in world.ircs:
|
||||||
|
for channel in irc.state.channels:
|
||||||
|
if self.registryValue('logChannel',channel=channel) in irc.state.channels:
|
||||||
|
toNag = ''
|
||||||
|
for mode in self.registryValue('announceNagMode',channel=channel):
|
||||||
|
if mode in irc.state.channels[channel].modes:
|
||||||
|
toNag = mode
|
||||||
|
break
|
||||||
|
if len(toNag):
|
||||||
|
message = '[%s] has %s mode' % (channel,toNag)
|
||||||
|
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'))
|
||||||
|
|
||||||
def editandmark (self,irc,msg,args,user,ids,seconds,reason):
|
def editandmark (self,irc,msg,args,user,ids,seconds,reason):
|
||||||
"""<id>[,<id>] [<years>y] [<weeks>w] [<days>d] [<hours>h] [<minutes>m] [<seconds>s] [<-1> or empty means forever, <0s> means remove] [<reason>]
|
"""<id>[,<id>] [<years>y] [<weeks>w] [<days>d] [<hours>h] [<minutes>m] [<seconds>s] [<-1> or empty means forever, <0s> means remove] [<reason>]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user