Bugfixes#2596
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses two Telegram Bot API integration gaps: correctly recognizing incoming Live Photos as live_photo messages (instead of photo) and adding message_thread_id support when sending Live Photos (notably in AsyncTeleBot).
Changes:
- Update
types.Message.de_json()to setcontent_type = 'live_photo'when thelive_photofield is present. - Add
message_thread_idplumbing tosend_live_photoacross sync/async bot APIs and into the request payload builder. - Minor whitespace cleanup.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
telebot/types.py |
Ensures incoming messages containing live_photo are classified with content_type='live_photo'. |
telebot/async_telebot.py |
Adds message_thread_id parameter to AsyncTeleBot.send_live_photo() and forwards it to the async helper. |
telebot/apihelper.py |
Adds message_thread_id to send_live_photo payload construction for the raw API helper. |
telebot/__init__.py |
Adds message_thread_id parameter to TeleBot.send_live_photo() and forwards it to apihelper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
626
to
631
| def send_live_photo( | ||
| token, chat_id, live_photo, photo, | ||
| caption=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, has_spoiler=None, | ||
| disable_notification=None, protect_content=None, reply_parameters=None, reply_markup=None, | ||
| business_connection_id=None, message_effect_id=None, allow_paid_broadcast=None, | ||
| message_thread_id=None, business_connection_id=None, caption=None, parse_mode=None, caption_entities=None, | ||
| show_caption_above_media=None, has_spoiler=None, disable_notification=None, protect_content=None, | ||
| reply_parameters=None, reply_markup=None, message_effect_id=None, allow_paid_broadcast=None, | ||
| direct_messages_topic_id=None, suggested_post_parameters=None): |
Comment on lines
2651
to
2654
| def send_live_photo( | ||
| self, chat_id: Union[int, str], live_photo: Union[Any, str], photo: Union[Any, str], | ||
| business_connection_id: Optional[str]=None, | ||
| message_thread_id: Optional[int]=None, business_connection_id: Optional[str]=None, | ||
| caption: Optional[str]=None, parse_mode: Optional[str]=None, |
Comment on lines
4289
to
4292
| async def send_live_photo( | ||
| self, chat_id: Union[int, str], live_photo: Union[Any, str], photo: Union[Any, str], | ||
| business_connection_id: Optional[str]=None, | ||
| message_thread_id: Optional[int] = None, business_connection_id: Optional[str]=None, | ||
| caption: Optional[str]=None, parse_mode: Optional[str]=None, |
Comment on lines
+1665
to
+1667
| if 'live_photo' in obj: | ||
| opts['live_photo'] = LivePhoto.de_json(obj['live_photo']) | ||
| content_type = 'live_photo' |
Comment on lines
+645
to
+646
| if message_thread_id is not None: | ||
| payload['message_thread_id'] = message_thread_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#2594 Live Photos show as content type "photo"
#2595 message_thread_id missing from send_live_photo