doomer/main.go

26 lines
473 B
Go

package main
import (
"flag"
"log"
)
func main() {
db, err := NewDatabase()
if err != nil {
log.Fatalf("Cant open database: %v", err)
}
defer db.Close()
doomer := NewDoomer()
token := flag.String("token", "", "Telegram Bot API Token")
host := flag.String("host", ":3000", "Web server host ip:port")
flag.Parse()
dp := NewDispatcher(*token, doomer, db)
server := CreateServer(db)
go func() {
log.Fatal(server.Start(*host))
}()
log.Println(dp.Poll())
}