From 4cc610d579626b0e06fe866422411cf218112748 Mon Sep 17 00:00:00 2001 From: AlberLC Date: Thu, 3 Nov 2022 21:09:49 +0100 Subject: [PATCH] Update flood checking --- flanabot/bots/flana_bot.py | 2 +- flanabot/constants.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flanabot/bots/flana_bot.py b/flanabot/bots/flana_bot.py index 6f84c1c..b221401 100644 --- a/flanabot/bots/flana_bot.py +++ b/flanabot/bots/flana_bot.py @@ -147,7 +147,7 @@ class FlanaBot(MultiBot, ABC): 'date': {'$gte': datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(seconds=7)} }) - if len(last_2s_messages) >= constants.FLOOD_2s_LIMIT or len(last_7s_messages) >= constants.FLOOD_7s_LIMIT: + if len(last_2s_messages) > constants.FLOOD_2s_LIMIT or len(last_7s_messages) > constants.FLOOD_7s_LIMIT: punishment = Punishment.find_one({ 'platform': self.platform.value, 'user_id': message.author.id, diff --git a/flanabot/constants.py b/flanabot/constants.py index 4ff9bdb..2a2248b 100644 --- a/flanabot/constants.py +++ b/flanabot/constants.py @@ -4,8 +4,8 @@ AUDIT_LOG_AGE = datetime.timedelta(hours=1) AUDIT_LOG_LIMIT = 5 AUTO_WEATHER_EVERY = datetime.timedelta(hours=6) CHECK_PUNISHMENTS_EVERY_SECONDS = datetime.timedelta(hours=1).total_seconds() -FLOOD_2s_LIMIT = 4 -FLOOD_7s_LIMIT = 7 +FLOOD_2s_LIMIT = 2 +FLOOD_7s_LIMIT = 4 HEAT_PERIOD_SECONDS = datetime.timedelta(minutes=15).total_seconds() INSULT_PROBABILITY = 0.00166666667 MAX_PLACE_QUERY_LENGTH = 50