瀏覽代碼

Merge pull request #507 from CarsonHoffman/role-mention

Added Role.Mention function
Bruce 7 年之前
父節點
當前提交
156f776f95
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      structs.go

+ 6 - 0
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