修复从群聊中获取不到消息的发送者的bug 🐛 (#143)

This commit is contained in:
多吃点苹果 2022-12-10 15:35:35 +08:00 committed by GitHub
parent 277f499c56
commit 94743ec582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,6 +98,13 @@ func (m *Message) SenderInGroup() (*User, error) {
if group.IsFriend() {
return group, nil
}
// 如果群聊的群成员是空的, 则从服务器获取
if group.MemberList.Count() == 0 {
// 更新群详情
if err = group.Detail(); err != nil {
return nil, err
}
}
users := group.MemberList.SearchByUserName(1, m.senderInGroupUserName)
if users == nil {
return nil, ErrNoSuchUserFoundError