From c434a3f0ce83e1179305fcb84d7335253388d98c Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Thu, 17 Jul 2025 14:44:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=20MsgInHandler?= =?UTF-8?q?=20=E5=87=BD=E6=95=B0=EF=BC=8C=E6=94=B9=E8=BF=9B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=E4=BB=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=A4=9A=E6=9D=A1=E6=96=87=E6=9C=AC=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E8=A7=A6=E5=8F=91=E5=99=A8=E5=8C=B9=E9=85=8D=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E4=BB=A3=E7=A0=81=E7=9A=84=E7=81=B5=E6=B4=BB?= =?UTF-8?q?=E6=80=A7=E5=92=8C=E5=8F=AF=E8=AF=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/handler.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/handler/handler.go b/handler/handler.go index 6622645..dce9269 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -131,9 +131,11 @@ func MsgInHandler(msg model.Message) (reply *model.Reply) { return nil } for trigger, handler := range atHandlers { - if len(msg.StructuredMsg) > 1 { - if textMsg, ok := msg.StructuredMsg[1].(*qq_message.TextMessage); ok && strings.Split(textMsg.Data.Text, " ")[0] == trigger { - return auth.TryExecHandler(msg, handler.Level, handler.Handler) + for _, textMsg := range msg.StructuredMsg { + if textMsg.GetMessageType() == qq_message.TypeText { + if util.SplitN(textMsg.(*qq_message.TextMessage).Data.Text, 2)[0] == trigger { + return auth.TryExecHandler(msg, handler.Level, handler.Handler) + } } } }