From d760c0bcb7d60b6a2d2bca5cfd0e060d80ef59cc Mon Sep 17 00:00:00 2001 From: lyx0 <66651385+lyx0@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:53:04 +0100 Subject: [PATCH] move various functions out of onConnect function so they don't trigger again on each reconnect --- cmd/nourybot/main.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/nourybot/main.go b/cmd/nourybot/main.go index a330dcf..afbff15 100644 --- a/cmd/nourybot/main.go +++ b/cmd/nourybot/main.go @@ -59,6 +59,8 @@ func main() { }() sugar := logger.Sugar() + common.StartTime() + err := godotenv.Load() if err != nil { sugar.Fatal("Error loading .env") @@ -174,9 +176,14 @@ func main() { }) - app.TwitchClient.OnConnect(func() { - common.StartTime() + app.InitialJoin() + // Load the initial timers from the database. + app.InitialTimers() + // Start the timers. + app.Scheduler.Start() + + app.TwitchClient.OnConnect(func() { app.TwitchClient.Say("nouryxd", "gopherDance") app.TwitchClient.Say("nourybot", "gopherDance") app.TwitchClient.Say("xnoury", "alienPls") @@ -193,13 +200,6 @@ func main() { "Helix", helixResp, ) - app.InitialJoin() - // Load the initial timers from the database. - app.InitialTimers() - - // Start the timers. - app.Scheduler.Start() - }) // Start status page