From 042edf15bdf9b50c34b4ccfbf2afb7cf030f04b3 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 23 Nov 2022 14:45:09 -0600 Subject: [PATCH] make antispam a bit less :marseyshook: --- files/helpers/actions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 472e938e2..6bc781c2e 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -394,14 +394,15 @@ def execute_antispam_duplicate_comment_check(v:User, body_html:str): ''' Sanity check for newfriends ''' + ANTISPAM_DUPLICATE_THRESHOLD = 3 if v.id in ANTISPAM_BYPASS_IDS or v.admin_level: return if v.age >= NOTIFICATION_SPAM_AGE_THRESHOLD: return if len(body_html) < 16: return if body_html == '!wordle': return # wordle compare_time = int(time.time()) - 60 * 60 * 24 - comment = g.db.query(Comment.id).filter(Comment.body_html == body_html, - Comment.created_utc >= compare_time).first() - if not comment: return + count = g.db.query(Comment.id).filter(Comment.body_html == body_html, + Comment.created_utc >= compare_time).count() + if count <= ANTISPAM_DUPLICATE_THRESHOLD: return v.ban(reason="Spamming.", days=0.0) send_repeatable_notification(v.id, "Your account has been banned **permanently** for the following reason:\n\n> Too much spam!") g.db.add(v)