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) }