Avoid a potential issue where State tracking was disabled and it would return a stale Guild.
This commit is contained in:
parent
b4dfce0fee
commit
a6a218d2fd
1 changed files with 6 additions and 4 deletions
10
restapi.go
10
restapi.go
|
@ -321,10 +321,12 @@ func (s *Session) UserGuilds() (st []*Guild, err error) {
|
||||||
// Guild returns a Guild structure of a specific Guild.
|
// Guild returns a Guild structure of a specific Guild.
|
||||||
// guildID : The ID of a Guild
|
// guildID : The ID of a Guild
|
||||||
func (s *Session) Guild(guildID string) (st *Guild, err error) {
|
func (s *Session) Guild(guildID string) (st *Guild, err error) {
|
||||||
// Attempt to grab the guild from State first.
|
if s.StateEnabled {
|
||||||
st, err = s.State.Guild(guildID)
|
// Attempt to grab the guild from State first.
|
||||||
if err == nil {
|
st, err = s.State.Guild(guildID)
|
||||||
return
|
if err == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := s.Request("GET", GUILD(guildID), nil)
|
body, err := s.Request("GET", GUILD(guildID), nil)
|
||||||
|
|
Loading…
Reference in a new issue