From 4365d320599b4b4d15f96df0ba259ffeda9ff811 Mon Sep 17 00:00:00 2001 From: cyckl Date: Mon, 3 May 2021 00:25:04 -0700 Subject: [PATCH] Change token flag to environment variable --- main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 67de25f..22e7a5b 100644 --- a/main.go +++ b/main.go @@ -14,10 +14,13 @@ import ( ) // Set global variables / boot information -const version = "3.0.0" +const ( + version = "3.0.1" + buildDate = "2021-05-03" +) var ( s *discordgo.Session - token = flag.String("t", "", "Bot token") + token = os.Getenv("TOKEN_TWEETER") register = flag.Bool("r", false, "Register (or re-register) bot commands on startup") unregister = flag.Bool("u", false, "Unregister bot commands on shutdown") ) @@ -72,7 +75,7 @@ func main() { // Create bot client session log.Println("[Info] Logging in") - s, err = discordgo.New("Bot " + *token) + s, err = discordgo.New("Bot " + token) if err != nil { log.Fatalf("[Fatal] Error creating session: %v", err) } @@ -184,7 +187,7 @@ func about(s *discordgo.Session, i *discordgo.InteractionCreate) { Fields: []*discordgo.MessageEmbedField{ {Name: "Version", Value: version, Inline: true}, - {Name: "Build date", Value: "2021-05-02", Inline: true}, + {Name: "Build date", Value: buildDate, Inline: true}, {Name: "Github", Value: "https://github.com/cyckl/tweeter", Inline: false}, }, },