heruvym/internal/initialize/tg.go

22 lines
370 B
Go
Raw Permalink Normal View History

2024-09-25 14:22:57 +00:00
package initialize
import (
"gopkg.in/telebot.v3"
2024-09-25 14:22:57 +00:00
"time"
)
func NewTgBot(cfg Config) (*telebot.Bot, error) {
newBot, err := telebot.NewBot(telebot.Settings{
2024-12-02 12:12:52 +00:00
Token: cfg.TelegramToken,
2024-09-25 14:22:57 +00:00
Verbose: false,
ParseMode: telebot.ModeHTML,
Poller: &telebot.LongPoller{
2024-09-25 14:22:57 +00:00
Timeout: time.Second,
},
})
if err != nil {
return nil, err
}
return newBot, nil
}