steamsalty/botIO/authenticate.go
Noah Theus 453f03d832
Some checks failed
Build and Push to Docker Hub on changes to master branch / docker (push) Has been cancelled
v0.3
- added start command
- added info command
2024-12-21 08:28:28 +01:00

24 lines
619 B
Go

package botIO
import (
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"github.com/rs/zerolog/log"
"watn3y/steamsalty/config"
)
func Authenticate() (tgbotapi.UpdatesChannel, *tgbotapi.BotAPI) {
bot, err := tgbotapi.NewBotAPI(config.BotConfig.TelegramAPIToken)
if err != nil {
log.Panic().Err(err).Msg("Failed to authenticate")
}
bot.Debug = config.BotConfig.DebugMode
updates := tgbotapi.NewUpdate(0)
updates.Timeout = 60
log.Info().Int64("ID", bot.Self.ID).Str("username", bot.Self.UserName).Msg("Successfully authenticated to Telegram API")
return bot.GetUpdatesChan(updates), bot
}