API 10.0: Live Photos#5235
Conversation
Also update docstrings of send_media_group and edit_message_media
There was a problem hiding this comment.
Pull request overview
This PR adds support for Telegram Bot API 10.0 “Live Photos” across the library, including new data models, bot methods, filters, and comprehensive test & documentation updates.
Changes:
- Introduces
telegram.LivePhotoplus send/edit/media-group support viasend_live_photoandInputMediaLivePhoto. - Adds paid-media support for live photos via
PaidMediaLivePhotoandInputPaidMediaLivePhoto. - Updates message parsing, filters, docs, and test suite to cover the new Live Photo feature end-to-end.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_reply.py | Extends ExternalReplyInfo tests to include live_photo. |
| tests/test_paidmedia.py | Adds PaidMediaLivePhoto coverage and integrates live photo into PaidMedia subclass tests. |
| tests/test_message.py | Adds live_photo to message parameterization coverage. |
| tests/ext/test_filters.py | Adds test coverage for the new filters.LIVE_PHOTO. |
| tests/_files/test_livephoto.py | New integration/unit tests for LivePhoto and send_live_photo. |
| tests/_files/test_inputmedia.py | Adds InputMediaLivePhoto/InputPaidMediaLivePhoto tests and extends edit-media tests to include live photos. |
| tests/_files/conftest.py | Adds real_live_photo fixture for live photo integration tests. |
| src/telegram/ext/filters.py | Introduces filters.LIVE_PHOTO. |
| src/telegram/ext/_extbot.py | Adds ExtBot wrapper for send_live_photo and extends media group typing. |
| src/telegram/constants.py | Adds new enum values for live photo across relevant enums. |
| src/telegram/_user.py | Extends user-scoped send_media_group typing to include InputMediaLivePhoto. |
| src/telegram/_reply.py | Adds ExternalReplyInfo.live_photo parsing and typing. |
| src/telegram/_paidmedia.py | Adds PaidMediaLivePhoto and mapping for PaidMediaType.LIVE_PHOTO. |
| src/telegram/_message.py | Adds Message.live_photo parsing, slots, and typing updates for media group operations. |
| src/telegram/_files/livephoto.py | New LivePhoto TelegramObject implementation. |
| src/telegram/_files/inputmedia.py | Adds InputMediaLivePhoto and InputPaidMediaLivePhoto. |
| src/telegram/_chat.py | Extends chat-scoped send_media_group typing to include InputMediaLivePhoto. |
| src/telegram/_bot.py | Adds send_live_photo method and extends media group typing/docs to include live photos. |
| src/telegram/init.py | Exposes new Live Photo related classes at top-level telegram.*. |
| docs/source/telegram.paidmedialivephoto.rst | Adds API docs page for PaidMediaLivePhoto. |
| docs/source/telegram.livephoto.rst | Adds API docs page for LivePhoto. |
| docs/source/telegram.inputpaidmedialivephoto.rst | Adds API docs page for InputPaidMediaLivePhoto. |
| docs/source/telegram.inputmedialivephoto.rst | Adds API docs page for InputMediaLivePhoto. |
| docs/source/telegram.at-tree.rst | Adds new classes to the documentation tree. |
| docs/source/inclusions/bot_methods.rst | Adds Bot.send_live_photo to the documented bot methods list. |
aelkheir
left a comment
There was a problem hiding this comment.
Great work! Just a few things here and there
| width (:obj:`int`): Video width as defined by the sender. | ||
| height (:obj:`int`): Video height as defined by the sender. | ||
| duration (:obj:`int` | :class:`datetime.timedelta`): Duration of the video | ||
| in seconds as defined by the sender. |
There was a problem hiding this comment.
| in seconds as defined by the sender. | |
| in seconds as defined by the sender. | |
| |time-period-input| |
There was a problem hiding this comment.
I don't see the need for that anymore, it's already in the type docstring.
| duration (:class:`datetime.timedelta`): Duration of the video | ||
| in seconds as defined by the sender. |
There was a problem hiding this comment.
| duration (:class:`datetime.timedelta`): Duration of the video | |
| in seconds as defined by the sender. | |
| duration (:obj:`int` | :class:`datetime.timedelta`): Duration of the video | |
| in seconds as defined by the sender. | |
| |time-period-int-deprecated| |
i think we should start this attr in the deprecated state to have a normalized behavior over these duration attributes across classes
There was a problem hiding this comment.
imo it doesn't make sense, we've already told that this will be the default. New attributes should be using timedelta by default.
| The paid media is a live photo. | ||
|
|
||
| Objects of this class are comparable in terms of equality. Two objects of this class are | ||
| considered equal, if their :attr:`live_photo` are equal. |
There was a problem hiding this comment.
| considered equal, if their :attr:`live_photo` are equal. | |
| considered equal, if their :attr:`live_photo` is equal. |
There was a problem hiding this comment.
It should be "are" since the subject is plural (two objects)
| self, | ||
| ) | ||
|
|
||
| async def send_live_photo( |
There was a problem hiding this comment.
Can we also do Message.reply_live_photo, [Chat,User],send_live_photo to be consistent with other send_media methods
Sorry it seems i bring up this topic too much lately 🫣
There was a problem hiding this comment.
No I did just geniunely forget about those shortcuts, good catch.
No description provided.