Repository navigation
v0.2.0
vaegram 0.2.0 turns the 0.1 proof of concept into a full Telegram client for bots and user accounts, written from scratch in Rust over MTProto.
Highlights
- Bots and user accounts: bot tokens, phone login with 2FA, QR login, business connections.
- 45 typed
on_*handlers and hooks, composable filters, and conversations (ask,listen, next-step handlers). - Friendly methods across chats, messages, media, stories, payments, gifts and business accounts; every function of layer 233 through
invoke. - Sessions that survive restarts, with gap recovery; storage engines for SQLite, redb, Redis, MongoDB, S3 and Vault behind features.
- Request observers with caller tags and credential-safe JSON, error events, and recorded traffic replay for offline tests.
Upgrading from 0.1
- Sessions: 0.1 session strings and
.sessionfiles are refused; delete the old file and log in once.storage::loadandstorage::saveare gone: the client keeps<name>.sessionitself (.workdir,.storage_engine,.in_memory). - Updates:
next_update()is removed. Registeron_message(filter, f)oron_raw_update(f), thenapp.run().await. - Login:
start()logs in when nothing is stored, asking on stdin for what the builder wasn't given. For a signed-out client, useconnect(), thensend_codeandsign_in.sign_in_bottakes&selfand returnstypes::User. get_me()returnstypes::User(is_bot,phone_number,is_premium).send_message(chat, text)takes any chat reference (i64,"@username","me",&Chat, ..) and returns a builder; awaiting it gives the senttypes::Message.- Errors:
RpcError,raw::ErrorandError's struct variants are#[non_exhaustive]: match with..and a_arm; buildRpcError::new(code, name, value). - Raw layer: layer 233;
RemoteCallhas a requiredNAME;cryptois private;ConnectionandSessionneed the experimentalunstable-rawfeature.
Install
vaegram = "0.2" # or vae = "0.2", the same crate under a shorter nameRequires Rust 1.85+. Documentation: https://docs.rs/vaegram