some cosmetics

This commit is contained in:
Von Random 2025-02-09 19:34:10 +02:00
parent d6d8b1a9a6
commit 4116625f9e

18
main.go
View file

@ -11,20 +11,26 @@ import (
"gopkg.in/telebot.v4" "gopkg.in/telebot.v4"
) )
type ConfigSpec struct { const (
Token string `yaml:"token"` confFile string = "config.yml"
cronFile string = "cron.yml"
matchFile string = "tokens.yml"
)
type configSpec struct {
TGToken string `yaml:"tg_bot_token"`
} }
func main() { func main() {
var conf ConfigSpec var conf configSpec
config.Parse("config.yml", &conf) config.Parse(confFile, &conf)
pref := telebot.Settings{ pref := telebot.Settings{
Token: conf.Token, Token: conf.TGToken,
Poller: &telebot.LongPoller{Timeout: 10 * time.Second}, Poller: &telebot.LongPoller{Timeout: 10 * time.Second},
} }
tokenMatcher := matcher.InitMatcher("tokens.yml") tokenMatcher := matcher.InitMatcher(matchFile)
bot, err := telebot.NewBot(pref) bot, err := telebot.NewBot(pref)
if err != nil { if err != nil {