summaryrefslogtreecommitdiffstats
path: root/taulubot.py
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-10-13 20:31:34 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-10-13 20:31:34 +0300
commita867690e8a6c66c86dcfcca7b353bb8a1ffba292 (patch)
tree40bc55ab251e5261d35c4ba235c43fda3d2b6769 /taulubot.py
parentd90a9eac5a690d633932be50ac8e1b2615b88e4e (diff)
Fix error with null "text" in msg
Diffstat (limited to 'taulubot.py')
-rw-r--r--taulubot.py5
1 files changed, 3 insertions, 2 deletions
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: