DB640/cmd/db640bot/main.go

34 lines
602 B
Go
Raw Normal View History

2020-03-23 22:56:41 +00:00
package main
import (
"flag"
"log"
2020-03-24 14:50:49 +00:00
"os"
"os/signal"
2020-03-23 22:56:41 +00:00
2020-03-26 17:11:12 +00:00
"git.1750studios.com/ToddShepard/DB640/internal/bot"
2020-03-23 22:56:41 +00:00
"git.1750studios.com/ToddShepard/DB640/internal/config"
2020-04-11 02:56:21 +00:00
"git.1750studios.com/ToddShepard/DB640/internal/database"
2020-04-05 20:06:15 +00:00
"git.1750studios.com/ToddShepard/DB640/internal/web"
2020-03-23 22:56:41 +00:00
)
func main() {
cfg := flag.String("c", "", "Config file")
flag.Parse()
if *cfg == "" {
log.Fatalf("Config file must not be empty!")
}
config.LoadConfig(*cfg)
2020-04-11 02:56:21 +00:00
database.Init()
2020-03-26 17:11:12 +00:00
bot.Init()
2020-04-05 20:06:15 +00:00
web.Init()
2020-03-23 22:56:41 +00:00
2020-03-24 14:50:49 +00:00
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
<-c
2020-03-23 22:56:41 +00:00
2020-03-26 17:11:12 +00:00
bot.DeInit()
2020-03-24 14:50:49 +00:00
config.WriteConfig(*cfg)
2020-03-23 22:56:41 +00:00
}