Avoid a potential issue where State tracking was disabled and it would return a stale Guild.

This commit is contained in:
Chris Rhodes 2016-01-12 11:32:02 -08:00
parent b4dfce0fee
commit a6a218d2fd

View file

@ -321,11 +321,13 @@ func (s *Session) UserGuilds() (st []*Guild, err error) {
// Guild returns a Guild structure of a specific Guild.
// guildID : The ID of a Guild
func (s *Session) Guild(guildID string) (st *Guild, err error) {
if s.StateEnabled {
// Attempt to grab the guild from State first.
st, err = s.State.Guild(guildID)
if err == nil {
return
}
}
body, err := s.Request("GET", GUILD(guildID), nil)
if err != nil {