Skip to content

Commit

Permalink
Change bot initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
bifidokk committed Apr 23, 2024
1 parent 606504e commit c5c74c2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/tgbot/tgbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ func Create() *tgbotapi.BotAPI {
webhookPath = config.GetEnv("webhook_path")
baseUrl := config.GetEnv("base_url")

go func() {
err := http.ListenAndServe(baseUrl, nil)
if err != nil {
panic(err)
}
}()

bot, err := tgbotapi.NewBotAPI(botToken)
if err != nil {
panic(err)
Expand All @@ -36,13 +43,6 @@ func Create() *tgbotapi.BotAPI {
log.Printf("Telegram callback failed: %s", info.LastErrorMessage)
}

go func() {
err := http.ListenAndServe(baseUrl, nil)
if err != nil {
panic(err)
}
}()

return bot
}

Expand Down

0 comments on commit c5c74c2

Please sign in to comment.