chat: impose truescore chat limit

master
justcool393 2022-11-13 05:31:48 -06:00
parent bf98444ead
commit 681d8b482a
2 changed files with 7 additions and 1 deletions

View File

@ -462,6 +462,8 @@ TIERS_ID_TO_NAME = {
6: "Rich Bich" 6: "Rich Bich"
} }
TRUESCORE_CHAT_LIMIT = 10
if SITE == 'rdrama.net': if SITE == 'rdrama.net':
FEATURES['PRONOUNS'] = True FEATURES['PRONOUNS'] = True
FEATURES['HOUSES'] = True FEATURES['HOUSES'] = True
@ -521,6 +523,8 @@ elif SITE == 'pcmemes.net':
HOLE_COST = 2000 HOLE_COST = 2000
TRUESCORE_CHAT_LIMIT = 0
AUTOJANNY_ID = 1046 AUTOJANNY_ID = 1046
SNAPPY_ID = 261 SNAPPY_ID = 261
LONGPOSTBOT_ID = 1832 LONGPOSTBOT_ID = 1832

View File

@ -39,15 +39,17 @@ user_ids_to_socket_ids = {}
@app.get("/chat") @app.get("/chat")
@is_not_permabanned @is_not_permabanned
def chat(v): def chat(v):
if TRUESCORE_CHAT_LIMIT and v.truescore < TRUESCORE_CHAT_LIMIT: abort(403)
return render_template("chat.html", v=v, messages=messages) return render_template("chat.html", v=v, messages=messages)
@socketio.on('speak') @socketio.on('speak')
@limiter.limit("3/second;10/minute") @limiter.limit("3/second;10/minute")
@limiter.limit("3/second;10/minute", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
@is_not_permabanned @is_not_permabanned
@ratelimit_user("3/second;10/minute")
def speak(data, v): def speak(data, v):
if v.is_banned: return '', 403 if v.is_banned: return '', 403
if TRUESCORE_CHAT_LIMIT and v.truescore < TRUESCORE_CHAT_LIMIT: return '', 403
vname = v.username.lower() vname = v.username.lower()
if vname in muted: if vname in muted: