{"id":42583790,"url":"https://github.com/aliforever/go-telebot","last_synced_at":"2026-01-28T22:38:43.031Z","repository":{"id":135883277,"uuid":"415953775","full_name":"aliforever/go-telebot","owner":"aliforever","description":"Go Telegram Bot Framework. You can create a telegram bot with the most suitable convention in a few seconds!","archived":false,"fork":false,"pushed_at":"2025-10-31T18:16:20.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-31T20:21:07.610Z","etag":null,"topics":["bot","bot-framework","go","golang","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/aliforever.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-10-11T14:07:49.000Z","updated_at":"2025-10-31T18:16:24.000Z","dependencies_parsed_at":"2024-12-30T19:33:09.386Z","dependency_job_id":"77144be5-ddbc-4f83-bf1f-fda5828b1272","html_url":"https://github.com/aliforever/go-telebot","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/aliforever/go-telebot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliforever%2Fgo-telebot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliforever%2Fgo-telebot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliforever%2Fgo-telebot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliforever%2Fgo-telebot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aliforever","download_url":"https://codeload.github.com/aliforever/go-telebot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliforever%2Fgo-telebot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28853737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T15:15:36.453Z","status":"ssl_error","status_checked_at":"2026-01-28T15:15:13.020Z","response_time":57,"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":["bot","bot-framework","go","golang","telegram","telegram-bot"],"created_at":"2026-01-28T22:38:42.959Z","updated_at":"2026-01-28T22:38:43.026Z","avatar_url":"https://github.com/aliforever.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-telebot\n\n## Go Telegram Bot Framework \nMake and develop bots for telegram in a flash!\n\n## Install\n`go get -u github.com/aliforever/go-telebot`\n\n## Getting Started\n1. Create your `main.go` file in the project directory and import `_ github.com/aliforever/go-telebot` with underscore as alias (unused import) like:\n```go\npackage main\n\nimport (\n\t_ \"github.com/aliforever/go-telebot\" \n)\n\nfunc main() {\n}\n```\n2. Get your bot token by sending `/newbot` to [BotFather](https://t.me/botfather) on Telegram.\n3. Run this command in your project folder:\n`go run main.go --new=BOT_TOKEN_HERE`\n(Replace your token with BOT_TOKEN_HERE)\n4. Enjoy developing your bot!\n\n## Package Conventions\n- The concept of `State` is used for private chats. [Read Below this section]\n- Updates are divided to different handlers based on update types and each handler has its own file inside app package (eg: appprivate.go, appcallback.go)\n  - app.go is your structure. You can embed `tgbotapi.TelegramBot` there to have easier access to bot api methods and I recommend to keep it that way unless you prefer another way.\n  - appprivate.go file has 2 methods (`Welcome` \u0026 `Hello`) on the fly for welcoming users and responding hello to their hello! `Welcome` method should always be there for the bot to work. (This will change so you can use your own default method)\n\n- (Removing any of these methods will stop the bot from receiving the respected update types) 🔽🔽:\n  - appcallback.go contains `CallbackQueryHandler` method to handle callback queries.\n  - appchannel.go contains `ChannelPostHandler` method to handle updates of channels. \n  - appchatmember.go contains `ChatMemberHandler` for handling updates regarding a chat member's change. \n  - appmychatmember.go containts `MyChatMemberHandler` handles updates related to the bot's changes.\n  - appgroup.go containts `MessageTypeGroupHandler` which handles updates received from a group/supergroup.\n  - apppollanswer.go containts `PollAnswerHandler` handling the updates of a user's choice in a non-anonymous poll created by the bot.\n\n## `State` Concept\nThe key and magic component of the framework is this section! \n\nTo develop an advanced Telegram bot that is offering users a wide range of services that need users' interactions, there are only a few methods you can use for your bot's structure. I've been developing bots for more than 6 years now and this method has been my special recipe that I'm gonna share with you!\n\nFor private chats your users are going to communicate to your bot through menus, most menus are made of button and a text asking users to pick a button to process their response or move them to another menu. These menus describe the state of a user and each menu is going to have its own method inside your struct (default menus are put inside `appprivate.go` file). So if your user's state is `Welcome` it means that they are in `Welcome` menu of your bot and the method `app.App{}.Welcome` is going to handle their requests. \n\nYour `State` handler methods should have this signature:\n\n```go\nfunc (app App) StateName(update *tgbotapi.Update, isSwitched bool) (newState string) {}\n```\n  - The framework is going to pass the updates of private chats based on their states to their respected handlers and inside the handlers you'll have access to the update using the first argument: `update`.\n  - The second argument `isSwitched` is for when you're sending a user to another menu without processing their last sent text. It's for the next menu to be aware that there are no new updates from the user and the handler should ignore checking for them.\n  - There's going to be an output called `newState` for your handler in case you want send the user to another menu with `isSwitched` set to true by the framework. You can remove the output in case you don't want to switch their menu or just let it be without changing it's empty value. (`newState = \"\"`)\n\n## StateStorage\nThe framework has a built-in state storage storing the states of users inside a map and of course it's not recommended because it's temorary.\n\nYou can set your own storage and this is done by implementing the `StateStorage` interface:\n```go\ntype UserStateStorage interface {\n\tUserState(userId int64) (string, error)\n\tSetUserState(userId int64, state string) error\n}\n```\n\nAnd passing to to the framework by using the \n`bot.SetUserStateStorage(yourTypeImplementingTheInterface)`. \n\n## Logging\nThe framework is using `logrus` to log internal errors.\n\n## Why reflection?\nThe framework is using `reflect` package in the background to match states to their handlers as well as handling different types of updates. If you were to use `maps` you would have ended up with duplicate and more code. I think the trade-off seems logical in this case and using `reflect` is a necessary evil here.\n\n## Contibution\nTo help building telegram bots easier and more fun using `go-telebot`, you can open an issue or contact me on Telegram [@ali_error](https://t.me/ali_error)\n\n## Bots made by telebot\n[Taskilibot](https://t.me/taskilibot): A bot to manage your tasks\n\n[Linkulubot](https://t.me/linkulubot): A bot to convert telegram videos to direct download links\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliforever%2Fgo-telebot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliforever%2Fgo-telebot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliforever%2Fgo-telebot/lists"}