Remove items from the map before returning 👌
This commit is contained in:
parent
d658974d29
commit
a8afd3eb81
1 changed files with 4 additions and 4 deletions
8
state.go
8
state.go
|
@ -105,6 +105,8 @@ func (s *State) GuildRemove(guild *Guild) error {
|
||||||
|
|
||||||
s.Lock()
|
s.Lock()
|
||||||
defer s.Unlock()
|
defer s.Unlock()
|
||||||
|
|
||||||
|
delete(s.guildMap, guild.ID)
|
||||||
|
|
||||||
for i, g := range s.Guilds {
|
for i, g := range s.Guilds {
|
||||||
if g.ID == guild.ID {
|
if g.ID == guild.ID {
|
||||||
|
@ -113,8 +115,6 @@ func (s *State) GuildRemove(guild *Guild) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(s.guildMap, guild.ID)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +259,8 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete(s.channelMap, channel.ID)
|
||||||
|
|
||||||
if channel.IsPrivate {
|
if channel.IsPrivate {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
|
@ -287,8 +289,6 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(s.channelMap, channel.ID)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue