package main import ( "kickerbot/captchagen" "kickerbot/kicker" "log" "os" "time" "git.nefrace.ru/nefrace/tongo" "github.com/NicoNex/echotron/v3" "github.com/go-co-op/gocron" "github.com/joho/godotenv" ) var client *tongo.Database func main() { err := godotenv.Load() captchagen.Init() if err != nil { log.Print("Error loading .env file") } token, exists := os.LookupEnv("TOKEN") if !exists { log.Fatal("no token specified") } client, err = tongo.NewConnection(os.Getenv("MONGO_URI"), "godotkicker") // _, dberr := db.Init(os.Getenv("MONGO_URI")) if err != nil { log.Fatal(err) } kicker.Client = client Bot := kicker.Kicker{Token: token} Bot.Init() scheduler := gocron.NewScheduler(time.UTC) tasker := echotron.NewAPI(token) scheduler.Every(30).Seconds().Do(func() { kicker.TaskKickOldUsers(&tasker) }) scheduler.Every(30).Seconds().Do(func() { kicker.TaskNotifyUsers(&tasker) }) scheduler.Every(2).Minutes().Do(func() { kicker.TaskRemoveOldMutes(&tasker) }) scheduler.StartAsync() Bot.Start() }