From ec22c72afbdf3b3a7254b1c52f81d08776033cba Mon Sep 17 00:00:00 2001 From: dymik739 Date: Sun, 29 Oct 2023 20:56:55 +0200 Subject: [PATCH] core: harden the handling of received messages --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 6748635..2e7a080 100644 --- a/main.py +++ b/main.py @@ -319,12 +319,14 @@ def queue_processor(): def message_handler(update, context): global 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 message_queue.insert(0, update.message) - else: + elif update.message: print("[DEBUG] Received new message") # just for testing message_queue.append(update.message) + else: + print(f"[DEBUG] Received {update.message} instead of a message") # --- Final stage ---