mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-05 19:57:02 +00:00
discord: Add User.DisplayOr{Username,Tag}
This commit is contained in:
parent
2b0395ab12
commit
4224b93c4e
|
@ -43,13 +43,29 @@ func (u User) Mention() string {
|
|||
|
||||
// Tag returns a tag of the user.
|
||||
func (u User) Tag() string {
|
||||
if u.Discriminator == "0" {
|
||||
if u.Discriminator == "0" || u.Discriminator == "0000" {
|
||||
return u.Username
|
||||
}
|
||||
|
||||
return u.Username + "#" + u.Discriminator
|
||||
}
|
||||
|
||||
// DisplayOrUsername returns the DisplayName if it is set, otherwise the
|
||||
// Username.
|
||||
func (u User) DisplayOrUsername() string {
|
||||
if u.DisplayName != "" {
|
||||
return u.DisplayName
|
||||
}
|
||||
return u.Username
|
||||
}
|
||||
|
||||
// DisplayOrTag returns the DisplayName if it is set, otherwise the Tag.
|
||||
func (u User) DisplayOrTag() string {
|
||||
if u.DisplayName != "" {
|
||||
return u.DisplayName
|
||||
}
|
||||
return u.Tag()
|
||||
}
|
||||
|
||||
// AvatarURL returns the URL of the Avatar Image. It automatically detects a
|
||||
// suitable type.
|
||||
func (u User) AvatarURL() string {
|
||||
|
|
Loading…
Reference in a new issue