MCPcopy Index your code
hub / github.com/FedericoBruzzone/tdlib-rs

github.com/FedericoBruzzone/tdlib-rs @v1.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.4.0 ↗ · + Follow
116 symbols 212 edges 22 files 33 documented · 28%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

tdlib-rs

Latest version Documentation CI Linux CI Windows CI macOS

downloads license

A Rust wrapper around the Telegram Database library. It includes a generator to automatically generate the types and functions from the TDLib's Type Language file.

Why this fork?

This is an improved version of the tdlib-rs library, with the following additional features:

  1. It is cross-platform, it works on Windows, Linux and MacOS.
  2. Not required tdlib to be compiled and installed on the system.
  3. Not required pkg-config to build the library and associated exported variables.
  4. Four different ways to build the library:
    • download-tdlib: download the precompiled library from the GitHub releases.
    • local-tdlib: use the tdlib installed on the system.
    • pkg-config: use the pkg-config to build the library.
    • static: statically link tdjson (to be used with download-tdlib or local-tdlib).
  5. It is possible to download the tdlib library from the GitHub releases.

Information

We provide a precompiled version of the library for the supported platforms:

  • Linux (x86_64)
  • Linux (arm64)
  • macOS Intel (x86_64)
  • macOS Apple Silicon (arm64)
  • Windows (x86_64)
  • Windows (arm64)

We compile it in the CI and we upload the artifacts to the GitHub releases, so we can download it and use to build this library.

It's mainly created for using it in the tgt client, but it should work also for any other Rust project.

Current supported TDLib version: 1.8.61.

Cargo features

Please see the documentation of the module build for more information about the features here. It functions that you can use to build the library in different ways.

download-tdlib

If you don't want to compile and intall the tdlib on your system manually, you should enable the download-tdlib feature in the Cargo.toml file:

[dependencies]
tdlib = { version = "...", features = [ "download-tdlib" ] }

[build-dependencies]
tdlib = { version = "...", features = [ "download-tdlib" ] }
// build.rs
fn main() {
    tdlib_rs::build::build(None);
}

local-tdlib

local-tdlib require you to have the tdlib (version 1.8.61) compiled and installed on your system, and the following variables exported, for example in the .bashrc file:

# The path to the tdlib folder
export LOCAL_TDLIB_PATH=$HOME/lib/tdlib

Then you can enable the local-tdlib feature in the Cargo.toml file:

[dependencies]
tdlib = { version = "...", features = [ "local-tdlib" ] }

[build-dependencies]
tdlib = { version = "...", features = [ "local-tdlib" ] }
// build.rs
fn main() {
    tdlib_rs::build::build(None);
}

pkg-config

If you want to use the pkg-config to build this library, you should enable the pkg-config feature in the Cargo.toml file:

[dependencies]
tdlib = { version = "...", features = [ "pkg-config" ] }

[build-dependencies]
tdlib = { version = "...", features = [ "pkg-config" ] }
// build.rs
fn main() {
    tdlib_rs::build::build(None);
}

remember to have the tdlib (version 1.8.61) compiled on your system, and the following variables exported, for example in the .bashrc file:

# pkg-config configuration
export PKG_CONFIG_PATH=$HOME/lib/tdlib/lib/pkgconfig/:$PKG_CONFIG_PATH

# dynmic linker configuration
export LD_LIBRARY_PATH=$HOME/lib/tdlib/lib/:$LD_LIBRARY_PATH

docs

This feature skip the linking of the library and only generate the code of generated.rs. Is used only for testing.

static

This feature enables static linking for tdjson, so the final binary does not require tdjson to be installed in the target system runtime.

Use it together with download-tdlib or local-tdlib:

[dependencies]
tdlib-rs = { version = "...", features = ["download-tdlib", "static"] }

bots-only-api

This feature enable the generation of the functions only used by Telegram bots.

License

This repository are licensed under either of

at your option.

Please review the license file provided in the repository for more information regarding the terms and conditions of the license.

Contact

If you have any questions, suggestions, or feedback, do not hesitate to contact me.

Mantainers:

Credits

  • grammers: the tdlib-tl-gen and tdlib-tl-parser projects are forks of the grammers-tl-gen and grammers-tl-parser projects.
  • rust-tdlib: for inspiration about some client code.
  • tdlib-rs: for inspiration about the generator code.

Core symbols most depended-on inside this repo

qual_name
called by 11
tdlib-rs-gen/src/rustifier.rs
is_for_bots_only
called by 7
tdlib-rs-gen/src/rustifier.rs
ask_user
called by 7
tdlib-rs/examples/get_me.rs
type_name
called by 6
tdlib-rs-gen/src/rustifier.rs
next
called by 6
tdlib-rs-parser/src/tl_iterator.rs
variant_name
called by 3
tdlib-rs-gen/src/rustifier.rs
is_optional
called by 3
tdlib-rs-gen/src/rustifier.rs
rusty_type_name
called by 2
tdlib-rs-gen/src/rustifier.rs

Shape

Function 91
Method 15
Class 6
Enum 4

Languages

Rust100%

Modules by API surface

tdlib-rs-gen/src/rustifier.rs34 symbols
tdlib-rs-parser/src/tl/definition.rs11 symbols
tdlib-rs/src/build.rs9 symbols
tdlib-rs-parser/src/tl/ty.rs8 symbols
tdlib-rs-parser/src/tl/parameter.rs7 symbols
tdlib-rs-gen/src/metadata.rs7 symbols
tdlib-rs/build.rs6 symbols
tdlib-rs-parser/src/tl_iterator.rs5 symbols
tdlib-rs/src/observer.rs4 symbols
tdlib-rs/examples/get_me.rs4 symbols
tdlib-rs/src/tdjson.rs3 symbols
tdlib-rs/src/lib.rs3 symbols

For agents

$ claude mcp add tdlib-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page