{"id":13409500,"url":"https://github.com/go-telegram-bot-api/telegram-bot-api","last_synced_at":"2025-05-14T22:07:12.101Z","repository":{"id":34179816,"uuid":"38029983","full_name":"go-telegram-bot-api/telegram-bot-api","owner":"go-telegram-bot-api","description":"Golang bindings for the Telegram Bot API","archived":false,"fork":false,"pushed_at":"2024-08-14T05:51:15.000Z","size":5399,"stargazers_count":6124,"open_issues_count":165,"forks_count":946,"subscribers_count":87,"default_branch":"master","last_synced_at":"2025-05-07T21:59:23.011Z","etag":null,"topics":["golang","hacktoberfest","telegram"],"latest_commit_sha":null,"homepage":"https://go-telegram-bot-api.dev","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-telegram-bot-api.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-25T05:33:57.000Z","updated_at":"2025-05-07T20:38:30.000Z","dependencies_parsed_at":"2024-06-18T10:51:36.131Z","dependency_job_id":"e1f9e73c-05fa-4162-9714-8973184ea512","html_url":"https://github.com/go-telegram-bot-api/telegram-bot-api","commit_stats":{"total_commits":451,"total_committers":101,"mean_commits":4.465346534653466,"dds":0.7583148558758315,"last_synced_commit":"4126fa611266940425a9dfd37e0c92ba47881718"},"previous_names":["syfaro/telegram-bot-api","go-telegram/telegram-bot-api"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-telegram-bot-api%2Ftelegram-bot-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-telegram-bot-api%2Ftelegram-bot-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-telegram-bot-api%2Ftelegram-bot-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-telegram-bot-api%2Ftelegram-bot-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-telegram-bot-api","download_url":"https://codeload.github.com/go-telegram-bot-api/telegram-bot-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254179903,"owners_count":22027884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","hacktoberfest","telegram"],"created_at":"2024-07-30T20:01:01.420Z","updated_at":"2025-05-14T22:07:07.075Z","avatar_url":"https://github.com/go-telegram-bot-api.png","language":"Go","readme":"# Golang bindings for the Telegram Bot API\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/go-telegram-bot-api/telegram-bot-api/v5.svg)](https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api/v5)\n[![Test](https://github.com/go-telegram-bot-api/telegram-bot-api/actions/workflows/test.yml/badge.svg)](https://github.com/go-telegram-bot-api/telegram-bot-api/actions/workflows/test.yml)\n\nAll methods are fairly self-explanatory, and reading the [godoc](https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api/v5) page should\nexplain everything. If something isn't clear, open an issue or submit\na pull request.\n\nThere are more tutorials and high-level information on the website, [go-telegram-bot-api.dev](https://go-telegram-bot-api.dev).\n\nThe scope of this project is just to provide a wrapper around the API\nwithout any additional features. There are other projects for creating\nsomething with plugins and command handlers without having to design\nall that yourself.\n\nJoin [the development group](https://telegram.me/go_telegram_bot_api) if\nyou want to ask questions or discuss development.\n\n## Example\n\nFirst, ensure the library is installed and up to date by running\n`go get -u github.com/go-telegram-bot-api/telegram-bot-api/v5`.\n\nThis is a very simple bot that just displays any gotten updates,\nthen replies it to that chat.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\ttgbotapi \"github.com/go-telegram-bot-api/telegram-bot-api/v5\"\n)\n\nfunc main() {\n\tbot, err := tgbotapi.NewBotAPI(\"MyAwesomeBotToken\")\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tbot.Debug = true\n\n\tlog.Printf(\"Authorized on account %s\", bot.Self.UserName)\n\n\tu := tgbotapi.NewUpdate(0)\n\tu.Timeout = 60\n\n\tupdates := bot.GetUpdatesChan(u)\n\n\tfor update := range updates {\n\t\tif update.Message != nil { // If we got a message\n\t\t\tlog.Printf(\"[%s] %s\", update.Message.From.UserName, update.Message.Text)\n\n\t\t\tmsg := tgbotapi.NewMessage(update.Message.Chat.ID, update.Message.Text)\n\t\t\tmsg.ReplyToMessageID = update.Message.MessageID\n\n\t\t\tbot.Send(msg)\n\t\t}\n\t}\n}\n```\n\nIf you need to use webhooks (if you wish to run on Google App Engine),\nyou may use a slightly different method.\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/go-telegram-bot-api/telegram-bot-api/v5\"\n)\n\nfunc main() {\n\tbot, err := tgbotapi.NewBotAPI(\"MyAwesomeBotToken\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tbot.Debug = true\n\n\tlog.Printf(\"Authorized on account %s\", bot.Self.UserName)\n\n\twh, _ := tgbotapi.NewWebhookWithCert(\"https://www.example.com:8443/\"+bot.Token, \"cert.pem\")\n\n\t_, err = bot.Request(wh)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tinfo, err := bot.GetWebhookInfo()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif info.LastErrorDate != 0 {\n\t\tlog.Printf(\"Telegram callback failed: %s\", info.LastErrorMessage)\n\t}\n\n\tupdates := bot.ListenForWebhook(\"/\" + bot.Token)\n\tgo http.ListenAndServeTLS(\"0.0.0.0:8443\", \"cert.pem\", \"key.pem\", nil)\n\n\tfor update := range updates {\n\t\tlog.Printf(\"%+v\\n\", update)\n\t}\n}\n```\n\nIf you need, you may generate a self-signed certificate, as this requires\nHTTPS / TLS. The above example tells Telegram that this is your\ncertificate and that it should be trusted, even though it is not\nproperly signed.\n\n    openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3560 -subj \"//O=Org\\CN=Test\" -nodes\n\nNow that [Let's Encrypt](https://letsencrypt.org) is available,\nyou may wish to generate your free TLS certificate there.\n","funding_links":[],"categories":["Bot Building","Go","网络服务","Uncategorized","Telegram Libraries","Bot建设","Bots","Libraries"],"sub_categories":["网络服务_其他","Go","Free e-books","Bot Libs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-telegram-bot-api%2Ftelegram-bot-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-telegram-bot-api%2Ftelegram-bot-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-telegram-bot-api%2Ftelegram-bot-api/lists"}