Checklist for reviewers
This is intentionally opened as a draft in light of the maintainer note in #5261 that Bot API 10.1 development is paused pending the API-generation refactor. It is not intended to bypass that decision. The draft provides a concrete, tested send-side implementation that can be reviewed, reshaped, or deferred until the refactor is ready.
Summary
Adds the send-side foundation for Rich Messages introduced in Telegram Bot API 10.1 and extended in Bot API 10.2 and 10.3.
- Adds
InputRichMessage
- Adds
Bot.send_rich_message and Bot.send_rich_message_draft
- Adds matching
ExtBot wrappers with rate-limiter arguments
- Adds snake_case and camelCase APIs
- Adds validation and serialization tests
- Adds an unreleased changelog fragment
InputRichMessage
The input model supports all three representations accepted by Telegram: html, markdown, and blocks. Exactly one representation must be supplied. Empty block sequences are rejected. Optional media, is_rtl, and skip_entity_detection fields are included. Sequence arguments are normalized with PTB's existing parse_sequence_arg utility and equality is based on the selected content representation.
Block and media entries accept Bot API dictionaries in this draft. This keeps the send methods usable with the Bot API 10.2/10.3 block variants while avoiding premature coupling to a large output/input class hierarchy before the generator refactor is complete. Dedicated classes can replace or supplement these types later without changing the request methods.
Bot methods
Bot.send_rich_message follows _send_message conventions and supports notification settings, content protection, reply markup and parameters, message threads, business connections, message effects, paid broadcasts, direct-message topics, suggested posts, timeout settings, and api_kwargs. Successful responses are deserialized as Message.
Bot.send_rich_message_draft supports non-zero draft identifiers, message threads, and the Bot API 10.3 can_stop and keep_on_stop controls. A zero draft identifier is rejected locally.
Both methods have corresponding ExtBot wrappers that merge rate-limiter arguments in the same manner as existing methods. camelCase aliases are provided for compatibility with the Bot API method names.
Tests performed
The following checks pass locally:
ruff check (changed library and test files): passed
ruff format --check: passed
tests/test_inputrichmessage.py: 7 passed
TestBotWithoutRequest.test_ext_bot_signature: 390 passed
Bot coroutine/API kwargs/camelCase focused suite: 1,465 checks executed; signature issues found during development were corrected
Python compilation and git diff --check: passed
The focused signature test confirms that Bot and ExtBot expose matching parameters and annotations apart from the expected rate_limit_args extension.
Scope not included
This draft does not yet add received RichMessage, Message.rich_message, InputRichMessageContent, typed RichText/RichBlock variants, shortcuts, or rich-message editing. Those form a substantially larger type hierarchy and should follow the architecture selected after the generator refactor.
Closes no issue while draft. Related to #5261.