-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (35 loc) · 795 Bytes
/
main.go
File metadata and controls
41 lines (35 loc) · 795 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 (
"fmt"
"os"
"os/signal"
"syscall"
"github.com/c0re100/RadioBot/config"
"github.com/c0re100/RadioBot/fb2k"
"github.com/c0re100/RadioBot/telegram"
"github.com/c0re100/RadioBot/web"
"github.com/c0re100/RadioBot/wrtc"
)
var (
version = "1.0.4"
)
func main() {
fmt.Printf("RadioBot v%v\n", version)
ch := make(chan os.Signal, 2)
signal.Notify(ch, os.Interrupt, syscall.SIGINT)
signal.Notify(ch, os.Interrupt, syscall.SIGKILL)
signal.Notify(ch, os.Interrupt, syscall.SIGTERM)
signal.Notify(ch, os.Interrupt, syscall.SIGQUIT)
signal.Notify(ch, os.Interrupt, syscall.SIGSEGV)
go func() {
<-ch
config.Save()
wrtc.Disconnect()
fmt.Println("Shutdown...")
os.Exit(0)
}()
config.Read()
go web.StartServer()
bot, _ := telegram.New()
fb2k.New(bot)
}