mirror of
https://github.com/ncoevoet/ChanTracker.git
synced 2025-04-26 21:11:13 -05:00
Rework notification system.
This commit is contained in:
parent
8250443443
commit
d7b888b8eb
25
config.py
25
config.py
@ -195,19 +195,24 @@ conf.registerChannelValue(ChanTracker, 'kickMax',
|
|||||||
conf.registerChannelValue(ChanTracker, 'kickMessage',
|
conf.registerChannelValue(ChanTracker, 'kickMessage',
|
||||||
registry.CommaSeparatedListOfStrings(["You are banned from this channel"], """bot kick reason"""))
|
registry.CommaSeparatedListOfStrings(["You are banned from this channel"], """bot kick reason"""))
|
||||||
|
|
||||||
conf.registerChannelValue(ChanTracker, 'quietMessage',
|
|
||||||
registry.String("", """leave empty if you don't want the bot to tell something to the user when they have been quieted (by/via the bot);
|
|
||||||
in any case, if channel is under attack, bot will not send message; if filled, the operator nick will be given for accountability"""))
|
|
||||||
|
|
||||||
conf.registerChannelValue(ChanTracker, 'quietNotice',
|
|
||||||
registry.Boolean(False, """if False, private message is used, if quietMessage is not empty"""))
|
|
||||||
|
|
||||||
conf.registerChannelValue(ChanTracker, 'banMessage',
|
conf.registerChannelValue(ChanTracker, 'banMessage',
|
||||||
registry.String("", """leave empty if you don't want the bot to tell something to the user when they have been banned (by/via the bot);
|
registry.String("You have been banned on $channel", """set empty if you don't want the bot to tell something to the user
|
||||||
in any case, if channel is under attack, bot will not send message; if filled, the operator nick will be given for accountability"""))
|
when they have been banned (by/via the bot); in any case, if channel is under attack, bot will not send message;
|
||||||
|
if filled, the operator nick will be given for accountability if differing"""))
|
||||||
|
|
||||||
conf.registerChannelValue(ChanTracker, 'banNotice',
|
conf.registerChannelValue(ChanTracker, 'banNotice',
|
||||||
registry.Boolean(False, """if False, private message is used, if banMessage is not empty"""))
|
registry.Boolean(True, """if False, private message is used, if banMessage is not empty"""))
|
||||||
|
|
||||||
|
conf.registerChannelValue(ChanTracker, 'quietMessage',
|
||||||
|
registry.String("You have been quieted on $channel", """set empty if you don't want the bot to tell something to the user
|
||||||
|
when they have been quieted (by/via the bot); in any case, if channel is under attack, bot will not send message;
|
||||||
|
if filled, the operator nick will be given for accountability if differing"""))
|
||||||
|
|
||||||
|
conf.registerChannelValue(ChanTracker, 'quietNotice',
|
||||||
|
registry.Boolean(True, """if False, private message is used, if quietMessage is not empty"""))
|
||||||
|
|
||||||
|
conf.registerChannelValue(ChanTracker, 'proxyMsgOnly',
|
||||||
|
registry.Boolean(True, """only send message to user on operator action if it was proxied through the bot"""))
|
||||||
|
|
||||||
conf.registerChannelValue(ChanTracker, 'trackAffected',
|
conf.registerChannelValue(ChanTracker, 'trackAffected',
|
||||||
registry.Boolean(True, """bot tracks affected users by mode change; if you encounter too much lag or cpu usage, you could disable this feature,
|
registry.Boolean(True, """bot tracks affected users by mode change; if you encounter too much lag or cpu usage, you could disable this feature,
|
||||||
|
38
plugin.py
38
plugin.py
@ -4340,7 +4340,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
chan.action.enqueue(ircmsgs.kick(channel, nick, km))
|
chan.action.enqueue(ircmsgs.kick(channel, nick, km))
|
||||||
self.forceTickle = True
|
self.forceTickle = True
|
||||||
kicked = True
|
kicked = True
|
||||||
elif m == 'b' and not kicked:
|
elif m == 'b' and not (kicked or chan.attacked):
|
||||||
if msg.nick in (irc.nick, 'ChanServ'):
|
if msg.nick in (irc.nick, 'ChanServ'):
|
||||||
bm = self.registryValue('banMessage', channel=channel)
|
bm = self.registryValue('banMessage', channel=channel)
|
||||||
if len(bm):
|
if len(bm):
|
||||||
@ -4350,22 +4350,17 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
||||||
if nn != irc.nick:
|
if nn != irc.nick:
|
||||||
bm += ' (by %s)' % nn
|
bm += ' (by %s)' % nn
|
||||||
|
elif self.registryValue('proxyMsgOnly', channel=channel):
|
||||||
|
qm = ''
|
||||||
|
if len(bm):
|
||||||
|
bm.replace('$channel', channel)
|
||||||
log.info('[%s] warned %s with: %s' % (channel, nick, bm))
|
log.info('[%s] warned %s with: %s' % (channel, nick, bm))
|
||||||
if self.registryValue('banNotice', channel=channel):
|
if self.registryValue('banNotice', channel=channel):
|
||||||
irc.queueMsg(ircmsgs.notice(nick, bm))
|
i.lowQueue.enqueue(ircmsgs.notice(nick, bm))
|
||||||
else:
|
else:
|
||||||
irc.queueMsg(ircmsgs.privmsg(nick, bm))
|
i.lowQueue.enqueue(ircmsgs.privmsg(nick, bm))
|
||||||
if not kicked and m in self.registryValue('modesToAsk', channel=channel) \
|
elif m == 'q' and not (kicked or chan.attacked or value == '$~a'):
|
||||||
and self.registryValue('doActionAgainstAffected', channel=channel):
|
|
||||||
if msg.nick in (irc.nick, 'ChanServ'):
|
if msg.nick in (irc.nick, 'ChanServ'):
|
||||||
if nick != irc.nick:
|
|
||||||
if nick in irc.state.channels[channel].ops:
|
|
||||||
chan.queue.enqueue(('-o', nick))
|
|
||||||
if nick in irc.state.channels[channel].halfops:
|
|
||||||
chan.queue.enqueue(('-h', nick))
|
|
||||||
if nick in irc.state.channels[channel].voices:
|
|
||||||
chan.queue.enqueue(('-v', nick))
|
|
||||||
if m == 'q' and not (chan.attacked or value == '$~a'):
|
|
||||||
qm = self.registryValue('quietMessage', channel=channel)
|
qm = self.registryValue('quietMessage', channel=channel)
|
||||||
if len(qm):
|
if len(qm):
|
||||||
hk = '%s%s' % (m, value)
|
hk = '%s%s' % (m, value)
|
||||||
@ -4374,11 +4369,24 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
|
|||||||
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
(nn, ii, hh) = ircutils.splitHostmask(chan.update[hk][3])
|
||||||
if nn != irc.nick:
|
if nn != irc.nick:
|
||||||
qm += ' (by %s)' % nn
|
qm += ' (by %s)' % nn
|
||||||
|
elif self.registryValue('proxyMsgOnly', channel=channel):
|
||||||
|
qm = ''
|
||||||
|
if len(qm):
|
||||||
|
qm.replace('$channel', channel)
|
||||||
log.info('[%s] warned %s with: %s' % (channel, nick, qm))
|
log.info('[%s] warned %s with: %s' % (channel, nick, qm))
|
||||||
if self.registryValue('quietNotice', channel=channel):
|
if self.registryValue('quietNotice', channel=channel):
|
||||||
irc.queueMsg(ircmsgs.notice(nick, qm))
|
i.lowQueue.enqueue(ircmsgs.notice(nick, qm))
|
||||||
else:
|
else:
|
||||||
irc.queueMsg(ircmsgs.privmsg(nick, qm))
|
i.lowQueue.enqueue(ircmsgs.privmsg(nick, qm))
|
||||||
|
if not kicked and m in self.registryValue('modesToAsk', channel=channel) \
|
||||||
|
and self.registryValue('doActionAgainstAffected', channel=channel) \
|
||||||
|
and msg.nick in (irc.nick, 'ChanServ') and nick != irc.nick:
|
||||||
|
if nick in irc.state.channels[channel].ops:
|
||||||
|
chan.queue.enqueue(('-o', nick))
|
||||||
|
if nick in irc.state.channels[channel].halfops:
|
||||||
|
chan.queue.enqueue(('-h', nick))
|
||||||
|
if nick in irc.state.channels[channel].voices:
|
||||||
|
chan.queue.enqueue(('-v', nick))
|
||||||
if m in self.registryValue('kickMode', channel=channel) \
|
if m in self.registryValue('kickMode', channel=channel) \
|
||||||
and not value.startswith('m:') and self.registryValue(
|
and not value.startswith('m:') and self.registryValue(
|
||||||
'kickOnMode', channel=channel):
|
'kickOnMode', channel=channel):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user