Explorar o código

feat(cmd): add debug statement for unknown events

ayn2op hai 1 ano
pai
achega
ab78e85d1b
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      cmd/state.go

+ 6 - 0
cmd/state.go

@@ -2,6 +2,7 @@ package cmd
 
 import (
 	"context"
+	"fmt"
 	"log/slog"
 	"runtime"
 
@@ -38,6 +39,7 @@ func openState(token string) error {
 	}
 
 	// Handlers
+	discordState.AddHandler(discordState.onEvent)
 	discordState.AddHandler(discordState.onReady)
 	discordState.AddHandler(discordState.onMessageCreate)
 	discordState.AddHandler(discordState.onMessageDelete)
@@ -55,6 +57,10 @@ func (s *State) onRequest(r httpdriver.Request) error {
 	return nil
 }
 
+func (s *State) onEvent(event any) {
+	slog.Debug("new gateway event", "name", fmt.Sprintf("%T", event), "data", event)
+}
+
 func (s *State) onReady(r *gateway.ReadyEvent) {
 	root := app.guildsTree.GetRoot()
 	root.ClearChildren()