some cosmetics
This commit is contained in:
parent
d6d8b1a9a6
commit
4116625f9e
1 changed files with 12 additions and 6 deletions
18
main.go
18
main.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue