From 01ad1aad8fce614ee64cde67dd0c540aa7370de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sat, 3 Feb 2018 15:44:01 +0100 Subject: [PATCH] capture also voice messages --- robot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/robot.py b/robot.py index 08120b4..27ddbaf 100755 --- a/robot.py +++ b/robot.py @@ -132,6 +132,8 @@ def handle_rest(bot, update): file = update.message.audio.file_id elif update.message.video is not None: file = update.message.video.file_id + elif update.message.voice is not None: + file = update.message.voice.file_id if file is not None: try: url = bot.getFile(file).file_path @@ -166,7 +168,7 @@ def main(): dp.add_error_handler(error) dp.add_handler(MessageHandler(Filters.entity(MessageEntity.URL), handle_url)) - dp.add_handler(MessageHandler(Filters.photo | Filters.video | Filters.audio | Filters.document, handle_rest)) + dp.add_handler(MessageHandler(Filters.photo | Filters.video | Filters.audio | Filters.voice | Filters.document, handle_rest)) updater.start_polling()