1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-30 18:53:30 +00:00

State: Added handlers for PresencesReplaceEvent

This commit is contained in:
diamondburned (Forefront) 2020-02-23 20:11:33 -08:00
parent 687cad0c72
commit 688248346b

View file

@ -178,11 +178,19 @@ func (s *State) onEvent(iface interface{}) {
}
case *gateway.PresenceUpdateEvent:
if err := s.Store.PresenceSet(
ev.GuildID, (*discord.Presence)(ev)); err != nil {
presence := (*discord.Presence)(ev)
if err := s.Store.PresenceSet(ev.GuildID, presence); err != nil {
s.stateErr(err, "Failed to update presence in state")
}
case *gateway.PresencesReplaceEvent:
for i := range *ev {
p := (*ev)[i]
if err := s.Store.PresenceSet(p.GuildID, &p); err != nil {
s.stateErr(err, "Failed to update presence in state")
}
}
}
}