22 lines
370 B
Go
22 lines
370 B
Go
package initialize
|
|
|
|
import (
|
|
"gopkg.in/telebot.v3"
|
|
"time"
|
|
)
|
|
|
|
func NewTgBot(cfg Config) (*telebot.Bot, error) {
|
|
newBot, err := telebot.NewBot(telebot.Settings{
|
|
Token: cfg.TelegramToken,
|
|
Verbose: false,
|
|
ParseMode: telebot.ModeHTML,
|
|
Poller: &telebot.LongPoller{
|
|
Timeout: time.Second,
|
|
},
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return newBot, nil
|
|
}
|