1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-12-01 03:03:48 +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: case *gateway.PresenceUpdateEvent:
if err := s.Store.PresenceSet( presence := (*discord.Presence)(ev)
ev.GuildID, (*discord.Presence)(ev)); err != nil { if err := s.Store.PresenceSet(ev.GuildID, presence); err != nil {
s.stateErr(err, "Failed to update presence in state") 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")
}
}
} }
} }