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.
|
||||
// guildID : The ID of a Guild
|
||||
func (s *Session) Guild(guildID string) (st *Guild, err error) {
|
||||
// Attempt to grab the guild from State first.
|
||||
st, err = s.State.Guild(guildID)
|
||||
if err == nil {
|
||||
return
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue