Skip to content

Bot API 10.1#2600

Closed
ranjitsingha wants to merge 6 commits into
eternnoir:masterfrom
ranjitsingha:master
Closed

Bot API 10.1#2600
ranjitsingha wants to merge 6 commits into
eternnoir:masterfrom
ranjitsingha:master

Conversation

@ranjitsingha

@ranjitsingha ranjitsingha commented Jun 12, 2026

Copy link
Copy Markdown

Bot API 10.1

Rich Messages

  • Added the classes RichTextBold, RichTextItalic, RichTextUnderline, RichTextStrikethrough, RichTextSpoiler, RichTextDateTime, RichTextTextMention, RichTextSubscript, RichTextSuperscript, RichTextMarked, RichTextCode, RichTextCustomEmoji, RichTextMathematicalExpression, RichTextUrl, RichTextEmailAddress, RichTextPhoneNumber, RichTextBankCardNumber, RichTextMention, RichTextHashtag, RichTextCashtag, RichTextBotCommand, RichTextAnchor, RichTextAnchorLink, RichTextReference and RichTextReferenceLink, which represent different types of rich formatted text.
  • Added the class RichText, which represents rich formatted text.
  • Added the class RichBlockCaption, which represents the caption of a rich formatted text.
  • Added the class RichBlockTableCell, which represents a cell in a table.
  • Added the class RichBlockListItem, which represents an item in a list.
  • Added the classes RichBlockParagraph, RichBlockSectionHeading, RichBlockPreformatted, RichBlockFooter, RichBlockDivider, RichBlockMathematicalExpression, RichBlockAnchor, RichBlockList, RichBlockBlockQuotation, RichBlockPullQuotation, RichBlockCollage, RichBlockSlideshow, RichBlockTable, RichBlockDetails, RichBlockMap, RichBlockAnimation, RichBlockAudio, RichBlockPhoto, RichBlockVideo, RichBlockVoiceNote and RichBlockThinking, which represent different types of blocks in a rich formatted message.
  • Added the class RichBlock, which represents a block in a rich formatted message.
  • Added the class RichMessage, which represents a rich formatted message.
  • Added the field rich_message to the class Message.
  • Added the class InputRichMessage, describing a rich message to send.
  • Added the class InputRichMessageContent and allowed it to be used as InputMessageContent in results of inline, guest, and Web App queries.
  • Added the method sendRichMessage, allowing bots to send rich messages.
  • Added the method sendRichMessageDraft, allowing bots to stream partial rich messages.
  • Added the parameter rich_message to the method editMessageText, allowing bots to edit rich messages.

Join Request Queries

  • Added the field supports_join_request_queries to the class User.
  • Added the field guard_bot to the class ChatFullInfo.
  • Added the field query_id to the class ChatJoinRequest.
  • Added the method answerChatJoinRequestQuery.
  • Added the method sendChatJoinRequestWebApp.

Polls

  • Added the class Link and the field link to the class PollMedia.
  • Added the class InputMediaLink and allowed it to be used as InputPollOptionMedia.

…inks)

New types: RichText (25 inline subtypes), RichBlock (24 block subtypes),
RichMessage, InputRichMessage, InputRichMessageContent, Link, InputMediaLink.

New methods: sendRichMessage, sendRichMessageDraft, answerChatJoinRequestQuery,
sendChatJoinRequestWebApp. All methods added to sync/async TeleBot and helpers.

Field additions: User.supports_join_request_queries, ChatFullInfo.guard_bot,
ChatJoinRequest.query_id, Message.rich_message, PollMedia.link.

Bumps version to 4.35.0.
check_json only shallow-copies, so nested Subclass._from_dict(shared_dict)
calls mutated the caller's dict in place (RichBlockList, RichBlockTable,
and all media/collage/slideshow/map blocks with nested captions/items/cells).
Route nested conversions through RichBlock.de_json, which copies first and
dispatches correctly via the type map.

