mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-26 04:51:07 -05:00
only #channel,protected users are exempted, +eI on someone banned/quieted can be removed by the bot if doActionAgainstAffected is True
This commit is contained in:
parent
d9af5e965b
commit
04fad27ef7
@ -11,8 +11,8 @@ This supybot plugin keeps records of channel mode changes, in a sqlite database
|
|||||||
!edit <id> [,<id>] [<years>y] [<weeks>w] [<days>d] [<hours>h] [<minutes>m] [<seconds>s] [<-1>] means forever) -- change expiration of some active modes
|
!edit <id> [,<id>] [<years>y] [<weeks>w] [<days>d] [<hours>h] [<minutes>m] [<seconds>s] [<-1>] means forever) -- change expiration of some active modes
|
||||||
!info <id> returns information about a mode change
|
!info <id> returns information about a mode change
|
||||||
!mark id> [,<id>] <message> add a comment about a mode change
|
!mark id> [,<id>] <message> add a comment about a mode change
|
||||||
!pending [<channel>] [<mode>] [<nick|hostmask>]) -- returns active items for mode if given otherwise all modes are returned, if hostmask given, filtered by oper
|
!pending [<channel>] (pending [--mode=<e|b|q|l>] [--oper=<nick|hostmask>] [--never] [<channel>] ) -- returns active items for --mode if given filtered by --oper if given, --never never expire only if given
|
||||||
!query <text> returns matched modes changes with deep search
|
!query [--deep] [--never] [--active] [--channel=<channel>] <pattern|hostmask|comment>) -- search inside ban database, --deep to search on log, --never returns items setted forever and active, --active returns only active modes, --channel reduces results to a specific channel
|
||||||
!match [<channel>] <nick|hostmask> returns list of modes that affects the nick,hostmask given
|
!match [<channel>] <nick|hostmask> returns list of modes that affects the nick,hostmask given
|
||||||
!detail <id> returns log from a mode change
|
!detail <id> returns log from a mode change
|
||||||
!remove [<channel>] <nick> [<reason>] do a force part on <nick> in <channel> with <reason> if provided
|
!remove [<channel>] <nick> [<reason>] do a force part on <nick> in <channel> with <reason> if provided
|
||||||
@ -125,13 +125,15 @@ On regular spam purpose, you should not use massRepeat feature, but simply repea
|
|||||||
!config channel #channel supybot.plugins.ChanTracker.repeatMode q <-- quiet
|
!config channel #channel supybot.plugins.ChanTracker.repeatMode q <-- quiet
|
||||||
!config channel #channel supybot.plugins.ChanTracker.repeatDuration 180 <-- for 3 minutes
|
!config channel #channel supybot.plugins.ChanTracker.repeatDuration 180 <-- for 3 minutes
|
||||||
|
|
||||||
Bot will do nothing against user with protected capabilities ( #channel,protected ) and people in +eI list ( supybot.plugins.ChanTracker.modesToAskWhenOpped ) with those protection features enabled.
|
Bot will do nothing against user with protected capabilities ( #channel,protected ) with those protection features enabled.
|
||||||
|
|
||||||
Bot will kick by users affected by +b see :
|
Bot will kick by users affected by +b see :
|
||||||
|
|
||||||
!config supybot.plugins.ChanTracker.kickMode
|
!config supybot.plugins.ChanTracker.kickMode
|
||||||
!config supybot.plugins.ChanTracker.kickMessage
|
!config supybot.plugins.ChanTracker.kickMessage
|
||||||
|
|
||||||
|
Bot will remove exempt, or Invite exempted for people banned if 'doActionAgainstAffected' for given channel is True
|
||||||
|
|
||||||
Note : bot will only kick people if the ban was set by itself, if an op place a ban, bot will not kick affected users
|
Note : bot will only kick people if the ban was set by itself, if an op place a ban, bot will not kick affected users
|
||||||
|
|
||||||
If the main purpose of your bot is to manage bans etc, and never interacts with users you should, as owner remove all plugin with 'owner defaultcapabilities remove <pluginname>', it will prevent the bot to answer to various command, and being used as a flood tool by others. ( like !echo SPAM )
|
If the main purpose of your bot is to manage bans etc, and never interacts with users you should, as owner remove all plugin with 'owner defaultcapabilities remove <pluginname>', it will prevent the bot to answer to various command, and being used as a flood tool by others. ( like !echo SPAM )
|
||||||
|
52
plugin.py
52
plugin.py
@ -1222,9 +1222,9 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
query = wrap(query,['user',getopts({'deep': '', 'never': '', 'active' : '','channel':'channel'}),'text'])
|
query = wrap(query,['user',getopts({'deep': '', 'never': '', 'active' : '','channel':'channel'}),'text'])
|
||||||
|
|
||||||
def pending (self, irc, msg, args, channel, optlist):
|
def pending (self, irc, msg, args, channel, optlist):
|
||||||
"""[--mode=<e|b|q|l>] [--oper=<nick|hostmask>] [--never] [<channel>]
|
"""[<channel>] [--mode=<e|b|q|l>] [--oper=<nick|hostmask>] [--never] [<channel>]
|
||||||
|
|
||||||
returns active items for mode if given otherwise all modes are returned, if hostmask given, filtered by oper"""
|
returns active items for --mode if given, filtered by --oper if given, --never never expire only if given"""
|
||||||
mode = None
|
mode = None
|
||||||
oper = None
|
oper = None
|
||||||
never = False
|
never = False
|
||||||
@ -2364,20 +2364,20 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
protected = ircdb.makeChannelCapability(channel, 'protected')
|
protected = ircdb.makeChannelCapability(channel, 'protected')
|
||||||
if ircdb.checkCapability(n.prefix, protected):
|
if ircdb.checkCapability(n.prefix, protected):
|
||||||
return True
|
return True
|
||||||
chan = self.getChan(irc,channel)
|
# chan = self.getChan(irc,channel)
|
||||||
ignoresModes = self.registryValue('modesToAskWhenOpped',channel=channel)
|
# ignoresModes = self.registryValue('modesToAskWhenOpped',channel=channel)
|
||||||
vip = False
|
# vip = False
|
||||||
for ignore in ignoresModes:
|
# for ignore in ignoresModes:
|
||||||
items = chan.getItemsFor(ignore)
|
# items = chan.getItemsFor(ignore)
|
||||||
if items:
|
# if items:
|
||||||
for item in items:
|
# for item in items:
|
||||||
if match(item,n,irc):
|
# if match(item,n,irc):
|
||||||
vip = True
|
# vip = True
|
||||||
break
|
# break
|
||||||
if vip:
|
# if vip:
|
||||||
break
|
# break
|
||||||
return vip
|
return False
|
||||||
|
|
||||||
def doPrivmsg (self,irc,msg):
|
def doPrivmsg (self,irc,msg):
|
||||||
if msg.nick == irc.nick:
|
if msg.nick == irc.nick:
|
||||||
self._tickle(irc)
|
self._tickle(irc)
|
||||||
@ -2626,6 +2626,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
toCommit = False
|
toCommit = False
|
||||||
toexpire = []
|
toexpire = []
|
||||||
|
tolift = []
|
||||||
if irc.isChannel(channel) and msg.args[1:] and channel in irc.state.channels:
|
if irc.isChannel(channel) and msg.args[1:] and channel in irc.state.channels:
|
||||||
modes = ircutils.separateModes(msg.args[1:])
|
modes = ircutils.separateModes(msg.args[1:])
|
||||||
chan = self.getChan(irc,channel)
|
chan = self.getChan(irc,channel)
|
||||||
@ -2652,20 +2653,29 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
nick = affected.split('!')[0]
|
nick = affected.split('!')[0]
|
||||||
if self._isVip(irc,channel,self.getNick(irc,nick)):
|
if self._isVip(irc,channel,self.getNick(irc,nick)):
|
||||||
continue
|
continue
|
||||||
|
if m in self.registryValue('modesToAsk',channel=channel) and self.registryValue('doActionAgainstAffected',channel=channel) and not irc.nick == nick:
|
||||||
|
for k in list(chan.getItems()):
|
||||||
|
if k in self.registryValue('modesToAskWhenOpped',channel=channel):
|
||||||
|
items = chan.getItemsFor(k)
|
||||||
|
if len(items):
|
||||||
|
for active in items:
|
||||||
|
active = items[active]
|
||||||
|
if match(active.value,self.getNick(irc,nick),irc):
|
||||||
|
tolift.append(active)
|
||||||
kicked = False
|
kicked = False
|
||||||
if m in self.registryValue('kickMode',channel=channel) and msg.nick == irc.nick: # and not value.startswith(self.getIrcdExtbans(irc)) works for unreal
|
if m in self.registryValue('kickMode',channel=channel) and msg.nick == irc.nick: # and not value.startswith(self.getIrcdExtbans(irc)) works for unreal
|
||||||
if nick in irc.state.channels[channel].users and nick != irc.nick:
|
if nick in irc.state.channels[channel].users and nick != irc.nick:
|
||||||
chan.action.enqueue(ircmsgs.kick(channel,nick,self.registryValue('kickMessage',channel=channel)))
|
chan.action.enqueue(ircmsgs.kick(channel,nick,self.registryValue('kickMessage',channel=channel)))
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
kicked = True
|
kicked = True
|
||||||
if not kicked and m in self.registryValue('modesToAsk',channel=channel) and self.registryValue('doActionAgainstAffected',channel=channel):
|
if not kicked and m in self.registryValue('modesToAsk',channel=channel) and self.registryValue('doActionAgainstAffected',channel=channel) and msg.nick == irc.nick:
|
||||||
if nick in irc.state.channels[channel].ops and not nick == irc.nick:
|
if nick in irc.state.channels[channel].ops and not nick == irc.nick:
|
||||||
chan.queue.enqueue(('-o',nick))
|
chan.queue.enqueue(('-o',nick))
|
||||||
if nick in irc.state.channels[channel].halfops and not nick == irc.nick:
|
if nick in irc.state.channels[channel].halfops and not nick == irc.nick:
|
||||||
chan.queue.enqueue(('-h',nick))
|
chan.queue.enqueue(('-h',nick))
|
||||||
if nick in irc.state.channels[channel].voices and not nick == irc.nick:
|
if nick in irc.state.channels[channel].voices and not nick == irc.nick:
|
||||||
chan.queue.enqueue(('-v',nick))
|
chan.queue.enqueue(('-v',nick))
|
||||||
self.forceTickle = True
|
|
||||||
# bot just got op
|
# bot just got op
|
||||||
if m == 'o' and value == irc.nick:
|
if m == 'o' and value == irc.nick:
|
||||||
chan.opAsked = False
|
chan.opAsked = False
|
||||||
@ -2735,6 +2745,12 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler):
|
|||||||
f = self._logChan
|
f = self._logChan
|
||||||
i.edit(irc,item.channel,item.mode,item.value,self.registryValue('autoExpire',channel=item.channel),irc.prefix,self.getDb(irc.network),self._schedule,f)
|
i.edit(irc,item.channel,item.mode,item.value,self.registryValue('autoExpire',channel=item.channel),irc.prefix,self.getDb(irc.network),self._schedule,f)
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
|
if len(tolift):
|
||||||
|
for item in tolift:
|
||||||
|
f = None
|
||||||
|
if self.registryValue('announceBotEdit',channel=item.channel):
|
||||||
|
i.edit(irc,item.channel,item.mode,item.value,0,irc.prefix,self.getDb(irc.network),self._schedule,f)
|
||||||
|
self.forceTickle = True
|
||||||
self._tickle(irc)
|
self._tickle(irc)
|
||||||
|
|
||||||
def do474(self,irc,msg):
|
def do474(self,irc,msg):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user