-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (35 loc) · 700 Bytes
/
main.go
File metadata and controls
41 lines (35 loc) · 700 Bytes
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
package main
import (
"log"
"os"
"os/signal"
"syscall"
toml "github.com/BurntSushi/toml"
)
func main() {
var config CrossposterConfig
data, err := os.ReadFile("./config.toml")
if err != nil {
log.Printf(err.Error() + "\n")
return
}
err = toml.Unmarshal(data, &config)
if err != nil {
log.Printf(err.Error() + "\n")
return
}
cp, err := NewCrossposter(config)
if err != nil {
log.Printf(err.Error() + "\n")
return
}
go cp.Start()
log.Printf("Bot Started, send ^C to stop\n")
signalChan := make(chan os.Signal, 2)
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
for s := range signalChan {
log.Println("Received", s.String())
cp.Stop()
return
}
}