KickerBot/main.go

31 lines
485 B
Go
Raw Normal View History

2021-12-03 12:19:55 +03:00
package main
import (
"kickerbot/db"
"kickerbot/kicker"
2021-12-03 12:19:55 +03:00
"log"
"os"
"github.com/joho/godotenv"
2021-12-03 12:19:55 +03:00
)
func main() {
err := godotenv.Load()
if err != nil {
log.Print("Error loading .env file")
}
2021-12-03 12:19:55 +03:00
token, exists := os.LookupEnv("TOKEN")
if !exists {
log.Fatal("no token specified")
}
_, dberr := db.Init("mongodb://127.0.0.1:27017")
if dberr != nil {
log.Fatal(err)
}
2021-12-03 12:19:55 +03:00
2021-12-03 14:30:10 +03:00
Bot := kicker.Kicker{Token: token}
2021-12-03 12:19:55 +03:00
Bot.Init()
2021-12-03 14:30:10 +03:00
Bot.AddHandlers(kicker.HandlersV1)
2021-12-03 12:19:55 +03:00
Bot.Bot.Start()
}