Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

td

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.

What you get

  • 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.

A quick look

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.

How it fits together

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.

Inspired by Lonami's grammers and Telethon.

About

Type-safe Rust codegen and bindings for TDLib

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages