{"id":13610274,"url":"https://github.com/Arman92/go-tdlib","last_synced_at":"2025-04-12T22:33:16.164Z","repository":{"id":44411254,"uuid":"127627678","full_name":"Arman92/go-tdlib","owner":"Arman92","description":"Golang Telegram TdLib JSON bindings","archived":false,"fork":false,"pushed_at":"2022-01-14T12:03:52.000Z","size":1768,"stargazers_count":438,"open_issues_count":49,"forks_count":100,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-12-06T21:09:50.137Z","etag":null,"topics":["tdlib-go","telegram","telegram-api"],"latest_commit_sha":null,"homepage":null,"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/Arman92.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":"2018-04-01T12:33:39.000Z","updated_at":"2024-12-05T20:07:54.000Z","dependencies_parsed_at":"2022-07-12T18:20:59.933Z","dependency_job_id":null,"html_url":"https://github.com/Arman92/go-tdlib","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arman92%2Fgo-tdlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arman92%2Fgo-tdlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arman92%2Fgo-tdlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arman92%2Fgo-tdlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Arman92","download_url":"https://codeload.github.com/Arman92/go-tdlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248641716,"owners_count":21138254,"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":["tdlib-go","telegram","telegram-api"],"created_at":"2024-08-01T19:01:43.148Z","updated_at":"2025-04-12T22:33:15.652Z","avatar_url":"https://github.com/Arman92.png","language":"Go","readme":"# go-tdlib\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\nGolang Telegram TdLib JSON bindings\n\n\n## Introduction\nTelegram Tdlib is a complete library for creating telegram clients, it also has a simple tdjson ready-to-use library to ease\nthe integration with different programming languages and platforms.\n\n**go-tdlib** is a complete tdlib-tdjson binding package to help you create your own Telegram clients.\n\n**NOTE:** basic tdjson-golang binding is inspired from this package: [go-tdjson](https://github.com/L11R/go-tdjson)\n\nAll the classes and functions declared in [Tdlib TypeLanguage schema](https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl)\nfile have been exported using the autogenerate tool [tl-parser](https://github.com/Arman92/go-tl-parser).\nSo you can use every single type and method in Tdlib.\n\n## Key features:\n* Autogenerated golang structs and methods out of tdlib .tl schema\n* Custom event receivers defined by user (e.g. get only text messages from a specific user)\n* Supports all tdjson functions: Send(), Execute(), Receive(), Destroy(), SetFilePath(), SetLogVerbosityLevel()\n* Supports all tdlib functions and types\n\n## Installation\n\nFirst of all you need to clone the Tdlib repo and build it:\n```bash\ngit clone git@github.com:tdlib/td.git --depth 1\ncd td\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release ..\ncmake --build . -- -j5\nmake install\n\n# -j5 refers to number of your cpu cores + 1 for multi-threaded build.\n```\n\nIf hit any build errors, refer to [Tdlib build instructions](https://github.com/tdlib/td#building)\nI'm using static linking against tdlib so it won't require to build the whole tdlib source files.\n\n## Docker\nYou can use the prebuilt tdlib image and Go image of your liking:\n\n```\nFROM golang:1.15-alpine AS golang\n\nCOPY --from=wcsiu/tdlib:1.7-alpine /usr/local/include/td /usr/local/include/td\nCOPY --from=wcsiu/tdlib:1.7-alpine /usr/local/lib/libtd* /usr/local/lib/\nCOPY --from=wcsiu/tdlib:1.7-alpine /usr/lib/libssl.a /usr/local/lib/libssl.a\nCOPY --from=wcsiu/tdlib:1.7-alpine /usr/lib/libcrypto.a /usr/local/lib/libcrypto.a\nCOPY --from=wcsiu/tdlib:1.7-alpine /lib/libz.a /usr/local/lib/libz.a\nRUN apk add build-base\n\nWORKDIR /myApp\n\nCOPY . .\n\nRUN go build --ldflags \"-extldflags '-static -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -ldl -lm -lssl -lcrypto -lstdc++ -lz'\" -o /tmp/getChats getChats.go\n\nFROM gcr.io/distroless/base:latest\nCOPY --from=golang /tmp/getChats /getChats\nENTRYPOINT [ \"/getChats\" ]\n```\n\n```\n$ docker build -fDockerfile -ttelegram-client .\n```\n\n## Example\nHere is a simple example for authorization and fetching updates:\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/Arman92/go-tdlib\"\n)\n\nfunc main() {\n\ttdlib.SetLogVerbosityLevel(1)\n\ttdlib.SetFilePath(\"./errors.txt\")\n\n\t// Create new instance of client\n\tclient := tdlib.NewClient(tdlib.Config{\n\t\tAPIID:               \"187786\",\n\t\tAPIHash:             \"e782045df67ba48e441ccb105da8fc85\",\n\t\tSystemLanguageCode:  \"en\",\n\t\tDeviceModel:         \"Server\",\n\t\tSystemVersion:       \"1.0.0\",\n\t\tApplicationVersion:  \"1.0.0\",\n\t\tUseMessageDatabase:  true,\n\t\tUseFileDatabase:     true,\n\t\tUseChatInfoDatabase: true,\n\t\tUseTestDataCenter:   false,\n\t\tDatabaseDirectory:   \"./tdlib-db\",\n\t\tFileDirectory:       \"./tdlib-files\",\n\t\tIgnoreFileNames:     false,\n\t})\n\n\tfor {\n\t\tcurrentState, _ := client.Authorize()\n\t\tif currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitPhoneNumberType {\n\t\t\tfmt.Print(\"Enter phone: \")\n\t\t\tvar number string\n\t\t\tfmt.Scanln(\u0026number)\n\t\t\t_, err := client.SendPhoneNumber(number)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error sending phone number: %v\", err)\n\t\t\t}\n\t\t} else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitCodeType {\n\t\t\tfmt.Print(\"Enter code: \")\n\t\t\tvar code string\n\t\t\tfmt.Scanln(\u0026code)\n\t\t\t_, err := client.SendAuthCode(code)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error sending auth code : %v\", err)\n\t\t\t}\n\t\t} else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitPasswordType {\n\t\t\tfmt.Print(\"Enter Password: \")\n\t\t\tvar password string\n\t\t\tfmt.Scanln(\u0026password)\n\t\t\t_, err := client.SendAuthPassword(password)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error sending auth password: %v\", err)\n\t\t\t}\n\t\t} else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateReadyType {\n\t\t\tfmt.Println(\"Authorization Ready! Let's rock\")\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Main loop\n\trawUpdates := client.GetRawUpdatesChannel(100)\n        for update := range rawUpdates {\n\t\t// Show all updates\n\t\tfmt.Println(update.Data)\n\t\tfmt.Print(\"\\n\\n\")\n\t}\n\n}\n\n```\n\nMore examples can be found on [examples folder](https://github.com/Arman92/go-tdlib/tree/master/examples)\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/zelenin\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/1427885?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAleksandr Zelenin\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#example-zelenin\" title=\"Examples\"\u003e💡\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/for\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/7262123?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003efor\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Arman92/go-tdlib/issues?q=author%3Afor\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://zibaei.net\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/16955684?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAhmadreza Zibaei\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Arman92/go-tdlib/commits?author=ahmdrz\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/aivel\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/3083784?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMax\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Arman92/go-tdlib/commits?author=aivel\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://rocketeer.be\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/42904?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRuben Vermeersch\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Arman92/go-tdlib/issues?q=author%3Arubenv\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/alxshelepenok\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/8599449?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlexander Shelepenok\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Arman92/go-tdlib/commits?author=alxshelepenok\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#maintenance-alxshelepenok\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/Arman92/go-tdlib/commits?author=alxshelepenok\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/KarimNahas\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/15736459?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKarim Nahas\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Arman92/go-tdlib/commits?author=KarimNahas\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#maintenance-KarimNahas\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/Arman92/go-tdlib/issues?q=author%3AKarimNahas\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/wcsiu\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/5212960?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eWachiu Siu\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#example-wcsiu\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"https://github.com/Arman92/go-tdlib/issues?q=author%3Awcsiu\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e \u003ca href=\"https://github.com/Arman92/go-tdlib/commits?author=wcsiu\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/motylkov\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/1659182?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003emotylkov\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Arman92/go-tdlib/commits?author=motylkov\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/Juliia-b\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/55066322?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJuliia-b\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/Arman92/go-tdlib/issues?q=author%3AJuliia-b\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FArman92%2Fgo-tdlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FArman92%2Fgo-tdlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FArman92%2Fgo-tdlib/lists"}