move various functions out of onConnect function so they don't trigger again on each reconnect

This commit is contained in:
lyx0 2023-12-13 12:53:04 +01:00
parent b3bc8048cd
commit d760c0bcb7

View file

@ -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