From 165fefdb482e042aadd0aca0d58343b32b6909b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Thu, 7 Mar 2024 10:04:03 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=BE=A4=E8=81=8A=E7=9A=84=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=AF=86=E5=88=AB=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/message.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/model/message.go b/model/message.go index f2d240b..951ee0f 100644 --- a/model/message.go +++ b/model/message.go @@ -88,7 +88,13 @@ func (m Message) IsRevokeMsg() bool { // @receiver m // @return bool func (m Message) IsNewUserJoin() bool { - sysFlag := m.Type == types.MsgTypeSys && strings.Contains(m.Content, "\"邀请\"") && strings.Contains(m.Content, "\"加入了群聊") + if m.Type != types.MsgTypeSys { + return false + } + + isInvitation := strings.Contains(m.Content, "\"邀请\"") && strings.Contains(m.Content, "\"加入了群聊") + isScanQrCode := strings.Contains(m.Content, "通过扫描") && strings.Contains(m.Content, "加入群聊") + sysFlag := isInvitation || isScanQrCode if sysFlag { return true } @@ -97,7 +103,7 @@ func (m Message) IsNewUserJoin() bool { if err := xml.Unmarshal([]byte(m.Content), &d); err != nil { return false } - return m.Type == types.MsgTypeSys && d.Type == "delchatroommember" + return d.Type == "delchatroommember" } // IsAt