add Tag method to user (#364)
* add Tag method to user * change format verb to %s * use consistent string forming
This commit is contained in:
parent
5cc4af9aa2
commit
e58e61b0ff
1 changed files with 8 additions and 1 deletions
9
user.go
9
user.go
|
@ -1,5 +1,7 @@
|
|||
package discordgo
|
||||
|
||||
import "fmt"
|
||||
|
||||
// A User stores all data for an individual Discord user.
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
|
@ -15,5 +17,10 @@ type User struct {
|
|||
|
||||
//String returns a unique identifier of the form username#discriminator
|
||||
func (u *User) String() string {
|
||||
return u.Username + "#" + u.Discriminator
|
||||
return fmt.Sprintf("%s#%s", u.Username, u.Discriminator)
|
||||
}
|
||||
|
||||
//Mention return a string which mentions the user
|
||||
func (u *User) Mention() string {
|
||||
return fmt.Sprintf("<@%s>", u.ID)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue