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
feat(telegram): add silent_tool_hints config to disable notifications for tool hints (#2252)
Flo80ee2729ac0e
diff --git a/README.md b/README.mdindex 062abbbfc..73cdddcb6 100644--- a/README.md+++ b/README.md@@ -263,7 +263,8 @@ Connect nanobot to your favorite chat platform. Want to build your own? See the"telegram": {"enabled": true,"token": "YOUR_BOT_TOKEN",- "allowFrom": ["YOUR_USER_ID"]+ "allowFrom": ["YOUR_USER_ID"],+ "silentToolHints": false}}}diff --git a/nanobot/channels/telegram.py b/nanobot/channels/telegram.pyindex 04cc89cc2..b9d52a64f 100644--- a/nanobot/channels/telegram.py+++ b/nanobot/channels/telegram.py@@ -178,6 +178,7 @@ class TelegramConfig(Base):connection_pool_size: int = 32pool_timeout: float = 5.0streaming: bool = True+ silent_tool_hints: bool = Falseclass TelegramChannel(BaseChannel):@@ -430,8 +431,10 @@ class TelegramChannel(BaseChannel):# Send text contentif msg.content and msg.content != "[empty message]":+ disable_notification = self.config.silent_tool_hints and msg.metadata.get("_tool_hint", False)+for chunk in split_message(msg.content, TELEGRAM_MAX_MESSAGE_LEN):- await self._send_text(chat_id, chunk, reply_params, thread_kwargs)+ await self._send_text(chat_id, chunk, reply_params, thread_kwargs, disable_notification=disable_notification)async def _call_with_retry(self, fn, *args, **kwargs):"""Call an async Telegram API function with retry on pool/network timeout."""@@ -454,6 +457,7 @@ class TelegramChannel(BaseChannel):text: str,reply_params=None,thread_kwargs: dict | None = None,+ disable_notification: bool = False,) -> None:"""Send a plain text message with HTML fallback."""try:@@ -462,6 +466,7 @@ class TelegramChannel(BaseChannel):self._app.bot.send_message,chat_id=chat_id, text=html, parse_mode="HTML",reply_parameters=reply_params,+ disable_notification=disable_notification,**(thread_kwargs or {}),)except Exception as e:@@ -472,6 +477,7 @@ class TelegramChannel(BaseChannel):chat_id=chat_id,text=text,reply_parameters=reply_params,+ disable_notification=disable_notification,**(thread_kwargs or {}),)except Exception as e2: