Skip to content

Bugfixes#2596

Merged
Badiboy merged 2 commits into
eternnoir:masterfrom
Badiboy:master
Jun 3, 2026
Merged

Bugfixes#2596
Badiboy merged 2 commits into
eternnoir:masterfrom
Badiboy:master

Conversation

@Badiboy
Copy link
Copy Markdown
Collaborator

@Badiboy Badiboy commented Jun 3, 2026

Description

#2594 Live Photos show as content type "photo"
#2595 message_thread_id missing from send_live_photo

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 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 set content_type = 'live_photo' when the live_photo field is present.
  • Add message_thread_id plumbing to send_live_photo across 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 thread telebot/apihelper.py
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 thread telebot/__init__.py
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 thread telebot/async_telebot.py
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 thread telebot/types.py
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 thread telebot/apihelper.py
Comment on lines +645 to +646
if message_thread_id is not None:
payload['message_thread_id'] = message_thread_id
@Badiboy Badiboy merged commit 197ea01 into eternnoir:master Jun 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants