From 685bedcd74daa06bf9d785ca575b47257f7d3322 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 16 Sep 2015 21:32:25 +0200 Subject: [PATCH] Add config variable supybot.abuse.flood.command.notify. --- plugins/Owner/plugin.py | 11 ++++++----- src/conf.py | 3 +++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/Owner/plugin.py b/plugins/Owner/plugin.py index 519fb80a7..d79fb5079 100644 --- a/plugins/Owner/plugin.py +++ b/plugins/Owner/plugin.py @@ -252,11 +252,12 @@ class Owner(callbacks.Plugin): self.log.info('Ignoring %s for %s seconds due to an apparent ' 'command flood.', banmask, punishment) ircdb.ignores.add(banmask, time.time() + punishment) - irc.reply('You\'ve given me %s commands within the last ' - '%i seconds; I\'m now ignoring you for %s.' % - (maximum, - conf.supybot.abuse.flood.interval(), - utils.timeElapsed(punishment, seconds=False))) + if conf.supybot.abuse.flood.command.notify(): + irc.reply('You\'ve given me %s commands within the last ' + '%i seconds; I\'m now ignoring you for %s.' % + (maximum, + conf.supybot.abuse.flood.interval(), + utils.timeElapsed(punishment, seconds=False))) return try: tokens = callbacks.tokenize(s, channel=msg.args[0]) diff --git a/src/conf.py b/src/conf.py index 3b08435be..364c52bcd 100644 --- a/src/conf.py +++ b/src/conf.py @@ -732,6 +732,9 @@ registerGlobalValue(supybot.abuse.flood.command, 'maximum', registerGlobalValue(supybot.abuse.flood.command, 'punishment', registry.PositiveInteger(300, _("""Determines how many seconds the bot will ignore users who flood it with commands."""))) +registerGlobalValue(supybot.abuse.flood.command, 'notify', + registry.Boolean(True, _("""Determines whether the bot will notify people + that they're being ignored for command flooding."""))) registerGlobalValue(supybot.abuse.flood.command, 'invalid', registry.Boolean(True, _("""Determines whether the bot will defend itself