Registry /
messaging / go-telegram-bot-api-telegram-bot-api-v5
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
tgbotapi
✓ github.com/go-telegram-bot-api/telegram-bot-api/v5
Echo bot that replies with the same message.
package main
import (
"log"
"github.com/go-telegram-bot-api/telegram-bot-api/v5"
)
func main() {
bot, err := tgbotapi.NewBotAPI("YOUR_TOKEN")
if err != nil {
log.Panic(err)
}
u := tgbotapi.NewUpdate(0)
u.Timeout = 60
updates := bot.GetUpdatesChan(u)
for update := range updates {
if update.Message != nil {
msg := tgbotapi.NewMessage(update.Message.Chat.ID, update.Message.Text)
bot.Send(msg)
}
}
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
5.5.1latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.