🐛 修复扫码加入群聊的成员无法识别的BUG

This commit is contained in:
李寻欢 2024-03-07 10:04:03 +08:00
parent 22474efc57
commit 165fefdb48

View File

@ -88,7 +88,13 @@ func (m Message) IsRevokeMsg() bool {
// @receiver m // @receiver m
// @return bool // @return bool
func (m Message) IsNewUserJoin() 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 { if sysFlag {
return true return true
} }
@ -97,7 +103,7 @@ func (m Message) IsNewUserJoin() bool {
if err := xml.Unmarshal([]byte(m.Content), &d); err != nil { if err := xml.Unmarshal([]byte(m.Content), &d); err != nil {
return false return false
} }
return m.Type == types.MsgTypeSys && d.Type == "delchatroommember" return d.Type == "delchatroommember"
} }
// IsAt // IsAt