mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-30 18:53:30 +00:00
State: resolve errors
This commit is contained in:
parent
bc67714e83
commit
40a61dab98
|
@ -224,8 +224,7 @@ func (s *State) onEvent(iface interface{}) {
|
||||||
})
|
})
|
||||||
|
|
||||||
case *gateway.PresenceUpdateEvent:
|
case *gateway.PresenceUpdateEvent:
|
||||||
presence := (*discord.Presence)(ev)
|
if err := s.Store.PresenceSet(ev.GuildID, &ev.Presence); 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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,23 +242,23 @@ func (s *State) onEvent(iface interface{}) {
|
||||||
case *gateway.UserGuildSettingsUpdateEvent:
|
case *gateway.UserGuildSettingsUpdateEvent:
|
||||||
for i, ugs := range s.Ready.UserGuildSettings {
|
for i, ugs := range s.Ready.UserGuildSettings {
|
||||||
if ugs.GuildID == ev.GuildID {
|
if ugs.GuildID == ev.GuildID {
|
||||||
s.Ready.UserGuildSettings[i] = gateway.UserGuildSettings(*ev)
|
s.Ready.UserGuildSettings[i] = ev.UserGuildSettings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case *gateway.UserSettingsUpdateEvent:
|
case *gateway.UserSettingsUpdateEvent:
|
||||||
s.Ready.Settings = (*gateway.UserSettings)(ev)
|
s.Ready.Settings = &ev.UserSettings
|
||||||
|
|
||||||
case *gateway.UserNoteUpdateEvent:
|
case *gateway.UserNoteUpdateEvent:
|
||||||
s.Ready.Notes[ev.ID] = ev.Note
|
s.Ready.Notes[ev.ID] = ev.Note
|
||||||
|
|
||||||
case *gateway.UserUpdateEvent:
|
case *gateway.UserUpdateEvent:
|
||||||
if err := s.Store.MyselfSet((*discord.User)(ev)); err != nil {
|
if err := s.Store.MyselfSet(&ev.User); err != nil {
|
||||||
s.stateErr(err, "Failed to update myself from USER_UPDATE")
|
s.stateErr(err, "Failed to update myself from USER_UPDATE")
|
||||||
}
|
}
|
||||||
|
|
||||||
case *gateway.VoiceStateUpdateEvent:
|
case *gateway.VoiceStateUpdateEvent:
|
||||||
vs := (*discord.VoiceState)(ev)
|
vs := &ev.VoiceState
|
||||||
if vs.ChannelID == 0 {
|
if vs.ChannelID == 0 {
|
||||||
if err := s.Store.VoiceStateRemove(vs.GuildID, vs.UserID); err != nil {
|
if err := s.Store.VoiceStateRemove(vs.GuildID, vs.UserID); err != nil {
|
||||||
s.stateErr(err, "Failed to remove voice state from state")
|
s.stateErr(err, "Failed to remove voice state from state")
|
||||||
|
|
Loading…
Reference in a new issue