From db054c6a707b1af83fc84e7027f5ad8733ce0ce2 Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Sun, 9 Mar 2025 14:11:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E6=B6=88=E6=81=AF=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=B7=BB=E5=8A=A0=E7=BA=BF=E7=A8=8B=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/action.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action/action.go b/action/action.go index 6fc3e8e..c692d29 100644 --- a/action/action.go +++ b/action/action.go @@ -3,6 +3,7 @@ package action import ( "encoding/json" "fmt" + "sync" "git.lxtend.com/qqbot/message" "git.lxtend.com/qqbot/model" @@ -16,6 +17,7 @@ var ActionManager = actionManager{} type actionManager struct { botConn *websocket.Conn + sendMtx sync.Mutex } func (am *actionManager) Started() bool { @@ -31,6 +33,8 @@ func (am *actionManager) SendAction(action string) error { } func (am *actionManager) SendMsg(reply model.Reply) error { + am.sendMtx.Lock() + defer am.sendMtx.Unlock() if reply.ReferOriginMsg { replyMsg := message.ReplyMessage{ Type: "reply",