From 430cbe676c862ff9f126cd980c42b98123360143 Mon Sep 17 00:00:00 2001 From: Outrun Colors Date: Tue, 27 Sep 2022 00:31:23 -0500 Subject: [PATCH] Nest if condition in chat --- files/routes/chat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/files/routes/chat.py b/files/routes/chat.py index a70326ed2..5dd975203 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -85,9 +85,10 @@ def speak(data, v): v.shadowbanned = 'AutoJanny' g.db.add(v) send_repeatable_notification(CARP_ID, f"{v.username} has been shadowbanned because of a chat message.") - elif recipient and user_ids_to_socket_ids.get(recipient): - recipient_sid = user_ids_to_socket_ids[recipient] - emit('speak', data, broadcast=False, to=recipient_sid) + elif recipient: + if user_ids_to_socket_ids.get(recipient): + recipient_sid = user_ids_to_socket_ids[recipient] + emit('speak', data, broadcast=False, to=recipient_sid) else: emit('speak', data, broadcast=True) messages.append(data)