Steps to reproduce
-
Handle Photo sending by user to your bot and save all of PhotoSize data anywhere
-
Then send any of these photo-sizes by its file_id like update.effective_message.reply_photo(update.effective_user.id, saved_photo_size_file_id) from your bot to user
Expected behaviour
Photo should be sent from bot to user
Actual behaviour
Error from Telegram API: "Wrong persistent file_id specified: wrong string length"
Configuration
Operating System:
macOS Sierra
Version of Python, python-telegram-bot & dependencies:
python-telegram-bot 8.0
certifi 2017.07.27.1
future 0.16.0
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
I found that Telegram bot API don't allow to resend thumbnails (PhotoSize): https://core.telegram.org/bots/api#sending-files
Sending by file_id
It is not possible to change the file type when resending by file_id. I.e. a video can't be sent as a photo, a photo can't be sent as a document, etc.
It is not possible to resend thumbnails
Resending a photo by file_id will send all of its sizes.
file_id is unique for each individual bot and can't be transferred from one bot to another.
But effective_attachment of message sending by user has only list of PhotoSize and don't storing file_id of original Photo.
So how to extract file_id of original Photo for resend this in future?
Steps to reproduce
Handle Photo sending by user to your bot and save all of
PhotoSizedata anywhereThen send any of these photo-sizes by its
file_idlikeupdate.effective_message.reply_photo(update.effective_user.id, saved_photo_size_file_id)from your bot to userExpected behaviour
Photo should be sent from bot to user
Actual behaviour
Error from Telegram API: "Wrong persistent file_id specified: wrong string length"
Configuration
Operating System:
macOS Sierra
Version of Python, python-telegram-bot & dependencies:
I found that Telegram bot API don't allow to resend thumbnails (PhotoSize): https://core.telegram.org/bots/api#sending-files
But
effective_attachmentof message sending by user has only list ofPhotoSizeand don't storingfile_idof original Photo.So how to extract
file_idof original Photo for resend this in future?