Skip to content

feat: add Bot API 10.1 rich messages support#284

Closed
nathan77886 wants to merge 2 commits into
go-telegram:mainfrom
nathan77886:main
Closed

feat: add Bot API 10.1 rich messages support#284
nathan77886 wants to merge 2 commits into
go-telegram:mainfrom
nathan77886:main

Conversation

@nathan77886

Copy link
Copy Markdown

Summary

This PR adds Telegram Bot API 10.1 Rich Messages support.

The main goal is to support rich message content in inline query results, especially this use case:

  • Return InlineQueryResultArticle in inline query results
  • Show title, description, and thumbnail_url in the inline candidate list
  • Send rich structured content after selection
  • Avoid using the Article url field
  • Avoid showing media URLs directly in the message body

What changed

  • Added Rich Message related models/types for Bot API 10.1
  • Added InputRichMessageContent support for inline query input_message_content
  • Added Message.rich_message support
  • Added API wrappers for Rich Message related methods
  • Added an inline rich message example
  • Added tests for Rich Message serialization/deserialization and inline query usage
  • Updated Bot API support documentation from 10.0 to 10.1

Why

Telegram Bot API 10.1 introduced Rich Messages, which allow bots to send structured rich content. This is especially useful for inline query scenarios where the result list should show an article-style preview, while the selected result sends rich content containing text and media.

Without this support, users need to either:

  • Use InlineQueryResultPhoto, which does not reliably show title/description in some Telegram clients
  • Use InlineQueryResultArticle with plain text content only
  • Fall back to raw JSON calls for answerInlineQuery

This PR makes Rich Message support available through the typed Go API.

Compatibility

This change is intended to be additive and should not break existing inline query result types or existing InputMessageContent implementations.

Existing types such as:

  • InputTextMessageContent
  • InlineQueryResultArticle
  • InlineQueryResultPhoto
  • InlineQueryResultCachedPhoto

should continue to work as before.

Testing

I ran:

go generate ./...
gofmt -w .
go test ./...
go vet ./...

Please see the latest CI result for full validation.

Copilot AI review requested due to automatic review settings June 16, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@negasus

negasus commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Спасибо за вклад! Закрываю в пользу #283, который реализует ту же фичу (Bot API 10.1 Rich Messages). #283 ближе следует конвенциям репозитория (именование полей union-типов как в reaction.go), дополнительно покрывает параметр rich_message в editMessageText и имеет более полные тесты. Влито в main (74a6bed).

@negasus negasus closed this Jun 30, 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.

4 participants