Also allow InputMediaLink as InputPollOptionMedia per the Bot API 10.1 spec.
@ranjitsingha ranjitsingha changed the title Add Bot API 10.1 support (Rich Messages, Join Request Queries, Poll Links) Bot API 10.1 Jun 12, 2026
InputRichMessage takes html/markdown/is_rtl/skip_entity_detection
strings, not page_blocks. RichMessage uses 'blocks' (not 'page_blocks')
and adds is_rtl.
Receive-side block classes were off-spec:
- Type strings: block_quotation->blockquote, pull_quotation->pullquote,
  preformatted->pre, section_heading->heading (de_json dispatch + TYPE_MAP)
- Field renames: page_blocks->blocks (ListItem, Collage, Slideshow, Details)
- RichBlockListItem: label is a String (not RichText); add has_checkbox,
  is_checked, value
- RichBlockSectionHeading: level->size
- RichBlockBlockQuotation: text->blocks (Array of RichBlock), caption->credit
- RichBlockDetails: header->summary
- RichBlockList: drop is_ordered (not in spec)
Comment thread telebot/types.py Outdated
Addresses review feedback on PR #2600: the 25 RichText* and 24 RichBlock*
subclasses used condensed one-line docstrings, unlike the rest of the
library. Rewrite them in the project's reStructuredText format with a
description, Telegram documentation link, per-parameter :param:/:type:,
and :return:/:rtype:, matching the base classes. Docs-only; no logic
changes.
Comment thread telebot/__init__.py
link_preview_options : Optional[types.LinkPreviewOptions]=None,
business_connection_id: Optional[str]=None,
timeout: Optional[int]=None) -> Union[types.Message, bool]:
timeout: Optional[int]=None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Prefer to have valuable fields before timeout.

Comment thread telebot/__init__.py
self.token, text, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id,
parse_mode=parse_mode, entities=entities, reply_markup=reply_markup, link_preview_options=link_preview_options,
business_connection_id=business_connection_id, timeout=timeout)
business_connection_id=business_connection_id, timeout=timeout, rich_message=rich_message)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Prefer to have valuable fields before timeout.

Comment thread telebot/__init__.py
)


def send_rich_message(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Missed lot of parameters from API.

Comment thread telebot/apihelper.py
return _make_request(token, method_url, params=payload, method='post')


def send_rich_message(token, chat_id, rich_message, message_thread_id=None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Missed lot of parameters.

Comment thread telebot/__init__.py


def answer_chat_join_request_query(
self, query_id: str,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

chat_join_request_query_id, not query_id

Comment thread telebot/__init__.py

def answer_chat_join_request_query(
self, query_id: str,
result: types.InlineQueryResultBase) -> bool:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

result is string

Comment thread telebot/__init__.py
:param query_id: Unique identifier of the join request query
:type query_id: :obj:`str`

:param web_app_url: URL of the Web App to be opened

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The URL...

Comment thread telebot/__init__.py
:param query_id: Unique identifier of the join request query
:type query_id: :obj:`str`

:param result: A JSON-serialized object describing the response to send

@Badiboy Badiboy Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

result is string

Comment thread telebot/apihelper.py

def answer_chat_join_request_query(token, query_id, result):
method_url = 'answerChatJoinRequestQuery'
payload = {'query_id': query_id, 'result': result.to_json()}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

chat_join_request_query_id, not query_id

result is string, no to_json

Comment thread telebot/apihelper.py

def send_chat_join_request_web_app(token, query_id, web_app_url):
method_url = 'sendChatJoinRequestWebApp'
payload = {'query_id': query_id, 'web_app_url': web_app_url}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

chat_join_request_query_id, not query_id

@Badiboy

Badiboy commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

@coder2020official
Stopped now after init/apihelper review.

Poor quality, not sure it's reasonable to porceed with this PR. There are 50 classes added, it's hard to review every field there...

@coder2020official

Copy link
Copy Markdown
Collaborator

Understood, I will work on a PR tomorrow

@ranjitsingha ranjitsingha closed this by deleting the head repository Jun 22, 2026
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.

3 participants