format User display

This commit is contained in:
eatmoreapple 2022-12-30 13:04:29 +08:00
parent 326f200976
commit e171c1fefa

12
user.go
View File

@ -54,7 +54,17 @@ type User struct {
// implement fmt.Stringer
func (u *User) String() string {
return fmt.Sprintf("<User:%s>", u.NickName)
format := "User"
if u.IsFriend() {
format = "Friend"
} else if u.IsGroup() {
format = "Group"
} else if u.IsMP() {
format = "MP"
} else if u.IsSelf() {
format = "Self"
}
return fmt.Sprintf("<%s:%s>", format, u.NickName)
}
// GetAvatarResponse 获取用户头像