From 40a61dab9882820e5f0a51b5ec0b70f214cfd7c8 Mon Sep 17 00:00:00 2001 From: mavolin <48887425+mavolin@users.noreply.github.com> Date: Tue, 12 May 2020 05:06:28 +0200 Subject: [PATCH] State: resolve errors --- state/state_events.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/state/state_events.go b/state/state_events.go index 739d3bd..e8dfe34 100644 --- a/state/state_events.go +++ b/state/state_events.go @@ -224,8 +224,7 @@ func (s *State) onEvent(iface interface{}) { }) case *gateway.PresenceUpdateEvent: - presence := (*discord.Presence)(ev) - if err := s.Store.PresenceSet(ev.GuildID, presence); err != nil { + if err := s.Store.PresenceSet(ev.GuildID, &ev.Presence); err != nil { s.stateErr(err, "Failed to update presence in state") } @@ -243,23 +242,23 @@ func (s *State) onEvent(iface interface{}) { case *gateway.UserGuildSettingsUpdateEvent: for i, ugs := range s.Ready.UserGuildSettings { if ugs.GuildID == ev.GuildID { - s.Ready.UserGuildSettings[i] = gateway.UserGuildSettings(*ev) + s.Ready.UserGuildSettings[i] = ev.UserGuildSettings } } case *gateway.UserSettingsUpdateEvent: - s.Ready.Settings = (*gateway.UserSettings)(ev) + s.Ready.Settings = &ev.UserSettings case *gateway.UserNoteUpdateEvent: s.Ready.Notes[ev.ID] = ev.Note 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") } case *gateway.VoiceStateUpdateEvent: - vs := (*discord.VoiceState)(ev) + vs := &ev.VoiceState if vs.ChannelID == 0 { if err := s.Store.VoiceStateRemove(vs.GuildID, vs.UserID); err != nil { s.stateErr(err, "Failed to remove voice state from state")