Force using a bot token.

pull/1/head
pocketjawa 2019-04-27 01:56:31 -04:00
parent 0c0204caa2
commit 944d6137d4
1 changed files with 7 additions and 3 deletions

View File

@ -12,11 +12,15 @@ import (
var Session, _ = discordgo.New()
var testPtr = flag.Bool("test", false, "Test mode")
var bot_token string
func init() {
Session.Token = os.Getenv("DISCORD_TOKEN")
if Session.Token == "" {
flag.StringVar(&Session.Token, "t", "", "Discord Authentication Token")
if os.Getenv("DISCORD_TOKEN") != "" {
Session.Token = "Bot " + os.Getenv("DISCORD_TOKEN")
} else {
flag.StringVar(&bot_token, "t", "", "Discord Authentication Token")
flag.Parse()
Session.Token = "Bot " + bot_token
}
}