bump go version
This commit is contained in:
56
gottdad.go
Normal file
56
gottdad.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"time"
|
||||
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
var (
|
||||
cfg *Config
|
||||
srv *ServerTTD
|
||||
bot *Bot
|
||||
|
||||
configFlag = flag.String("config", "config.json", "config file")
|
||||
initFlag = flag.Bool("init", false, "init config")
|
||||
)
|
||||
|
||||
func main() {
|
||||
var err error
|
||||
|
||||
flag.Parse()
|
||||
|
||||
cfg = &Config{}
|
||||
if *initFlag {
|
||||
logInfoWarn("Initializing configuration..")
|
||||
err = cfg.Init()
|
||||
failError(err, "Cannot init config")
|
||||
err = cfg.Save(*configFlag)
|
||||
failError(err, "Cannot save config")
|
||||
} else {
|
||||
err = cfg.Load(*configFlag)
|
||||
failError(err, "Cannot open config")
|
||||
}
|
||||
|
||||
logInfoWarn("Starting up (%s) ...", version)
|
||||
|
||||
// Registering bot
|
||||
bot = &Bot{
|
||||
Config: cfg.Telegram,
|
||||
}
|
||||
go bot.Start()
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
srv = &ServerTTD{
|
||||
Config: cfg.Server,
|
||||
Data: &ServerDataTTD{},
|
||||
Status: &ServerStatusTTD{},
|
||||
}
|
||||
go srv.Start()
|
||||
|
||||
for {
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user