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