diff --git a/discord/channel.go b/discord/channel.go index 03d2676..d6cfa33 100644 --- a/discord/channel.go +++ b/discord/channel.go @@ -41,6 +41,10 @@ type Channel struct { VoiceUserLimit uint `json:"user_limit,omitempty"` } +func (ch Channel) Mention() string { + return "<#" + ch.ID.String() + ">" +} + type ChannelType uint8 const ( diff --git a/discord/guild.go b/discord/guild.go index 6b5fb9e..156743c 100644 --- a/discord/guild.go +++ b/discord/guild.go @@ -65,6 +65,10 @@ type Role struct { Mentionable bool `json:"mentionable"` } +func (r Role) Mention() string { + return "<&" + r.ID.String() + ">" +} + type Presence struct { User User `json:"user"` RoleIDs []Snowflake `json:"roles"` @@ -100,6 +104,10 @@ type Member struct { Mute bool `json:"mute"` } +func (m Member) Mention() string { + return "<@!" + m.User.ID.String() + ">" +} + type Ban struct { Reason string `json:"reason,omitempty"` User User `json:"user"` diff --git a/discord/user.go b/discord/user.go index 512040f..09bfe84 100644 --- a/discord/user.go +++ b/discord/user.go @@ -21,6 +21,10 @@ type User struct { Nitro UserNitro `json:"premium_type,omitempty"` } +func (u User) Mention() string { + return "<@" + u.ID.String() + ">" +} + type UserFlags uint16 const (