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:
parent
687cad0c72
commit
688248346b
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue