forked from iliazeus/achievement-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (34 loc) · 794 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"log/slog"
"os"
"strconv"
// "crypto/tls"
// "net/http"
// "net/url"
_ "github.com/joho/godotenv/autoload"
)
func main() {
slog := slog.Default()
// proxyUrl, _ := url.Parse("http://127.0.0.1:8080")
// http.DefaultClient.Transport = &http.Transport{Proxy: http.ProxyURL(proxyUrl), TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}
botToken := os.Getenv("TELEGRAM_BOT_TOKEN")
if botToken == "" {
slog.Error("TELEGRAM_BOT_TOKEN not set")
os.Exit(1)
}
var tempChatId int
{
val, err := strconv.Atoi(os.Getenv("TELEGRAM_TEMP_CHAT_ID"))
if err != nil {
slog.Error("TELEGRAM_TEMP_CHAT_ID not set")
os.Exit(1)
}
tempChatId = val
}
err := run(slog, botToken, tempChatId)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
}