From e1854c4373cd7b944c18452bb0c852ee214c032d Mon Sep 17 00:00:00 2001 From: Re-bin Date: Fri, 20 Feb 2026 11:13:10 +0000 Subject: [PATCH] feat: make Telegram reply-to-message behavior configurable, default false --- nanobot/channels/telegram.py | 14 +++++++------- nanobot/config/schema.py | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/nanobot/channels/telegram.py b/nanobot/channels/telegram.py index d29fdfd..6cd98e7 100644 --- a/nanobot/channels/telegram.py +++ b/nanobot/channels/telegram.py @@ -224,14 +224,14 @@ class TelegramChannel(BaseChannel): logger.error("Invalid chat_id: {}", msg.chat_id) return - # Build reply parameters (Will reply to the message if it exists) - reply_to_message_id = msg.metadata.get("message_id") reply_params = None - if reply_to_message_id: - reply_params = ReplyParameters( - message_id=reply_to_message_id, - allow_sending_without_reply=True - ) + if self.config.reply_to_message: + reply_to_message_id = msg.metadata.get("message_id") + if reply_to_message_id: + reply_params = ReplyParameters( + message_id=reply_to_message_id, + allow_sending_without_reply=True + ) # Send media files for media_path in (msg.media or []): diff --git a/nanobot/config/schema.py b/nanobot/config/schema.py index 570f322..966d11d 100644 --- a/nanobot/config/schema.py +++ b/nanobot/config/schema.py @@ -28,6 +28,7 @@ class TelegramConfig(Base): token: str = "" # Bot token from @BotFather allow_from: list[str] = Field(default_factory=list) # Allowed user IDs or usernames proxy: str | None = None # HTTP/SOCKS5 proxy URL, e.g. "http://127.0.0.1:7890" or "socks5://127.0.0.1:1080" + reply_to_message: bool = False # If true, bot replies quote the original message class FeishuConfig(Base):