This commit is contained in:
SmileRex
2025-01-23 05:03:29 +03:00
parent 774ffe78fc
commit 97daedcb35
6 changed files with 39 additions and 33 deletions

23
main.go
View File

@@ -4,16 +4,33 @@ import (
"bot/src/controllers"
"bot/src/handlers"
"log"
"os"
"time"
tele "gopkg.in/telebot.v4"
"gopkg.in/yaml.v3"
)
var yourToken = "7757765456:AAFpFXhbi9XCfgRt7P3OT3F_jrBBplubWZA"
func config() controllers.Config {
file, err := os.Open("cfg.yml")
if err != nil {
log.Fatal(err)
}
defer file.Close()
// unmarshal the YAML data into a struct
var config controllers.Config
err = yaml.NewDecoder(file).Decode(&config)
if err != nil {
log.Fatal(err)
}
return config
}
func main() {
cfg := config()
pref := tele.Settings{
Token: yourToken,
Token: cfg.Token,
Poller: &tele.LongPoller{Timeout: 10 * time.Second},
}
@@ -23,7 +40,7 @@ func main() {
return
}
dc := controllers.NewDB()
dc := controllers.NewDB(cfg)
dataHandler := handlers.NewHandlers(dc)
duelController := controllers.NewDuel(b, dc)