cut down on chat spam

pull/92/head
Aevann 2023-01-23 04:45:34 +02:00
parent 921b9b1a2e
commit 0126bb9729
1 changed files with 9 additions and 1 deletions

View File

@ -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)