added proper logging to most of the code
This commit is contained in:
parent
65c6020e49
commit
7d4c9c5ab9
21 changed files with 218 additions and 283 deletions
|
@ -2,7 +2,7 @@ package botIO
|
|||
|
||||
import (
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"log"
|
||||
"github.com/rs/zerolog/log"
|
||||
"watn3y/bloaterbotv3/config"
|
||||
)
|
||||
|
||||
|
@ -11,14 +11,15 @@ func Authenticate() (tgbotapi.UpdatesChannel, *tgbotapi.BotAPI) {
|
|||
b, err := tgbotapi.NewBotAPI(config.BotConfig.APIToken)
|
||||
|
||||
if err != nil {
|
||||
log.Panicf("Failed to connect Bot to Telegram: %v\n", err)
|
||||
log.Panic().Err(err).Msg("Failed to authorize bot")
|
||||
}
|
||||
|
||||
b.Debug = config.BotConfig.DebugMode
|
||||
|
||||
u := tgbotapi.NewUpdate(0)
|
||||
u.Timeout = 60
|
||||
log.Printf("[bot] Authorized on account %s", b.Self.UserName)
|
||||
|
||||
log.Info().Int64("ID", b.Self.ID).Str("username", b.Self.UserName).Msg("Successfully authorized bot")
|
||||
|
||||
return b.GetUpdatesChan(u), b
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue