Skip to content

Commit

Permalink
Gateway: Added missing GuildCreateEvent handler
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Nov 2, 2020
1 parent a25250d commit 6509235
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions state/state_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 6509235

Please sign in to comment.