forked from pothtonswer/discordmuffin
Merge pull request #168 from iopred/patch-4
Remove items from the map before returning 👌
This commit is contained in:
commit
f654ec2a42
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()
|
||||
defer s.Unlock()
|
||||
|
||||
delete(s.guildMap, guild.ID)
|
||||
|
||||
for i, g := range s.Guilds {
|
||||
if g.ID == guild.ID {
|
||||
|
@ -113,8 +115,6 @@ func (s *State) GuildRemove(guild *Guild) error {
|
|||
}
|
||||
}
|
||||
|
||||
delete(s.guildMap, guild.ID)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,8 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
delete(s.channelMap, channel.ID)
|
||||
|
||||
if channel.IsPrivate {
|
||||
s.Lock()
|
||||
|
@ -287,8 +289,6 @@ func (s *State) ChannelRemove(channel *Channel) error {
|
|||
}
|
||||
}
|
||||
|
||||
delete(s.channelMap, channel.ID)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue