KickerBot/main.go

33 lines
523 B
Go
Raw Normal View History

2021-12-03 12:19:55 +03:00
package main
import (
2022-01-28 01:00:40 +03:00
"kickerbot/captchagen"
"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()
2022-01-28 16:52:26 +03:00
captchagen.Init()
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")
}
2021-12-07 01:18:44 +03:00
_, dberr := db.Init(os.Getenv("MONGO_URI"))
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()
}