core: harden the handling of received messages

This commit is contained in:
dymik739 2023-10-29 20:56:55 +02:00
parent 79a307a7b5
commit ec22c72afb
1 changed files with 4 additions and 2 deletions

View File

@ -319,12 +319,14 @@ def queue_processor():
def message_handler(update, context): def message_handler(update, context):
global lock global lock
with lock: with lock:
if update.message.text.__class__ == str and update.message.text.startswith("$"): if update.message and update.message.text.__class__ == str and update.message.text.startswith("$"):
print("[DEBUG] Received new message with high priority") # just for testing print("[DEBUG] Received new message with high priority") # just for testing
message_queue.insert(0, update.message) message_queue.insert(0, update.message)
else: elif update.message:
print("[DEBUG] Received new message") # just for testing print("[DEBUG] Received new message") # just for testing
message_queue.append(update.message) message_queue.append(update.message)
else:
print(f"[DEBUG] Received {update.message} instead of a message")
# --- Final stage --- # --- Final stage ---