{"id":37201222,"url":"https://github.com/ermanimer/telegram_bot","last_synced_at":"2026-01-14T23:12:08.821Z","repository":{"id":52808684,"uuid":"304546119","full_name":"ermanimer/telegram_bot","owner":"ermanimer","description":"Go Telegram Bot","archived":false,"fork":false,"pushed_at":"2022-08-12T16:01:36.000Z","size":98,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-21T15:43:26.953Z","etag":null,"topics":["telegram","telegram-bot"],"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/ermanimer.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":"2020-10-16T07:01:07.000Z","updated_at":"2023-09-20T21:32:32.000Z","dependencies_parsed_at":"2022-08-23T07:20:15.121Z","dependency_job_id":null,"html_url":"https://github.com/ermanimer/telegram_bot","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ermanimer/telegram_bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermanimer%2Ftelegram_bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermanimer%2Ftelegram_bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermanimer%2Ftelegram_bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermanimer%2Ftelegram_bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ermanimer","download_url":"https://codeload.github.com/ermanimer/telegram_bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermanimer%2Ftelegram_bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"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":["telegram","telegram-bot"],"created_at":"2026-01-14T23:12:08.133Z","updated_at":"2026-01-14T23:12:08.756Z","avatar_url":"https://github.com/ermanimer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# telegram_bot\n\n![Go](https://github.com/ermanimer/telegram_bot/workflows/Go/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ermanimer/telegram_bot)](https://goreportcard.com/report/github.com/ermanimer/telegram_bot)\n\nGo Telegram Bot\n\n## Features\ntelegram_bot gets updates of telegram bot, sends message to telegram bot's chats.\n\n## Telegram Bots\nTelegram bots can be created with [botfather](https://t.me/botfather).\n\n## Sample Application\nSample application creates and starts a bot. Listens bot's updates. Sends \"hello\" message for every \"/start\" message.\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/signal\"\n\t\"time\"\n\n\t\"github.com/ermanimer/telegram_bot/v2\"\n)\n\n//provide your own token\nconst (\n\ttoken    = \"...\"\n\tinterval = 2 * time.Second\n\ttimeout  = 10 * time.Second\n)\n\nfunc main() {\n\t//create new bot\n\tb := telegram_bot.New(token, interval, timeout)\n\t//create channel for interupt signal\n\tis := make(chan os.Signal, 1)\n\tsignal.Notify(is, os.Interrupt)\n\t//create done channel\n\td := make(chan struct{})\n\t//start bot and listen bot's updates\n\tgo func() {\n\t\tb.Start()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase u := \u003c-b.Updates:\n\t\t\t\t//check if updates are ok\n\t\t\t\tif !u.Ok {\n\t\t\t\t\tlog.Println(\"updates are not ok\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t//check if there is new updates\n\t\t\t\tif len(u.Result) == 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t//say hello when \"/start\" message is received\n\t\t\t\tfor _, r := range u.Result {\n\t\t\t\t\tif r.Message.Text == \"/start\" {\n\t\t\t\t\t\t_, err := b.SendMessage(r.Message.Chat.ID, \"hello\")\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Printf(\"sending message failed: %s\", err.Error())\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase err := \u003c-b.Error:\n\t\t\t\t//log error\n\t\t\t\tlog.Printf(\"getting updates failed: %s\", err.Error())\n\t\t\tcase \u003c-d:\n\t\t\t\t//end goroutine\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\t//wait for interupt signal\n\t\u003c-is\n\t//stop bot\n\tb.Stop()\n\t//close channels\n\tclose(is)\n\tclose(d)\n}\n```\n\n## UpdatesResponse\n```go\ntype UpdatesResponse struct {\n\tOk     bool `json:\"ok\"`\n\tResult []struct {\n\t\tUpdateID int `json:\"update_id\"`\n\t\tMessage  struct {\n\t\t\tMessageID int `json:\"message_id\"`\n\t\t\tFrom      struct {\n\t\t\t\tID           int    `json:\"id\"`\n\t\t\t\tIsBot        bool   `json:\"is_bot\"`\n\t\t\t\tFirstName    string `json:\"first_name\"`\n\t\t\t\tLastName     string `json:\"last_name\"`\n\t\t\t\tLanguageCode string `json:\"language_code\"`\n\t\t\t} `json:\"from\"`\n\t\t\tChat struct {\n\t\t\t\tID        int    `json:\"id\"`\n\t\t\t\tFirstName string `json:\"first_name\"`\n\t\t\t\tLastName  string `json:\"last_name\"`\n\t\t\t\tType      string `json:\"type\"`\n\t\t\t} `json:\"chat\"`\n\t\t\tDate     int    `json:\"date\"`\n\t\t\tText     string `json:\"text\"`\n\t\t\tEntities []struct {\n\t\t\t\tOffset int    `json:\"offset\"`\n\t\t\t\tLength int    `json:\"length\"`\n\t\t\t\tType   string `json:\"type\"`\n\t\t\t} `json:\"entities\"`\n\t\t} `json:\"message\"`\n\t} `json:\"result\"`\n\tErrorCode   int    `json:\"error_code\"`\n\tDescription string `json:\"description\"`\n}\n```\n\n## SendMessageResponse\n```go\ntype MessageResponse struct {\n\tOk     bool `json:\"ok\"`\n\tResult struct {\n\t\tMessageID int `json:\"message_id\"`\n\t\tFrom      struct {\n\t\t\tID        int    `json:\"id\"`\n\t\t\tIsBot     bool   `json:\"is_bot\"`\n\t\t\tFirstName string `json:\"first_name\"`\n\t\t\tUsername  string `json:\"username\"`\n\t\t} `json:\"from\"`\n\t\tChat struct {\n\t\t\tID        int    `json:\"id\"`\n\t\t\tFirstName string `json:\"first_name\"`\n\t\t\tLastName  string `json:\"last_name\"`\n\t\t\tType      string `json:\"type\"`\n\t\t} `json:\"chat\"`\n\t\tDate int    `json:\"date\"`\n\t\tText string `json:\"text\"`\n\t} `json:\"result\"`\n\tErrorCode   int    `json:\"error_code\"`\n\tDescription string `json:\"description\"`\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fermanimer%2Ftelegram_bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fermanimer%2Ftelegram_bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fermanimer%2Ftelegram_bot/lists"}