blob: 0f241c9ba1339cae54c95343c0c82ec7c2e5c997 (
plain)
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
|
package main
import (
"jinx/pkg/bot"
"log"
"os"
"os/signal"
"syscall"
)
func main() {
token := os.Getenv("BOT_TOKEN")
if token == "" {
log.Fatal("`BOT_TOKEN` is not set.")
}
b, err := bot.Start(token)
if err != nil {
panic(err)
}
c := make(chan os.Signal, 2)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
s := <-c
log.Printf("received signal: %s! stopping...", s)
if err := b.Stop(); err != nil {
panic(err)
}
}
|