Skip to content

Commit

Permalink
Change token flag to environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cyckl committed May 3, 2021
1 parent 02aeb00 commit 4365d32
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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},
},
},
Expand Down

0 comments on commit 4365d32

Please sign in to comment.