diff --git a/relations.go b/relations.go index 19762e0..635610e 100644 --- a/relations.go +++ b/relations.go @@ -10,7 +10,11 @@ type Friend struct{ *User } // implement fmt.Stringer func (f *Friend) String() string { - return fmt.Sprintf("", f.NickName) + display := f.NickName + if f.RemarkName != "" { + display = f.RemarkName + } + return fmt.Sprintf("", display) } // SetRemarkName 重命名当前好友 @@ -156,7 +160,11 @@ type Group struct{ *User } // implement fmt.Stringer func (g *Group) String() string { - return fmt.Sprintf("", g.NickName) + display := g.NickName + if g.RemarkName != "" { + display = g.RemarkName + } + return fmt.Sprintf("", display) } // SendText 发行文本消息给当前的群组 diff --git a/user.go b/user.go index 45f233e..05fbf42 100644 --- a/user.go +++ b/user.go @@ -58,14 +58,14 @@ type User struct { // implement fmt.Stringer func (u *User) String() string { format := "User" - if u.IsFriend() { + if u.IsSelf() { + format = "Self" + } else 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) }