From 5765bb7804e71146bcba0623823791d18f3a7f16 Mon Sep 17 00:00:00 2001 From: Carson Hoffman Date: Sun, 28 Jan 2018 20:02:52 -0500 Subject: [PATCH] Added Role.Mention function --- structs.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/structs.go b/structs.go index c58c916..351e855 100644 --- a/structs.go +++ b/structs.go @@ -13,6 +13,7 @@ package discordgo import ( "encoding/json" + "fmt" "net/http" "sync" "time" @@ -289,6 +290,11 @@ type Role struct { Permissions int `json:"permissions"` } +// Mention returns a string which mentions the role +func (r *Role) Mention() string { + return fmt.Sprintf("<@&%s>", r.ID) +} + // Roles are a collection of Role type Roles []*Role