From 615b52de5775edc7ea97869d6f92868c8d9e55e9 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Sun, 1 Nov 2020 18:58:03 -0800 Subject: [PATCH] Gateway: Added missing GuildCreateEvent handler --- state/state_events.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/state/state_events.go b/state/state_events.go index 1dbff01..cb389fb 100644 --- a/state/state_events.go +++ b/state/state_events.go @@ -69,7 +69,7 @@ func (s *State) onEvent(iface interface{}) { // Handle guilds for i := range ev.Guilds { - s.batchLog(storeGuildCreate(s.Store, &ev.Guilds[i])...) + s.batchLog(storeGuildCreate(s.Store, &ev.Guilds[i])) } // Handle private channels @@ -84,6 +84,9 @@ func (s *State) onEvent(iface interface{}) { s.stateErr(err, "failed to set self in state") } + case *gateway.GuildCreateEvent: + s.batchLog(storeGuildCreate(s.Store, ev)) + case *gateway.GuildUpdateEvent: if err := s.Store.GuildSet(ev.Guild); err != nil { s.stateErr(err, "failed to update guild in state") @@ -299,7 +302,7 @@ func (s *State) onEvent(iface interface{}) { func (s *State) stateErr(err error, wrap string) { s.StateLog(errors.Wrap(err, wrap)) } -func (s *State) batchLog(errors ...error) { +func (s *State) batchLog(errors []error) { for _, err := range errors { s.StateLog(err) }