{"id":13470949,"url":"https://github.com/tdlib/td","last_synced_at":"2025-05-13T20:07:19.746Z","repository":{"id":37408932,"uuid":"115883761","full_name":"tdlib/td","owner":"tdlib","description":"Cross-platform library for building Telegram clients","archived":false,"fork":false,"pushed_at":"2025-05-04T13:38:48.000Z","size":63876,"stargazers_count":7647,"open_issues_count":91,"forks_count":1587,"subscribers_count":321,"default_branch":"master","last_synced_at":"2025-05-06T19:52:13.380Z","etag":null,"topics":["cross-platform","library","telegram"],"latest_commit_sha":null,"homepage":"https://core.telegram.org/tdlib","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tdlib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE_1_0.txt","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}},"created_at":"2017-12-31T20:23:47.000Z","updated_at":"2025-05-06T08:20:57.000Z","dependencies_parsed_at":"2023-09-24T02:21:52.169Z","dependency_job_id":"f69425d2-56db-4f71-b1c0-f77385b91390","html_url":"https://github.com/tdlib/td","commit_stats":{"total_commits":9690,"total_committers":59,"mean_commits":"164.23728813559322","dds":0.06264189886480909,"last_synced_commit":"70bee089d492437ce931aa78446d89af3da182fc"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdlib%2Ftd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdlib%2Ftd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdlib%2Ftd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdlib%2Ftd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tdlib","download_url":"https://codeload.github.com/tdlib/td/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020483,"owners_count":22000750,"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":["cross-platform","library","telegram"],"created_at":"2024-07-31T16:00:37.728Z","updated_at":"2025-05-13T20:07:19.734Z","avatar_url":"https://github.com/tdlib.png","language":"C++","funding_links":[],"categories":["C++","网络服务","OpenSource","Official"],"sub_categories":["网络服务_其他","OpenSource Apps"],"readme":"# TDLib\n\nTDLib (Telegram Database library) is a cross-platform library for building [Telegram](https://telegram.org) clients. It can be easily used from almost any programming language.\n\n## Table of Contents\n- [Features](#features)\n- [Examples and documentation](#usage)\n- [Dependencies](#dependencies)\n- [Building](#building)\n- [Using in CMake C++ projects](#using-cxx)\n- [Using in Java projects](#using-java)\n- [Using in .NET projects](#using-dotnet)\n- [Using with other programming languages](#using-json)\n- [License](#license)\n\n\u003ca name=\"features\"\u003e\u003c/a\u003e\n## Features\n\n`TDLib` has many advantages. Notably `TDLib` is:\n\n* **Cross-platform**: `TDLib` can be used on Android, iOS, Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, illumos, Windows Phone, WebAssembly, watchOS, tvOS, visionOS, Tizen, Cygwin. It should also work on other *nix systems with or without minimal effort.\n* **Multilanguage**: `TDLib` can be easily used with any programming language that is able to execute C functions. Additionally, it already has native Java (using `JNI`) bindings and .NET (using `C++/CLI` and `C++/CX`) bindings.\n* **Easy to use**: `TDLib` takes care of all network implementation details, encryption and local data storage.\n* **High-performance**: in the [Telegram Bot API](https://core.telegram.org/bots/api), each `TDLib` instance handles more than 25000 active bots simultaneously.\n* **Well-documented**: all `TDLib` API methods and public interfaces are fully documented.\n* **Consistent**: `TDLib` guarantees that all updates are delivered in the right order.\n* **Reliable**: `TDLib` remains stable on slow and unreliable Internet connections.\n* **Secure**: all local data is encrypted using a user-provided encryption key.\n* **Fully-asynchronous**: requests to `TDLib` don't block each other or anything else, responses are sent when they are available.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n## Examples and documentation\nSee our [Getting Started](https://core.telegram.org/tdlib/getting-started) tutorial for a description of basic TDLib concepts.\n\nTake a look at our [examples](https://github.com/tdlib/td/blob/master/example/README.md#tdlib-usage-and-build-examples).\n\nSee a [TDLib build instructions generator](https://tdlib.github.io/td/build.html) for detailed instructions on how to build TDLib.\n\nSee description of our [JSON](#using-json), [C++](#using-cxx), [Java](#using-java) and [.NET](#using-dotnet) interfaces.\n\nSee the [td_api.tl](https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl) scheme or the automatically generated [HTML documentation](https://core.telegram.org/tdlib/docs/td__api_8h.html)\nfor a list of all available `TDLib` [methods](https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html) and [classes](https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_object.html).\n\n\u003ca name=\"dependencies\"\u003e\u003c/a\u003e\n## Dependencies\n`TDLib` depends on:\n\n* C++17 compatible compiler (Clang 5.0+, GCC 7.0+, MSVC 19.1+ (Visual Studio 2017.7+), Intel C++ Compiler 19+)\n* OpenSSL\n* zlib\n* gperf (build only)\n* CMake (3.10+, build only)\n* PHP (optional, for documentation generation)\n\n\u003ca name=\"building\"\u003e\u003c/a\u003e\n## Building\n\nThe simplest way to build `TDLib` is to use our [TDLib build instructions generator](https://tdlib.github.io/td/build.html).\nYou need only to choose your programming language and target operating system to receive complete build instructions.\n\nIn general, you need to install all `TDLib` [dependencies](#dependencies), enter directory containing `TDLib` sources and compile them using CMake:\n\n```\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release ..\ncmake --build .\n```\n\nTo build `TDLib` on low memory devices you can run [SplitSource.php](https://github.com/tdlib/td/blob/master/SplitSource.php) script\nbefore compiling main `TDLib` source code and compile only needed targets:\n```\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release ..\ncmake --build . --target prepare_cross_compiling\ncd ..\nphp SplitSource.php\ncd build\ncmake --build . --target tdjson\ncmake --build . --target tdjson_static\ncd ..\nphp SplitSource.php --undo\n```\nIn our tests clang 6.0 with libc++ required less than 500 MB of RAM per file and GCC 4.9/6.3 used less than 1 GB of RAM per file.\n\n\u003ca name=\"using-cxx\"\u003e\u003c/a\u003e\n## Using in CMake C++ projects\nFor C++ projects that use CMake, the best approach is to build `TDLib` as part of your project or to install it system-wide.\n\nThere are several libraries that you could use in your CMake project:\n\n* Td::TdJson, Td::TdJsonStatic — dynamic and static version of a JSON interface. This has a simple C interface, so it can be easily used with any programming language that is able to execute C functions.\n  See [td_json_client](https://core.telegram.org/tdlib/docs/td__json__client_8h.html) documentation for more information.\n* Td::TdStatic — static library with C++ interface for general usage.\n  See [ClientManager](https://core.telegram.org/tdlib/docs/classtd_1_1_client_manager.html) and [Client](https://core.telegram.org/tdlib/docs/classtd_1_1_client.html) documentation for more information.\n\nFor example, part of your CMakeLists.txt may look like this:\n```\nadd_subdirectory(td)\ntarget_link_libraries(YourTarget PRIVATE Td::TdStatic)\n```\n\nOr you could install `TDLib` and then reference it in your CMakeLists.txt like this:\n```\nfind_package(Td 1.8.49 REQUIRED)\ntarget_link_libraries(YourTarget PRIVATE Td::TdStatic)\n```\nSee [example/cpp/CMakeLists.txt](https://github.com/tdlib/td/blob/master/example/cpp/CMakeLists.txt).\n\n\u003ca name=\"using-java\"\u003e\u003c/a\u003e\n## Using in Java projects\n`TDLib` provides native Java interface through JNI. To enable it, specify option `-DTD_ENABLE_JNI=ON` to CMake.\n\nSee [example/java](https://github.com/tdlib/td/tree/master/example/java) for example of using `TDLib` from Java and detailed build and usage instructions.\n\n\u003ca name=\"using-dotnet\"\u003e\u003c/a\u003e\n## Using in .NET projects\n`TDLib` provides native .NET interface through `C++/CLI` and `C++/CX`. To enable it, specify option `-DTD_ENABLE_DOTNET=ON` to CMake.\n.NET Core supports `C++/CLI` only since version 3.1 and only on Windows, so if older .NET Core is used or portability is needed, then `TDLib` JSON interface should be used through P/Invoke instead.\n\nSee [example/csharp](https://github.com/tdlib/td/tree/master/example/csharp) for example of using `TDLib` from C# and detailed build and usage instructions.\nSee [example/uwp](https://github.com/tdlib/td/tree/master/example/uwp) for example of using `TDLib` from C# UWP application and detailed build and usage instructions for Visual Studio Extension \"TDLib for Universal Windows Platform\".\n\nWhen `TDLib` is built with `TD_ENABLE_DOTNET` option enabled, `C++` documentation is removed from some files. You need to checkout these files to return `C++` documentation back:\n```\ngit checkout td/telegram/Client.h td/telegram/Log.h td/tl/TlObject.h\n```\n\n\u003ca name=\"using-json\"\u003e\u003c/a\u003e\n## Using from other programming languages\n`TDLib` provides efficient native C++, Java, and .NET interfaces.\nBut for most use cases we suggest to use the JSON interface, which can be easily used with any programming language that is able to execute C functions.\nSee [td_json_client](https://core.telegram.org/tdlib/docs/td__json__client_8h.html) documentation for detailed JSON interface description,\nthe [td_api.tl](https://github.com/tdlib/td/blob/master/td/generate/scheme/td_api.tl) scheme or the automatically generated [HTML documentation](https://core.telegram.org/tdlib/docs/td__api_8h.html) for a list of\nall available `TDLib` [methods](https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html) and [classes](https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_object.html).\n\n`TDLib` JSON interface adheres to semantic versioning and versions with the same major version number are binary and backward compatible, but the underlying `TDLib` API can be different for different minor and even patch versions.\nIf you need to support different `TDLib` versions, then you can use a value of the `version` option to find exact `TDLib` version to use appropriate API methods.\n\nSee [example/python/tdjson_example.py](https://github.com/tdlib/td/blob/master/example/python/tdjson_example.py) for an example of such usage.\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\n`TDLib` is licensed under the terms of the Boost Software License. See [LICENSE_1_0.txt](http://www.boost.org/LICENSE_1_0.txt) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdlib%2Ftd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftdlib%2Ftd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdlib%2Ftd/lists"}