From a867690e8a6c66c86dcfcca7b353bb8a1ffba292 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 13 Oct 2025 20:31:34 +0300 Subject: Fix error with null "text" in msg --- taulubot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'taulubot.py') diff --git a/taulubot.py b/taulubot.py index cac99c3..4910048 100644 --- a/taulubot.py +++ b/taulubot.py @@ -106,14 +106,15 @@ def handle(msg): chat_id = msg["chat"]["id"] user_id = msg["from"]["id"] user_name = msg["from"]["first_name"] - msg_text = msg["text"] + msg_text = msg.get("text", None) + logging.debug( "New message! chat_id: {}, user_name: {}, msg_text: {}".format( chat_id, user_name, msg_text ) ) - if is_taulu_command(msg_text): + if msg_text is not None and is_taulu_command(msg_text): logging.info("Taulu command found!") attempt, ATTEMPTS = 0, 3 while attempt < ATTEMPTS: -- cgit v1.3