From db704a87c75ce5f30a35cfb151629dfdd4f30655 Mon Sep 17 00:00:00 2001 From: VaiTon Date: Tue, 18 Jul 2023 22:58:13 +0200 Subject: [PATCH] Use environment for telegram TOKEN --- main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 874f7f9..0839bf5 100644 --- a/main.go +++ b/main.go @@ -7,9 +7,13 @@ import ( "github.com/csunibo/informabot/bot" ) +const tokenKey = "TOKEN" + func main() { - if len(os.Args) < 2 { - log.Fatalf("Usage: go run main.go ") + token, found := os.LookupEnv(tokenKey) + if !found { + log.Fatal("token not found. please set the TOKEN environment variable") } - bot.StartInformaBot(os.Args[1], false) + + bot.StartInformaBot(token, false) }