From b6b3aa5bfc9f47829ab101b4a9c54b1513be2ac6 Mon Sep 17 00:00:00 2001 From: SchoolGuy Date: Sun, 14 Jul 2019 15:58:22 +0200 Subject: [PATCH 1/2] Check if the text property is inside the message object. --- active_bots/telegrambot.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/active_bots/telegrambot.py b/active_bots/telegrambot.py index 20c663c..6655952 100644 --- a/active_bots/telegrambot.py +++ b/active_bots/telegrambot.py @@ -38,6 +38,12 @@ class TelegramBot(Bot): "Sending Photos is not supported for privacy reasons. Can " "you describe it as text instead?") continue + if "text" in update.message: + tb.send_message( + update.message.sender.id, + "We only support text only reporting for privacy reasons." + "Can you describe it as text instead?") + continue if update.message.text.lower() == "/start": user.add_telegram_subscribers(update.message.sender.id) tb.send_message( From 86af9e9a9fb357aeb4ceccbe8aeae7d3d9416847 Mon Sep 17 00:00:00 2001 From: Enno G Date: Mon, 22 Jul 2019 20:51:49 +0200 Subject: [PATCH 2/2] Change to hasattr --- active_bots/telegrambot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/active_bots/telegrambot.py b/active_bots/telegrambot.py index 6655952..90bf906 100644 --- a/active_bots/telegrambot.py +++ b/active_bots/telegrambot.py @@ -38,7 +38,7 @@ class TelegramBot(Bot): "Sending Photos is not supported for privacy reasons. Can " "you describe it as text instead?") continue - if "text" in update.message: + if hasattr(update.message, 'text'): tb.send_message( update.message.sender.id, "We only support text only reporting for privacy reasons."