Skip to content

v0.2.0

Choose a tag to compare

@z7vian z7vian released this 07 Nov 19:53
· 16 commits to main since this release
v0.2.0
1148719

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 .session files are refused; delete the old file and log in once. storage::load and storage::save are gone: the client keeps <name>.session itself (.workdir, .storage_engine, .in_memory).
  • Updates: next_update() is removed. Register on_message(filter, f) or on_raw_update(f), then app.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, use connect(), then send_code and sign_in. sign_in_bot takes &self and returns types::User.
  • get_me() returns types::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 sent types::Message.
  • Errors: RpcError, raw::Error and Error's struct variants are #[non_exhaustive]: match with .. and a _ arm; build RpcError::new(code, name, value).
  • Raw layer: layer 233; RemoteCall has a required NAME; crypto is private; Connection and Session need the experimental unstable-raw feature.

Install

vaegram = "0.2"   # or vae = "0.2", the same crate under a shorter name

Requires Rust 1.85+. Documentation: https://docs.rs/vaegram