actually start http server

This commit is contained in:
2026-01-17 17:55:57 -05:00
parent 5909c36582
commit 667144d0ab

19
main.go
View File

@@ -85,12 +85,7 @@ func main() {
))
}
slog.Info("connect",
slog.String("disgo", disgo.Version),
slog.Bool("http", addr != ""),
slog.String("address", addr),
slog.String("route", route),
)
slog.Info("connect", slog.String("disgo", disgo.Version))
client, err := disgo.New(string(token), opts...)
if err != nil {
slog.Error("building bot", slog.Any("err", err))
@@ -102,11 +97,19 @@ func main() {
os.Exit(1)
}
if addr != "" {
slog.Info("start HTTP server", slog.String("address", addr), slog.String("route", route))
if err := client.OpenHTTPServer(); err != nil {
slog.Error("starting HTTP server", slog.Any("err", err))
stop()
}
}
slog.Info("start gateway")
if err := client.OpenGateway(ctx); err != nil {
slog.Error("opening gateway", slog.Any("err", err))
slog.Error("starting gateway", slog.Any("err", err))
stop()
}
slog.Info("running")
slog.Info("ready")
<-ctx.Done()
stop()