-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
51 lines (42 loc) · 1.02 KB
/
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
43
44
45
46
47
48
49
50
51
package main
import (
"carousell-gobot/carousell"
"carousell-gobot/data/config"
"carousell-gobot/data/state"
"carousell-gobot/messaging"
"flag"
"log"
"os"
)
var debug = os.Getenv("DEBUG") == "1"
//nolint:funlen,gocognit
func main() {
var configPath string
var statePath string
flag.StringVar(&configPath, "c", "config.yaml", "path to config file")
flag.StringVar(&statePath, "s", "state.json", "path to state file")
flag.Parse()
if debug {
log.Println("DEBUG MODE ACTIVE!")
}
log.Println("loading config...")
err := config.Load(configPath)
if err != nil {
log.Fatalln(err)
}
log.Println("config loaded")
log.Println("loading state...")
err = state.Load(statePath)
if err != nil {
log.Fatalln(err)
}
log.Println("state loaded")
log.Println("loading forwarders...")
messaging.LoadForwarders()
log.Println("forwarders loaded")
log.Println("initiating reminders system")
carousell.InitReminders()
log.Println("reminder system initiated")
log.Println("connecting to chat...")
_ = carousell.Connect()
}