Using telegram bot api in python, I am sending photo using a file.
- First I get the photo from a url.
- Save the photo to disk. (Full Resolution)
- Read the file and pass it to
bot.send_photo
- Get the
file_id
contained in returnedMessage
object and save it. - Next time I send via
file_id
upon new /command.
First request:
file = open(get_filename(), 'rb') msg = context.bot.send_photo(chat_id, file, caption=None) fileid = msg.photo[len(msg.photo)-1].file_id
Second and onwards ...
context.bot.send_photo(chat_id, photo=get_fileid(), caption=None) context.bot.send_message(chat_id, text=EXPLANATION)
Here file ID represent the highest resolution file id available in PhotoSize array.
Here is the file id: AgACAgQAAxkDAAIBMmAK636SiNEGCA8UILZ55gVppXfqAAIytjEbqp1RUJwNFOjmz7N6ZoHuJ10AAwEAAwIAA3cAAwRjBAABHgQ
Problem: I am receiving 1k resolution photo in bot chat. Please advise what I am missing here.