-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathescarbot.go
More file actions
52 lines (42 loc) · 1.05 KB
/
escarbot.go
File metadata and controls
52 lines (42 loc) · 1.05 KB
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
43
44
45
46
47
48
49
50
51
52
package main
import (
"log"
"os"
"github.com/birabittoh/escarbot/telegram"
"github.com/birabittoh/escarbot/webui"
"github.com/joho/godotenv"
)
func main() {
err := godotenv.Load()
if err != nil {
log.Println("No .env file provided.")
}
botToken := os.Getenv("BOT_TOKEN")
if botToken == "" {
log.Fatal("Please set up your BOT_TOKEN in .env!")
}
channelId := os.Getenv("CHANNEL_ID")
if channelId == "" {
log.Fatal("Please set up your CHANNEL_ID in .env!")
}
groupId := os.Getenv("GROUP_ID")
if groupId == "" {
log.Fatal("Please set up your GROUP_ID in .env!")
}
adminId := os.Getenv("ADMIN_ID")
if adminId == "" {
log.Fatal("Please set up your ADMIN_ID in .env!")
}
logChannelId := os.Getenv("LOG_CHANNEL_ID")
if logChannelId == "" {
log.Fatal("Please set up your LOG_CHANNEL_ID in .env!")
}
port := os.Getenv("PORT")
if port == "" {
log.Println("PORT not set in .env! Defaulting to 3000.")
port = "3000"
}
bot := telegram.NewBot(botToken, channelId, groupId, adminId, logChannelId)
ui := webui.NewWebUI(port, bot)
ui.Poll()
}