Browse Source

Merge pull request #236 from jonas747/split

Added UserGuild struct, UserGuilds now returns a UserGuild slice
Chris Rhodes 8 years ago
parent
commit
ef83d2098f
2 changed files with 11 additions and 2 deletions
  1. 2 2
      restapi.go
  2. 9 0
      structs.go

+ 2 - 2
restapi.go

@@ -362,8 +362,8 @@ func (s *Session) UserChannelCreate(recipientID string) (st *Channel, err error)
 	return
 }
 
-// UserGuilds returns an array of Guild structures for all guilds.
-func (s *Session) UserGuilds() (st []*Guild, err error) {
+// UserGuilds returns an array of UserGuild structures for all guilds.
+func (s *Session) UserGuilds() (st []*UserGuild, err error) {
 
 	body, err := s.Request("GET", EndpointUserGuilds("@me"), nil)
 	if err != nil {

+ 9 - 0
structs.go

@@ -223,6 +223,15 @@ type Guild struct {
 	Unavailable                 bool              `json:"unavailable"`
 }
 
+// A UserGuild holds a brief version of a Guild
+type UserGuild struct {
+	ID          string `json:"id"`
+	Name        string `json:"name"`
+	Icon        string `json:"icon"`
+	Owner       bool   `json:"owner"`
+	Permissions int    `json:"permissions"`
+}
+
 // A GuildParams stores all the data needed to update discord guild settings
 type GuildParams struct {
 	Name              string             `json:"name"`