From e171c1fefaf571cdff2fd79dd44b21b2de7d8b46 Mon Sep 17 00:00:00 2001 From: eatmoreapple Date: Fri, 30 Dec 2022 13:04:29 +0800 Subject: [PATCH] format User display --- user.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/user.go b/user.go index d54d5c9..f2aeb16 100644 --- a/user.go +++ b/user.go @@ -54,7 +54,17 @@ type User struct { // implement fmt.Stringer func (u *User) String() string { - return fmt.Sprintf("", 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 获取用户头像