Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix: make Telegram rich messages opt in
chengyongrue92899607aaf
diff --git a/nanobot/channels/telegram.py b/nanobot/channels/telegram.pyindex 743f7b240..606f04803 100644--- a/nanobot/channels/telegram.py+++ b/nanobot/channels/telegram.py@@ -351,9 +351,8 @@ class TelegramConfig(Base):streaming: bool = True# Enable inline keyboard buttons in Telegram messages.inline_keyboards: bool = False- # Use Bot API 10.1 sendRichMessage for markdown rendering.- # Disable if Telegram Web shows "message not supported" errors.- rich_messages: bool = True+ # Opt in to Bot API 10.1 sendRichMessage for richer markdown rendering.+ rich_messages: bool = Falsestream_edit_interval: float = Field(default=_STREAM_EDIT_INTERVAL_DEFAULT, ge=0.1)webhook_url: str = ""webhook_listen_host: str = "127.0.0.1"diff --git a/tests/channels/test_telegram_channel.py b/tests/channels/test_telegram_channel.pyindex 2d3f5c574..91895fc66 100644--- a/tests/channels/test_telegram_channel.py+++ b/tests/channels/test_telegram_channel.py@@ -471,7 +471,7 @@ async def test_send_rich_capability_error_latches_and_falls_back() -> None:from telegram.error import BadRequestchannel = TelegramChannel(- TelegramConfig(enabled=True, token="123:abc", allow_from=["*"]),+ TelegramConfig(enabled=True, token="123:abc", allow_from=["*"], rich_messages=True),MessageBus(),)channel._app = _FakeApp(lambda: None)@@ -490,7 +490,7 @@ async def test_send_rich_bad_request_does_not_latch_capability() -> None:from telegram.error import BadRequestchannel = TelegramChannel(- TelegramConfig(enabled=True, token="123:abc", allow_from=["*"]),+ TelegramConfig(enabled=True, token="123:abc", allow_from=["*"], rich_messages=True),MessageBus(),)channel._app = _FakeApp(lambda: None)@@ -506,10 +506,10 @@ async def test_send_rich_bad_request_does_not_latch_capability() -> None:@pytest.mark.asyncio-async def test_rich_messages_config_disabled_skips_sendRichMessage() -> None:- """When rich_messages=False, sendRichMessage should not be called."""+async def test_rich_messages_default_skips_send_rich_message() -> None:+ """By default, sendRichMessage should not be called."""channel = TelegramChannel(- TelegramConfig(enabled=True, token="123:abc", allow_from=["*"], rich_messages=False),+ TelegramConfig(enabled=True, token="123:abc", allow_from=["*"]),MessageBus(),)channel._app = _FakeApp(lambda: None)