feat: #36 adds optional ignoreOnAbuse configuration property at channel level

This commit is contained in:
Nicolas Coevoet 2023-02-03 10:27:09 +01:00
parent f0dce70427
commit 41a9bd5eaa
2 changed files with 6 additions and 0 deletions

View File

@ -98,6 +98,8 @@ conf.registerChannelValue(ChanTracker, 'modesToAsk',
conf.registerChannelValue(ChanTracker, 'modesToAskWhenOpped', conf.registerChannelValue(ChanTracker, 'modesToAskWhenOpped',
registry.CommaSeparatedListOfStrings(['e', 'I'], """list of channel modes to sync into the bot's tracking database when it is opped""")) registry.CommaSeparatedListOfStrings(['e', 'I'], """list of channel modes to sync into the bot's tracking database when it is opped"""))
conf.registerChannelValue(ChanTracker, 'ignoreOnAbuse',
registry.Boolean(False, """adds abusers on ignore for the punishment period"""))
## related to ban tracking ## related to ban tracking

View File

@ -4599,6 +4599,10 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
# protection features # protection features
def _act(self, irc, channel, mode, mask, duration, reason, nick): def _act(self, irc, channel, mode, mask, duration, reason, nick):
log.info('ChanTracker: acting in %s against %s / %s : %s %s %s' % (channel, nick, mask, mode, duration, reason)) log.info('ChanTracker: acting in %s against %s / %s : %s %s %s' % (channel, nick, mask, mode, duration, reason))
if self.registryValue('ignoreOnAbuse', channel=channel, network=irc.network):
c = ircdb.channels.getChannel(channel)
c.addIgnore(mask, time.time() + duration)
ircdb.channels.setChannel(channel, c)
if mode == 'D': if mode == 'D':
action = self.registryValue('modeD') action = self.registryValue('modeD')
if len(action): if len(action):