From 0126bb9729e2ed3373a557df66c385a3ffe99b98 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 23 Jan 2023 04:45:34 +0200 Subject: [PATCH] cut down on chat spam --- files/routes/chat.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/files/routes/chat.py b/files/routes/chat.py index 79457ddd3..93df91716 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -78,6 +78,14 @@ def speak(data, v): text_html = sanitize(text, count_marseys=True) quotes = data['quotes'] id = str(uuid.uuid4()) + + duplicate = False + if len(text) > 20: + for m in messages[request.referrer].values(): + if text == m['text']: + duplicate = True + break + data = { "id": id, "quotes": quotes if messages[request.referrer].get(quotes) else '', @@ -91,7 +99,7 @@ def speak(data, v): "time": int(time.time()), } - if v.shadowbanned or not execute_blackjack(v, None, text, "chat"): + if duplicate or v.shadowbanned or not execute_blackjack(v, None, text, "chat"): emit('speak', data) else: emit('speak', data, room=request.referrer, broadcast=True)