Skip to content

API 10.0: Live Photos#5235

Open
harshil21 wants to merge 11 commits into
api-10.0-centralfrom
api-10.0-live-photos
Open

API 10.0: Live Photos#5235
harshil21 wants to merge 11 commits into
api-10.0-centralfrom
api-10.0-live-photos

Conversation

@harshil21
Copy link
Copy Markdown
Member

No description provided.

@harshil21 harshil21 requested review from aelkheir and Copilot May 19, 2026 09:57
@harshil21 harshil21 added the ⚙️ bot-api affected functionality: bot-api label May 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.LivePhoto plus send/edit/media-group support via send_live_photo and InputMediaLivePhoto.
  • Adds paid-media support for live photos via PaidMediaLivePhoto and InputPaidMediaLivePhoto.
  • 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.

Comment thread src/telegram/constants.py Outdated
Comment thread src/telegram/constants.py Outdated
Comment thread src/telegram/_files/inputmedia.py Outdated
Comment thread src/telegram/_files/inputmedia.py
Comment thread src/telegram/_bot.py Outdated
Comment thread src/telegram/_message.py
Comment thread tests/_files/test_livephoto.py Outdated
Comment thread tests/_files/test_inputmedia.py Outdated
Comment thread src/telegram/_bot.py Outdated
Copy link
Copy Markdown
Member

@aelkheir aelkheir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
in seconds as defined by the sender.
in seconds as defined by the sender.
|time-period-input|

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the need for that anymore, it's already in the type docstring.

Comment on lines +67 to +68
duration (:class:`datetime.timedelta`): Duration of the video
in seconds as defined by the sender.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo it doesn't make sense, we've already told that this will be the default. New attributes should be using timedelta by default.

Comment thread tests/_files/test_inputmedia.py
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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
considered equal, if their :attr:`live_photo` are equal.
considered equal, if their :attr:`live_photo` is equal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be "are" since the subject is plural (two objects)

Comment thread src/telegram/_bot.py
Comment thread src/telegram/_bot.py
self,
)

async def send_live_photo(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🫣

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I did just geniunely forget about those shortcuts, good catch.

@aelkheir aelkheir mentioned this pull request May 22, 2026
32 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚙️ bot-api affected functionality: bot-api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants