|
@@ -2,6 +2,7 @@ package cmd
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"context"
|
|
"context"
|
|
|
|
|
+ "fmt"
|
|
|
"log/slog"
|
|
"log/slog"
|
|
|
"runtime"
|
|
"runtime"
|
|
|
|
|
|
|
@@ -38,6 +39,7 @@ func openState(token string) error {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Handlers
|
|
// Handlers
|
|
|
|
|
+ discordState.AddHandler(discordState.onEvent)
|
|
|
discordState.AddHandler(discordState.onReady)
|
|
discordState.AddHandler(discordState.onReady)
|
|
|
discordState.AddHandler(discordState.onMessageCreate)
|
|
discordState.AddHandler(discordState.onMessageCreate)
|
|
|
discordState.AddHandler(discordState.onMessageDelete)
|
|
discordState.AddHandler(discordState.onMessageDelete)
|
|
@@ -55,6 +57,10 @@ func (s *State) onRequest(r httpdriver.Request) error {
|
|
|
return nil
|
|
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) {
|
|
func (s *State) onReady(r *gateway.ReadyEvent) {
|
|
|
root := app.guildsTree.GetRoot()
|
|
root := app.guildsTree.GetRoot()
|
|
|
root.ClearChildren()
|
|
root.ClearChildren()
|