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 Session, _ = discordgo.New()
var testPtr = flag.Bool("test", false, "Test mode") var testPtr = flag.Bool("test", false, "Test mode")
var bot_token string
func init() { func init() {
Session.Token = os.Getenv("DISCORD_TOKEN") if os.Getenv("DISCORD_TOKEN") != "" {
if Session.Token == "" { Session.Token = "Bot " + os.Getenv("DISCORD_TOKEN")
flag.StringVar(&Session.Token, "t", "", "Discord Authentication Token") } else {
flag.StringVar(&bot_token, "t", "", "Discord Authentication Token")
flag.Parse()
Session.Token = "Bot " + bot_token
} }
} }