From 8842fb2b4d734e06caded189a129a432bfa31731 Mon Sep 17 00:00:00 2001 From: GabrielWithTina Date: Sat, 28 Feb 2026 09:44:28 +0800 Subject: [PATCH] fix: pass msg_id in QQ C2C reply to avoid proactive message permission error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QQ's bot API requires a msg_id (original inbound message ID) to send a passive reply. Without it the request is treated as a proactive message and fails with error 40034102 (无权限). The message_id was already stored in InboundMessage.metadata and forwarded to OutboundMessage, but was never read in send(). Co-Authored-By: Claude Sonnet 4.6 --- nanobot/channels/qq.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nanobot/channels/qq.py b/nanobot/channels/qq.py index 5352a30..50dbbde 100644 --- a/nanobot/channels/qq.py +++ b/nanobot/channels/qq.py @@ -100,10 +100,12 @@ class QQChannel(BaseChannel): logger.warning("QQ client not initialized") return try: + msg_id = msg.metadata.get("message_id") await self._client.api.post_c2c_message( openid=msg.chat_id, msg_type=0, content=msg.content, + msg_id=msg_id, ) except Exception as e: logger.error("Error sending QQ message: {}", e)