Merge pull request #236 from jonas747/split

Added UserGuild struct, UserGuilds now returns a UserGuild slice
This commit is contained in:
Chris Rhodes 2016-09-27 22:04:37 -07:00 committed by GitHub
commit ef83d2098f
2 changed files with 11 additions and 2 deletions

View file

@ -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 {

View file

@ -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"`