1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-01-09 13:37:02 +00:00

Gateway: Added missing GuildCreateEvent handler

This commit is contained in:
diamondburned 2020-11-01 18:58:03 -08:00
parent a25250d959
commit 65092354c0

View file

@ -69,7 +69,7 @@ func (s *State) onEvent(iface interface{}) {
// Handle guilds // Handle guilds
for i := range ev.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 // Handle private channels
@ -84,6 +84,9 @@ func (s *State) onEvent(iface interface{}) {
s.stateErr(err, "failed to set self in state") s.stateErr(err, "failed to set self in state")
} }
case *gateway.GuildCreateEvent:
s.batchLog(storeGuildCreate(s.Store, ev))
case *gateway.GuildUpdateEvent: case *gateway.GuildUpdateEvent:
if err := s.Store.GuildSet(ev.Guild); err != nil { if err := s.Store.GuildSet(ev.Guild); err != nil {
s.stateErr(err, "failed to update guild in state") 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) { func (s *State) stateErr(err error, wrap string) {
s.StateLog(errors.Wrap(err, wrap)) s.StateLog(errors.Wrap(err, wrap))
} }
func (s *State) batchLog(errors ...error) { func (s *State) batchLog(errors []error) {
for _, err := range errors { for _, err := range errors {
s.StateLog(err) s.StateLog(err)
} }