From 41a9bd5eaac8b2d2996c719b85dfe8956bceecbf Mon Sep 17 00:00:00 2001 From: Nicolas Coevoet Date: Fri, 3 Feb 2023 10:27:09 +0100 Subject: [PATCH] feat: #36 adds optional ignoreOnAbuse configuration property at channel level --- config.py | 2 ++ plugin.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/config.py b/config.py index 633cf3d..27adef2 100644 --- a/config.py +++ b/config.py @@ -98,6 +98,8 @@ conf.registerChannelValue(ChanTracker, 'modesToAsk', conf.registerChannelValue(ChanTracker, 'modesToAskWhenOpped', 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 diff --git a/plugin.py b/plugin.py index 83d5642..504974c 100644 --- a/plugin.py +++ b/plugin.py @@ -4599,6 +4599,10 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler): # protection features 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)) + 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': action = self.registryValue('modeD') if len(action):