fix(telegram): make Bot API 10.1 rich messages opt-in (default off)

Rich messages are not ready for primetime: current Telegram clients can
render Bot API 10.1 rich messages as blank/unsupported bubbles and make
them hard to copy as plain text, which is worse than the legacy
MarkdownV2 path for command snippets and mobile handoffs. Default the
rich_messages toggle to False so replies stay on the copyable legacy
path; users opt in per bot via platforms.telegram.extra.rich_messages:
true. Updates adapter, gateway config default, example config, English +
zh-Hans docs, and the default/opt-in tests.
This commit is contained in:
kn8-codes 2026-06-21 11:37:44 -07:00 committed by Teknium
parent 3b56d3a29a
commit 6183e8ce1b
7 changed files with 44 additions and 17 deletions

View file

@ -489,10 +489,14 @@ class TelegramAdapter(BasePlatformAdapter):
# Bot API 10.1 Rich Messages: render constructs the legacy MarkdownV2
# path degrades (tables → bullet lists, task lists, <details>, block
# math) via sendRichMessage / editMessageText's rich_message param using
# the raw agent markdown. Enabled by default; users can opt out for
# the raw agent markdown. Disabled by default so Telegram messages stay
# easy to copy as plain text; users can opt in for richer rendering on
# clients that accept but render rich messages poorly via
# platforms.telegram.extra.rich_messages: false.
self._rich_messages_enabled: bool = self._coerce_bool_extra("rich_messages", True)
# platforms.telegram.extra.rich_messages: true. Keep this opt-in:
# current Telegram clients can make rich messages difficult to copy
# as plain text, which is worse than degraded table/task-list rendering
# for command snippets and mobile handoffs.
self._rich_messages_enabled: bool = self._coerce_bool_extra("rich_messages", False)
# Latched off after a capability failure on sendRichMessage /
# sendRichMessageDraft (e.g. older python-telegram-bot without the
# endpoint) so later sends skip the doomed rich attempt entirely.