-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix: Add thumbnail support for edit_message_media #2471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi, thanks for the PR, I will review it |
We'll check later after uprade to API 9.0 |
@skyblade-x Any plans to fix or close the PR? |
Hi @Badiboy, Apologies for the delay in responding — I didn’t mean to leave the PR hanging. Thank you for your patience and your feedback. I’ve now made the requested changes, including aligning the thumbnail check logic with media and handling the optional _thumbnail_name as suggested. I really appreciate the clarity of your review — it helped me understand the style and expectations of the project better. I'm glad to contribute and happy to make any further improvements if needed. Thanks again for the opportunity to work on this! |
@Badiboy, I have fixed your first review, and in my opinion, everything will work as expected. |
@Badiboy if thumbnail is defined as string - for example http link to thumbnail it will be processed by this code: |
ok ) |
Description:
By Telegram specification, thumbnails can be used in the following methods:
InputMediaAnimation
InputMediaDocument
InputMediaAudio
InputMediaVideo
When using send_media_group, everything works correctly. For example:
Result:

Audio is successfully sent with a thumbnail.
However, currently edit_message_media does not support sending thumbnails.
Example with
edit_message_media
:This throws an exception:

The issue is caused because we try to JSON serialize a raw file, but according to Telegram's specification, the thumbnail should be sent using
attach://<file_attach_name>
, not serialized directly.Relevant part of the spec:
Why this fix is needed:
Without this fix, it is impossible to send or edit media messages with a thumbnail via
edit_message_media
, even though Telegram's API supports it.Polite closing:
Please review this PR. Feedback is welcome!