Skip to content

Commit

Permalink
format User display
Browse files Browse the repository at this point in the history
  • Loading branch information
eatmoreapple committed Dec 30, 2022
1 parent 326f200 commit e171c1f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 获取用户头像
Expand Down

0 comments on commit e171c1f

Please sign in to comment.