{"id":36440320,"url":"https://github.com/alariczq/go-tgbot","last_synced_at":"2026-01-11T21:54:29.055Z","repository":{"id":40304072,"uuid":"491622352","full_name":"alariczq/go-tgbot","owner":"alariczq","description":"Quickly create telegram bots.","archived":false,"fork":false,"pushed_at":"2022-07-05T10:24:06.000Z","size":63,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-06T15:21:56.918Z","etag":null,"topics":["go","golang","telegram","telegram-bot","telegram-bot-api"],"latest_commit_sha":null,"homepage":"","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/alariczq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-12T18:15:46.000Z","updated_at":"2023-11-23T10:04:16.000Z","dependencies_parsed_at":"2022-08-09T16:52:05.219Z","dependency_job_id":null,"html_url":"https://github.com/alariczq/go-tgbot","commit_stats":null,"previous_names":["imzhongqi/tgbot","alariczq/go-tgbot"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/alariczq/go-tgbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alariczq%2Fgo-tgbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alariczq%2Fgo-tgbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alariczq%2Fgo-tgbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alariczq%2Fgo-tgbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alariczq","download_url":"https://codeload.github.com/alariczq/go-tgbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alariczq%2Fgo-tgbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28324419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T18:42:50.174Z","status":"ssl_error","status_checked_at":"2026-01-11T18:39:13.842Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["go","golang","telegram","telegram-bot","telegram-bot-api"],"created_at":"2026-01-11T21:54:28.417Z","updated_at":"2026-01-11T21:54:29.044Z","avatar_url":"https://github.com/alariczq.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-tgbot\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/imzhongqi/go-tgbot.svg)](https://pkg.go.dev/github.com/imzhongqi/go-tgbot)\n[![Go Report Card](https://goreportcard.com/badge/github.com/imzhongqi/go-tgbot)](https://goreportcard.com/report/github.com/imzhongqi/go-tgbot)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nWrapped [telegram-bot-api](https://github.com/go-telegram-bot-api/telegram-bot-api) to create telegram bot faster.\n\n## 1. Installation\n\nRun the following command under your project:\n\n```\ngo get -u github.com/imzhongqi/go-tgbot\n```\n\n## 2. Example\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"time\"\n\n\ttgbotapi \"github.com/go-telegram-bot-api/telegram-bot-api/v5\"\n\t\"github.com/imzhongqi/go-tgbot\"\n\t\"github.com/panjf2000/ants/v2\"\n)\n\nfunc main() {\n\tapi, err := tgbotapi.NewBotAPI(\"xxx\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpool, err := ants.NewPool(10000, ants.WithExpiryDuration(10*time.Second))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tbot := tgbot.NewBot(api,\n\t\ttgbot.WithTimeout(2*time.Second),\n\t\t\n\t\t// tgbot.WithWorkersNum(-1), // use can use unlimited workers.\n\t\t\n\t\ttgbot.WithWorkersPool(tgbot.NewAntsPool(pool)),\n\n\t\ttgbot.WithUpdatesHandler(func(ctx *tgbot.Context) {\n\t\t\terr := ctx.ReplyText(ctx.Message().Text, func(c *tgbotapi.MessageConfig) {\n\t\t\t\tc.ReplyToMessageID = ctx.Message().MessageID\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"reply text error: %s\", err)\n\t\t\t}\n\t\t}),\n\n\t\ttgbot.WithUndefinedCmdHandler(func(ctx *tgbot.Context) error {\n\t\t\treturn ctx.ReplyMarkdown(\"*unknown command*\", tgbot.WithDisableWebPagePreview(false))\n\t\t}),\n\n\t\ttgbot.WithErrorHandler(func(err error) {\n\t\t\tlog.Println(err)\n\t\t}),\n\t)\n\t\n\tbot.AddCommands(\n\t\ttgbot.NewCommand(\"ping\", \"ping the bot\", func(ctx *tgbot.Context) error {\n\t\t\treturn ctx.ReplyMarkdown(\"pong\")\n\t\t},\n\t\t\ttgbot.WithHide(true),\n\t\t\ttgbot.WithScopes(\n\t\t\t\ttgbot.CommandScopeDefault(),\n\t\t\t\ttgbot.CommandScopeAllGroupChats(),\n\t\t\t\ttgbot.CommandScopeChat(100),\n\t\t\t),\n\t\t),\n\t)\n\tif err := bot.Run(); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falariczq%2Fgo-tgbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falariczq%2Fgo-tgbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falariczq%2Fgo-tgbot/lists"}