Compare commits

...

4 Commits

Author SHA1 Message Date
d3f8a59390 Merge pull request 'hotfix' (#26) from hotfix into main
All checks were successful
BuildImage / build-image (push) Successful in 1m15s
Reviewed-on: #26
2024-03-07 10:04:47 +08:00
165fefdb48 🐛 修复扫码加入群聊的成员无法识别的BUG 2024-03-07 10:04:03 +08:00
22474efc57 🎨 逻辑完善 2024-03-07 09:49:37 +08:00
797821e2ed 🎨 逻辑完善 2024-03-07 09:48:52 +08:00
3 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -22,6 +22,11 @@ func parse(msg []byte) {
// 记录原始数据
m.Raw = string(msg)
// 如果不是自己的消息,直接返回
if m.ToUser == current.GetRobotInfo().WxId {
return
}
// 提取出群成员信息
// Sys类型的消息正文不包含微信 Id所以不需要处理
if m.IsGroup() && m.Type != types.MsgTypeSys {

View File

@ -23,6 +23,11 @@ func parse(remoteAddr net.Addr, msg []byte) {
// 记录原始数据
m.Raw = string(msg)
// 如果不是自己的消息,直接返回
if m.ToUser == current.GetRobotInfo().WxId {
return
}
// 提取出群成员信息
// Sys类型的消息正文不包含微信 Id所以不需要处理
if m.IsGroup() && m.Type != types.MsgTypeSys {