2021-12-03 12:19:55 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-01-28 01:00:40 +03:00
|
|
|
"kickerbot/captchagen"
|
2021-12-06 11:46:11 +03:00
|
|
|
"kickerbot/db"
|
|
|
|
"kickerbot/kicker"
|
2021-12-03 12:19:55 +03:00
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
|
2021-12-06 11:46:11 +03:00
|
|
|
"github.com/joho/godotenv"
|
2021-12-03 12:19:55 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2021-12-06 11:46:11 +03:00
|
|
|
err := godotenv.Load()
|
2022-01-28 16:52:26 +03:00
|
|
|
captchagen.Init()
|
2021-12-06 11:46:11 +03:00
|
|
|
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"))
|
2021-12-06 11:46:11 +03:00
|
|
|
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()
|
|
|
|
}
|