Remove unavailable goop, b1nzy says it'd never happen.
This commit is contained in:
parent
678756c9a9
commit
42cef0c0d0
1 changed files with 20 additions and 27 deletions
47
state.go
47
state.go
|
@ -99,34 +99,27 @@ func (s *State) GuildAdd(guild *Guild) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if g, ok := s.guildMap[guild.ID]; ok {
|
if g, ok := s.guildMap[guild.ID]; ok {
|
||||||
// The guild already exists in state.
|
// We are about to replace `g` in the state with `guild`, but first we need to
|
||||||
if guild.Unavailable {
|
// make sure we preserve any fields that the `guild` doesn't contain from `g`.
|
||||||
// If the new guild is unavailable, just update the `unavailable` property on the
|
if guild.Roles == nil {
|
||||||
// current guild.
|
guild.Roles = g.Roles
|
||||||
g.Unavailable = guild.Unavailable
|
|
||||||
} else {
|
|
||||||
// We are about to replace `g` in the state with `guild`, but first we need to
|
|
||||||
// make sure we preserve any fields that the `guild` doesn't contain from `g`.
|
|
||||||
if guild.Roles == nil {
|
|
||||||
guild.Roles = g.Roles
|
|
||||||
}
|
|
||||||
if guild.Emojis == nil {
|
|
||||||
guild.Emojis = g.Emojis
|
|
||||||
}
|
|
||||||
if guild.Members == nil {
|
|
||||||
guild.Members = g.Members
|
|
||||||
}
|
|
||||||
if guild.Presences == nil {
|
|
||||||
guild.Presences = g.Presences
|
|
||||||
}
|
|
||||||
if guild.Channels == nil {
|
|
||||||
guild.Channels = g.Channels
|
|
||||||
}
|
|
||||||
if guild.VoiceStates == nil {
|
|
||||||
guild.VoiceStates = g.VoiceStates
|
|
||||||
}
|
|
||||||
*g = *guild
|
|
||||||
}
|
}
|
||||||
|
if guild.Emojis == nil {
|
||||||
|
guild.Emojis = g.Emojis
|
||||||
|
}
|
||||||
|
if guild.Members == nil {
|
||||||
|
guild.Members = g.Members
|
||||||
|
}
|
||||||
|
if guild.Presences == nil {
|
||||||
|
guild.Presences = g.Presences
|
||||||
|
}
|
||||||
|
if guild.Channels == nil {
|
||||||
|
guild.Channels = g.Channels
|
||||||
|
}
|
||||||
|
if guild.VoiceStates == nil {
|
||||||
|
guild.VoiceStates = g.VoiceStates
|
||||||
|
}
|
||||||
|
*g = *guild
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue