Small refactor, Closing Discord Session in webserver
This commit is contained in:
@@ -585,7 +585,7 @@ func handleBotControlMessages(s *discordgo.Session, m *discordgo.MessageCreate,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setIdleStatus(s *discordgo.Session) {
|
func setIdleStatus() {
|
||||||
games := []string{
|
games := []string{
|
||||||
"Terranigma",
|
"Terranigma",
|
||||||
"Secret of Mana",
|
"Secret of Mana",
|
||||||
@@ -625,8 +625,8 @@ func setIdleStatus(s *discordgo.Session) {
|
|||||||
"R-Type",
|
"R-Type",
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
s.UpdateStreamingStatus(1, "", "")
|
discord.UpdateStreamingStatus(1, "", "")
|
||||||
s.UpdateStatus(0, games[randomRange(0, len(games))])
|
discord.UpdateStatus(0, games[randomRange(0, len(games))])
|
||||||
time.Sleep(time.Duration(randomRange(5, 15)) * time.Minute)
|
time.Sleep(time.Duration(randomRange(5, 15)) * time.Minute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -785,7 +785,7 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
go setIdleStatus(discord)
|
go setIdleStatus()
|
||||||
// We're running!
|
// We're running!
|
||||||
log.Info("Gidbig is ready. Quit with CTRL-C.")
|
log.Info("Gidbig is ready. Quit with CTRL-C.")
|
||||||
|
|
||||||
|
|||||||
@@ -128,5 +128,7 @@ func handlediscordCallback(w http.ResponseWriter, r *http.Request) {
|
|||||||
session.Values["accessToken"] = token.AccessToken
|
session.Values["accessToken"] = token.AccessToken
|
||||||
session.Save(r, w)
|
session.Save(r, w)
|
||||||
|
|
||||||
|
dg.Close()
|
||||||
|
|
||||||
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
|
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user