diff --git a/src/plugin_system/apis/send_api.py b/src/plugin_system/apis/send_api.py index d579aa696..ced68f965 100644 --- a/src/plugin_system/apis/send_api.py +++ b/src/plugin_system/apis/send_api.py @@ -294,10 +294,16 @@ async def _send_to_target( if anchor_message: reply_to_platform_id = f"{anchor_message.chat_info.platform}:{anchor_message.user_info.user_id}" + # 如果引用的是 notice 虚拟消息,避免构造引用段,防止误用 + effective_set_reply = set_reply + if anchor_message and getattr(anchor_message, "message_id", None) == "notice": + logger.debug("[SendAPI] 检测到对 notice 虚拟消息的引用,已忽略引用并直接发送内容") + effective_set_reply = False + base_segment: dict[str, Any] = {"type": message_type, "data": content} message_segment: dict[str, Any] - if set_reply and anchor_message and anchor_message.message_id: + if effective_set_reply and anchor_message and anchor_message.message_id: message_segment = { "type": "seglist", "data": [ diff --git a/src/plugins/built_in/napcat_adapter/src/handlers/to_core/notice_handler.py b/src/plugins/built_in/napcat_adapter/src/handlers/to_core/notice_handler.py index 1b235a735..731b4f1e7 100644 --- a/src/plugins/built_in/napcat_adapter/src/handlers/to_core/notice_handler.py +++ b/src/plugins/built_in/napcat_adapter/src/handlers/to_core/notice_handler.py @@ -168,7 +168,9 @@ class NoticeHandler: return None if not handled_segment or not user_info: - logger.warning("notice处理失败或不支持") + logger.debug( + f"忽略 notice:type={notice_type}(无有效段/用户信息,可能为被禁用、过滤或自回声)" + ) return None # 使用 MessageBuilder 构建消息