-
Hello, I'd like to pass an image object instead of a URL to InlineQueryResultPhoto. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I found a solution for photo_url by passing an InputMediaPhoto to input_message_content parameter. |
Beta Was this translation helpful? Give feedback.
-
It's the limitation of the Telegram. PS: I also do not thing input_message_content will help you to send Photo... |
Beta Was this translation helpful? Give feedback.
-
Thank you, @Badiboy. I discovered that input_message_content requires a URL yesterday and forgot to update this question.
msg = bot.send_photo(chat_id=CACHE_CHANNEL_ID, photo=image)
photo_file_id = msg.photo[0].file_id
option = InlineQueryResultCachedPhoto(
id='0',
title=title,
description=description,
photo_file_id=photo_file_id,
caption=caption,
parse_mode='MARKDOWN'
)
bot.answer_inline_query(
query.id,
[option],
cache_time=60*15
)
bot.delete_message(
chat_id=CACHE_CHANNEL_ID,
message_id=msg.message_id,
) |
Beta Was this translation helpful? Give feedback.
Thank you, @Badiboy. I discovered that input_message_content requires a URL yesterday and forgot to update this question.
After hours of digging, I finally found a workaround: