Fix global var redeclaration

This commit is contained in:
2023-12-24 15:50:03 -06:00
parent 4dce1de842
commit e7ef04ac42
2 changed files with 5 additions and 4 deletions

View File

@@ -58,13 +58,14 @@ func main() {
} }
baseURL = os.Getenv("BANNER_BASE_URL") baseURL = os.Getenv("BANNER_BASE_URL")
cookies, err := cookiejar.New(nil) var err error
cookies, err = cookiejar.New(nil)
if err != nil { if err != nil {
log.Err(err).Msg("Cannot create cookie jar") log.Err(err).Msg("Cannot create cookie jar")
} }
client = http.Client{Jar: cookies} client = http.Client{Jar: cookies}
setup(cookies) setup(&cookies)
session, err = discordgo.New("Bot " + os.Getenv("BOT_TOKEN")) session, err = discordgo.New("Bot " + os.Getenv("BOT_TOKEN"))
if err != nil { if err != nil {

View File

@@ -1,13 +1,13 @@
package main package main
import ( import (
"net/http/cookiejar" "net/http"
"net/url" "net/url"
log "github.com/rs/zerolog/log" log "github.com/rs/zerolog/log"
) )
func setup(cookies *cookiejar.Jar) { func setup(cookies *http.CookieJar) {
// Makes the initial requests that sets up the session cookies for the rest of the application // Makes the initial requests that sets up the session cookies for the rest of the application
log.Info().Msg("Setting up session...") log.Info().Msg("Setting up session...")