{"id":21177835,"url":"https://github.com/amarnathcjd/gogram","last_synced_at":"2025-07-09T22:30:53.433Z","repository":{"id":52890214,"uuid":"475367000","full_name":"AmarnathCJD/gogram","owner":"AmarnathCJD","description":"Full-native implementation of MTProto protocol on Golang.","archived":false,"fork":false,"pushed_at":"2025-06-29T07:53:52.000Z","size":2495,"stargazers_count":319,"open_issues_count":2,"forks_count":64,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-06-30T23:41:20.860Z","etag":null,"topics":["awesome","botapi","client","go","gogram","golang","hacktoberfest","hacktoberfest-accepted","hacktoberfest2023","mtproto","mtproxy","tdlib","tdlib-go","telegram","telegram-api","telegram-mtproto","tg","userbot","userbot-go"],"latest_commit_sha":null,"homepage":"https://gogram.fun","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AmarnathCJD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"amarnathcjd","buy_me_a_coffee":"amarnathcjd"}},"created_at":"2022-03-29T09:16:20.000Z","updated_at":"2025-06-29T07:53:56.000Z","dependencies_parsed_at":"2023-12-25T20:01:27.413Z","dependency_job_id":"c1de2eb2-4a01-43b1-b063-f53c180f5aa5","html_url":"https://github.com/AmarnathCJD/gogram","commit_stats":null,"previous_names":["amarnathcjd/gogr"],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/AmarnathCJD/gogram","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmarnathCJD%2Fgogram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmarnathCJD%2Fgogram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmarnathCJD%2Fgogram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmarnathCJD%2Fgogram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AmarnathCJD","download_url":"https://codeload.github.com/AmarnathCJD/gogram/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmarnathCJD%2Fgogram/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264504574,"owners_count":23618825,"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":["awesome","botapi","client","go","gogram","golang","hacktoberfest","hacktoberfest-accepted","hacktoberfest2023","mtproto","mtproxy","tdlib","tdlib-go","telegram","telegram-api","telegram-mtproto","tg","userbot","userbot-go"],"created_at":"2024-11-20T17:18:28.382Z","updated_at":"2025-07-09T22:30:53.414Z","avatar_url":"https://github.com/AmarnathCJD.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/amarnathcjd/gogram\"\u003e\n        \u003cimg src=\"https://i.imgur.com/RE1M0sM.png\" alt=\"Gogram\" width=\"256\"\u003e\n    \u003c/a\u003e\n    \u003cbr\u003e\n    \u003cb\u003emodern golang library for mtproto\u003c/b\u003e\n    \u003cbr\u003e\n    \u003cb\u003e\n    \u003ca href=\"https://gogramdoc.vercel.app\"\u003edocumentation\u003c/a\u003e\n    \u0026nbsp;•\u0026nbsp;\n    \u003ca href=\"https://github.com/amarnathcjd/gogram/releases\"\u003ereleases\u003c/a\u003e\n    \u0026nbsp;•\u0026nbsp;\n    \u003ca href=\"https://t.me/rosexchat\"\u003etelegram chat\u003c/a\u003e\n    \u003c/b\u003e\n\u003c/p\u003e\n\n\u003cdiv align='center'\u003e\n\t\n[![GoDoc](https://godoc.org/github.com/amarnathcjd/gogram?status.svg)](https://godoc.org/github.com/amarnathcjd/gogram)\n[![Go Report Card](https://goreportcard.com/badge/github.com/amarnathcjd/gogram)](https://goreportcard.com/report/github.com/amarnathcjd/gogram)\n[![License](https://img.shields.io/github/license/amarnathcjd/gogram.svg)](https://img.shields.io/github/license/amarnathcjd/gogram.svg)\n[![GitHub stars](https://img.shields.io/github/stars/amarnathcjd/gogram.svg?style=social\u0026label=Stars)](https://img.shields.io/github/stars/amarnathcjd/gogram.svg?style=social\u0026label=Stars)\n[![GitHub forks](https://img.shields.io/github/forks/amarnathcjd/gogram.svg?style=social\u0026label=Fork)](https://img.shields.io/github/forks/amarnathcjd/gogram.svg?style=social\u0026label=Fork)\n\n\u003c/div\u003e\n\n\u003cdiv align='center'\u003e\n\t\u003cimg src=\"https://count.getloli.com/get/@gogram-amarnathcdj?theme=moebooru\" alt=\"Counter\" /\u003e\n\u003c/div\u003e\n\n\n\u003cbr\u003e\n\n\u003cp\u003e⭐️ \u003cb\u003eGogram\u003c/b\u003e is a modern, elegant and concurrent \u003cb\u003e\u003ca href='https://core.telegram.org/api'\u003eMTProto API\u003c/a\u003e\u003c/b\u003e\nframework. It enables you to easily interact with the main Telegram API through a user account (custom client) or a bot\nidentity (bot API alternative) using Go.\u003c/p\u003e\n\u003cbr\u003e\n\n\u003e Gogram is currently in its stable release stage. While there may still be a few bugs, feel free to use it and provide feedback if you encounter any issues or rough edges. 😊\n\n## setup\n\n\u003cp\u003eplease note that gogram requires Go \u003cb\u003e1.18\u003c/b\u003e or later to support go-generics\u003c/p\u003e\n\n```bash\ngo get -u github.com/amarnathcjd/gogram/telegram\n```\n\n## quick start\n\n```golang\npackage main\n\nimport \"github.com/amarnathcjd/gogram/telegram\"\n\nfunc main() {\n\tclient, err := telegram.NewClient(telegram.ClientConfig{\n\t\tAppID: 6, AppHash: \"\u003capp-hash\u003e\",\n\t})\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tclient.Conn()\n\n\tclient.LoginBot(\"\u003cbot-token\u003e\") // or client.Login(\"\u003cphone-number\u003e\") for user account, or client.AuthPrompt() for interactive login\n\n\tclient.On(telegram.OnMessage, func(message *telegram.NewMessage) error { // client.AddMessageHandler\n\t\t\tmessage.Reply(\"Hello from Gogram!\")\n        \t\treturn nil\n\t}, telegram.FilterPrivate) // waits for private messages only\n\n\tclient.Idle() // block main goroutine until client is closed\n}\n```\n\n- **[sample modular bot](https://github.com/AmarnathCJD/JuliaBot.git)**: a simple modular bot built using gogram with plugins support.\n- **Try out Live Demo** at **[JuliaBot](https://t.me/rustyDbot)**. \n\n## support dev\n\nIf you'd like to support Gogram, you can consider:\n\n- \u003cb\u003e\u003ca href=\"https://github.com/sponsors/amarnathcjd\" style=\"text-decoration: none; color: green;\"\u003ebecome a github sponsor\u003c/a\u003e\u003c/b\u003e\n- \u003cb\u003estar this repo :) ⭐\u003c/b\u003e\n\n## key features\n\n\u003cul\u003e\n  \u003cli\u003e\u003cstrong\u003eready\u003c/strong\u003e: 🚀 install gogram with \u003ccode\u003ego get\u003c/code\u003e and you are ready to go!\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eeasy\u003c/strong\u003e: 😊 makes the telegram api simple and intuitive, while still allowing advanced usages.\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eelegant\u003c/strong\u003e: 💎 low-level details are abstracted and re-presented in a more convenient way.\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003efast\u003c/strong\u003e: ⚡ backed by a powerful and concurrent library, gogram can handle even the heaviest workloads.\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003ezero dependencies\u003c/strong\u003e: 🛠️ no need to install anything else than gogram itself.\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003epowerful\u003c/strong\u003e: 💪 full access to telegram's api to execute any official client action and more.\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003efeature-rich\u003c/strong\u003e: 🌟 built-in support for file uploading, formatting, custom keyboards, message editing, moderation tools and more.\u003c/li\u003e\n  \u003cli\u003e\u003cstrong\u003eup-to-date\u003c/strong\u003e: 🔄 gogram is always in sync with the latest telegram api changes and additions (\u003ccode\u003etl-parser\u003c/code\u003e is used to generate the api layer).\u003c/li\u003e\n\u003c/ul\u003e\n\n#### Current Layer - **204** (Updated on 2025-05-29)\n\n## doing stuff\n\n```golang\n// sending a message\n\nclient.SendMessage(\"username\", \"Hello from Gogram!\")\n\nclient.SendDice(\"username\", \"🎲\")\n\nclient.On(\"message:/start\", func(m *telegram.NewMessage) error {\n    m.Reply(\"Hello from Gogram!\") // m.Respond(\"...\")\n    return nil\n})\n```\n\n```golang\n// sending media\n\nclient.SendMedia(\"username\", \"\u003cfile-name\u003e\", \u0026telegram.MediaOptions{ // filename/inputmedia,...\n    Caption: \"Hello from Gogram!\",\n    TTL: int32((math.Pow(2, 31) - 1)), //  TTL For OneTimeMedia\n})\n\nclient.SendAlbum(\"username\", []string{\"\u003cfile-name\u003e\", \"\u003cfile-name\u003e\"}, \u0026telegram.MediaOptions{ // Array of filenames/inputmedia,...\n    Caption: \"Hello from Gogram!\",\n})\n\n// with progress\nvar pm *telegram.ProgressManager\nclient.SendMedia(\"username\", \"\u003cfile-name\u003e\", \u0026telegram.MediaOptions{\n    Progress: func(a,b int) {\n        if pm == nil {\n            pm = telegram.NewProgressManager(a, 3) // 3 is edit interval\n        }\n\n        if pm.ShouldEdit(b) {\n            fmt.Println(pm.GetStats(b)) // client.EditMessage(\"\u003cchat-id\u003e\", \"\u003cmessage-id\u003e\", pm.GetStats())\n        }\n    },\n})\n```\n\n```golang\n// inline queries\n\nclient.On(\"inline:\u003cpattern\u003e\", func(iq *telegram.InlineQuery) error { // client.AddInlineHandler\n\tbuilder := iq.Builder()\n\tbuilder.Article(\"\u003ctitle\u003e\", \"\u003cdescription\u003e\", \"\u003ctext\u003e\", \u0026telegram.ArticleOptions{\n\t\t\tLinkPreview: true,\n\t})\n\n\treturn nil\n})\n```\n\n```golang\n// callback queries\n\nclient.On(\"callback:\u003cpattern\u003e\", func(cb *telegram.CallbackQuery) error { // client.AddCallbackHandler\n    cb.Answer(\"This is a callback response\", \u0026CallbackOptions{\n\t\tAlert: true,\n\t})\n    return nil\n})\n```\n\nFor more examples, check the **[examples](examples)** directory.\n\n## features\n\n- [x] basic mtproto implementation (layer 184)\n- [x] updates handling system + cache\n- [x] html, markdown parsing, friendly methods\n- [x] support for flag2.0, layer 147\n- [x] webrtc calls support\n- [x] documentation for all methods\n- [x] stabilize file uploading\n- [x] stabilize file downloading\n- [ ] secret chats support\n- [x] cdn dc support\n- [x] reply markup builder helpers\n- [x] reimplement file downloads (more speed + less cpu usage)\n\n## known issues\n\n- [x] ~ file download, is cpu intensive\n- [x] ~ open issues if found :)\n- [ ] ~ enhance peer caching.\n\n## contributing\n\nGogram is an open-source project and your contribution is very much appreciated. If you'd like to contribute, simply fork the repository, commit your changes and send a pull request. If you have any questions, feel free to ask.\n\n## License\n\nThis library is provided under the terms of the [GPL-3.0 License](LICENSE).\n","funding_links":["https://github.com/sponsors/amarnathcjd","https://buymeacoffee.com/amarnathcjd"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarnathcjd%2Fgogram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famarnathcjd%2Fgogram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famarnathcjd%2Fgogram/lists"}