Support new leave API.

This commit is contained in:
Chris Rhodes 2016-02-15 18:38:15 -08:00
parent bf3f2c548a
commit 0bd7fbf668
2 changed files with 10 additions and 1 deletions

View file

@ -50,6 +50,7 @@ var (
USER_AVATAR = func(uID, aID string) string { return USERS + uID + "/avatars/" + aID + ".jpg" }
USER_SETTINGS = func(uID string) string { return USERS + uID + "/settings" }
USER_GUILDS = func(uID string) string { return USERS + uID + "/guilds" }
USER_GUILD = func(uID, gID string) string { return USERS + uID + "/guilds/" + gID }
USER_CHANNELS = func(uID string) string { return USERS + uID + "/channels" }
USER_DEVICES = func(uID string) string { return USERS + uID + "/devices" }
USER_CONNECTIONS = func(uID string) string { return USERS + uID + "/connections" }

View file

@ -390,7 +390,7 @@ func (s *Session) GuildEdit(guildID, name string) (st *Guild, err error) {
return
}
// GuildDelete deletes or leaves a Guild.
// GuildDelete deletes a Guild.
// guildID : The ID of a Guild
func (s *Session) GuildDelete(guildID string) (st *Guild, err error) {
@ -403,6 +403,14 @@ func (s *Session) GuildDelete(guildID string) (st *Guild, err error) {
return
}
// GuildLeave leaves a Guild.
// guildID : The ID of a Guild
func (s *Session) GuildLeave(guildID string) (st *Guild, err error) {
_, err := s.Request("DELETE", USER_GUILD("@me", guildID), nil)
return
}
// GuildBans returns an array of User structures for all bans of a
// given guild.
// guildID : The ID of a Guild.