I tried the echobot2.py of the python-telegram-bot library but it does not echo the images sent to the bot. How can I handle this issue?
Asked
Active
Viewed 905 times
1 Answers
2
It is not supposed to echo images in that example.
You can see from line 65 it is using Filters.text
which means it only captures text messages. If you want to echo images, you should add another MessageHandler
with Filters.photo
and add a function to do update.message.reply_photo(update.message.photo[-1])
.

jeffffc
- 772
- 4
- 13
-
Thanks for the answer. What is that [-1] over there? – lameei Oct 23 '17 at 10:29
-
1`message.photo` is a list of `PhotoSize` objects ordered by ascending size, which when you send a photo on telegram, they renders the photo into different sizes (for different uses like thumbnails). `[-1]` means taking the last element of the list, which is the largest one – jeffffc Oct 24 '17 at 01:15