Telegram clients and bots in Rust, powered by TDLib.
td gives you typed requests, async calls, and a stream of updates without
hand-written JSON. TDLib handles the Telegram connection; you write the
application. This is a native client library, not an HTTP Bot API wrapper.
- The generated TDLib API. Requests know their response types.
- Messages you can await. Wait for a send's final outcome, including individual album results.
- File transfers you can follow. Upload/download measurements and cooperative cancellation.
- Room for your application. Multiple clients, concurrent requests, and ordered updates—without a prescribed bot framework or retry policy.
With an authorized session:
use td_client::types::{enums::User, fns};
use td_client::{Client, Result};
async fn who_am_i(client: &Client) -> Result {
let User::user(user) = client.send(&fns::getMe {}).await?;
println!("Hello from {}!", user.first_name);
Ok(())
}One session owns the TDLib instance and database. Clone its client for
concurrent work, receive updates through the session, and call close().await
when you're done.
td-client is the application-facing layer, td-types provides generated Rust
types, and td-sys connects to the native library. At build time, td-parser
and td-codegen turn TDLib's TL schema
into Rust.
The crates are unpublished and the API is still being refined. Development uses
local path dependencies; ./td/fetch downloads the native library and matching
schema.