make antispam a bit less :marseyshook:

pull/9/head
justcool393 2022-11-23 14:45:09 -06:00
parent 654da03435
commit 042edf15bd
1 changed files with 4 additions and 3 deletions

View File

@ -394,14 +394,15 @@ def execute_antispam_duplicate_comment_check(v:User, body_html:str):
''' '''
Sanity check for newfriends Sanity check for newfriends
''' '''
ANTISPAM_DUPLICATE_THRESHOLD = 3
if v.id in ANTISPAM_BYPASS_IDS or v.admin_level: return if v.id in ANTISPAM_BYPASS_IDS or v.admin_level: return
if v.age >= NOTIFICATION_SPAM_AGE_THRESHOLD: return if v.age >= NOTIFICATION_SPAM_AGE_THRESHOLD: return
if len(body_html) < 16: return if len(body_html) < 16: return
if body_html == '!wordle': return # wordle if body_html == '!wordle': return # wordle
compare_time = int(time.time()) - 60 * 60 * 24 compare_time = int(time.time()) - 60 * 60 * 24
comment = g.db.query(Comment.id).filter(Comment.body_html == body_html, count = g.db.query(Comment.id).filter(Comment.body_html == body_html,
Comment.created_utc >= compare_time).first() Comment.created_utc >= compare_time).count()
if not comment: return if count <= ANTISPAM_DUPLICATE_THRESHOLD: return
v.ban(reason="Spamming.", days=0.0) 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!") send_repeatable_notification(v.id, "Your account has been banned **permanently** for the following reason:\n\n> Too much spam!")
g.db.add(v) g.db.add(v)