From 222fc5768f7eab0a22b56fcd6cf60391dd63d351 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Tue, 23 Jun 2026 19:26:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20send-proactive=20adapter=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=20=E2=80=94=20=E5=85=88=E6=8C=89=E5=90=8D=E5=86=8D?= =?UTF-8?q?=E6=8C=89=E5=B9=B3=E5=8F=B0=E7=B1=BB=E5=9E=8B=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/handler/bridge_handler.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/platform-bridge/internal/handler/bridge_handler.go b/backend/platform-bridge/internal/handler/bridge_handler.go index 8a0e072..3d26837 100644 --- a/backend/platform-bridge/internal/handler/bridge_handler.go +++ b/backend/platform-bridge/internal/handler/bridge_handler.go @@ -200,9 +200,18 @@ func (h *BridgeHandler) sendProactive(w http.ResponseWriter, r *http.Request) { content = fmt.Sprintf("[CQ:at,qq=%s] %s", req.AtUserID, content) } - // Find the adapter. For OBv11, use the platform name as adapter name. + // Resolve adapter: try exact name first, then find by platform type. adapterName := req.Platform err := h.router.SendProactive(adapterName, msgType, userID, groupID, content) + if err != nil { + for _, name := range h.router.ListAdapters() { + if a, aErr := h.router.GetAdapter(name); aErr == nil && a.PlatformName() == req.Platform && a.IsConnected() { + adapterName = name + err = h.router.SendProactive(name, msgType, userID, groupID, content) + break + } + } + } if err != nil { log.Printf("[send-proactive] 发送失败: adapter=%s err=%v", adapterName, err) writeJSON(w, http.StatusInternalServerError, errResp("send failed: "+err.Error()))