GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add send-side support for Telegram Rich Messages by botstelegram7-cmyk · Pull Request #5356 · python-telegram-bot/python-telegram-bot

Conversation

@botstelegram7-cmyk

@botstelegram7-cmyk botstelegram7-cmyk commented Sep 12, 2026

Copy link
Copy Markdown

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
botstelegram7-cmyk added 3 commits September 12, 2026 09:08
@botstelegram7-cmyk
Add initial Rich Messages send-side support
323ab33
@botstelegram7-cmyk
Expand Rich Messages API documentation
e40fefe
@botstelegram7-cmyk
Complete ExtBot integration and camelCase aliases
d9e16eb
@harshil21 harshil21 closed this Sep 12, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@botstelegram7-cmyk @harshil21
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.