File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,29 @@ func (u User) Mention() string {
43
43
44
44
// Tag returns a tag of the user.
45
45
func (u User ) Tag () string {
46
- if u .Discriminator == "0" {
46
+ if u .Discriminator == "0" || u . Discriminator == "0000" {
47
47
return u .Username
48
48
}
49
-
50
49
return u .Username + "#" + u .Discriminator
51
50
}
52
51
52
+ // DisplayOrUsername returns the DisplayName if it is set, otherwise the
53
+ // Username.
54
+ func (u User ) DisplayOrUsername () string {
55
+ if u .DisplayName != "" {
56
+ return u .DisplayName
57
+ }
58
+ return u .Username
59
+ }
60
+
61
+ // DisplayOrTag returns the DisplayName if it is set, otherwise the Tag.
62
+ func (u User ) DisplayOrTag () string {
63
+ if u .DisplayName != "" {
64
+ return u .DisplayName
65
+ }
66
+ return u .Tag ()
67
+ }
68
+
53
69
// AvatarURL returns the URL of the Avatar Image. It automatically detects a
54
70
// suitable type.
55
71
func (u User ) AvatarURL () string {
You can’t perform that action at this time.
0 commit comments