[style]: update User display (#227)
This commit is contained in:
parent
5194ad4965
commit
fbfd691cb4
12
relations.go
12
relations.go
@ -10,7 +10,11 @@ type Friend struct{ *User }
|
|||||||
|
|
||||||
// implement fmt.Stringer
|
// implement fmt.Stringer
|
||||||
func (f *Friend) String() string {
|
func (f *Friend) String() string {
|
||||||
return fmt.Sprintf("<Friend:%s>", f.NickName)
|
display := f.NickName
|
||||||
|
if f.RemarkName != "" {
|
||||||
|
display = f.RemarkName
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("<Friend:%s>", display)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetRemarkName 重命名当前好友
|
// SetRemarkName 重命名当前好友
|
||||||
@ -156,7 +160,11 @@ type Group struct{ *User }
|
|||||||
|
|
||||||
// implement fmt.Stringer
|
// implement fmt.Stringer
|
||||||
func (g *Group) String() string {
|
func (g *Group) String() string {
|
||||||
return fmt.Sprintf("<Group:%s>", g.NickName)
|
display := g.NickName
|
||||||
|
if g.RemarkName != "" {
|
||||||
|
display = g.RemarkName
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("<Group:%s>", display)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendText 发行文本消息给当前的群组
|
// SendText 发行文本消息给当前的群组
|
||||||
|
6
user.go
6
user.go
@ -58,14 +58,14 @@ type User struct {
|
|||||||
// implement fmt.Stringer
|
// implement fmt.Stringer
|
||||||
func (u *User) String() string {
|
func (u *User) String() string {
|
||||||
format := "User"
|
format := "User"
|
||||||
if u.IsFriend() {
|
if u.IsSelf() {
|
||||||
|
format = "Self"
|
||||||
|
} else if u.IsFriend() {
|
||||||
format = "Friend"
|
format = "Friend"
|
||||||
} else if u.IsGroup() {
|
} else if u.IsGroup() {
|
||||||
format = "Group"
|
format = "Group"
|
||||||
} else if u.IsMP() {
|
} else if u.IsMP() {
|
||||||
format = "MP"
|
format = "MP"
|
||||||
} else if u.IsSelf() {
|
|
||||||
format = "Self"
|
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("<%s:%s>", format, u.NickName)
|
return fmt.Sprintf("<%s:%s>", format, u.NickName)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user