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(agent): message tool incorrectly replies to original chat when targeting different chat_id
WormW6973bfff24b6
diff --git a/nanobot/agent/tools/message.py b/nanobot/agent/tools/message.pyindex c8d50cf1e..efbadca10 100644--- a/nanobot/agent/tools/message.py+++ b/nanobot/agent/tools/message.py@@ -86,7 +86,13 @@ class MessageTool(Tool):) -> str:channel = channel or self._default_channelchat_id = chat_id or self._default_chat_id- message_id = message_id or self._default_message_id+ # Only use default message_id if chat_id matches the default context.+ # If targeting a different chat, don't reply to the original message.+ if chat_id == self._default_chat_id:+ message_id = message_id or self._default_message_id+ else:+ # Targeting a different chat - don't use default message_id+ message_id = Noneif not channel or not chat_id:return "Error: No target channel/chat specified"@@ -101,7 +107,7 @@ class MessageTool(Tool):media=media or [],metadata={"message_id": message_id,- },+ } if message_id else {},)try: