Skip to content

Latest commit

 

History

208 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Ferogram

A Native & Elegant MTProto Framework for Rust

Crates.io docs.rs Dependencies License Telegram

Built by Ankit Chaubey

Overview

Modern APIs. Native MTProto. Ferogram helps you build fast, powerful Telegram applications for both bots and user accounts without compromising on flexibility.

From messaging and media to transfers, calls, MTProxy, and much more, Ferogram brings everything together in one elegant framework.

Let's build something amazing. High-level APIs where you want them, raw invoke() where you need complete control.


Getting started

All it takes is a single line in your Cargo.toml.

[dependencies]
ferogram = "0.6.5"

Development on GitHub moves faster than crates.io. If you need something from main, you can point directly to a specific commit:

ferogram = { git = "https://github.com/ankit-chaubey/ferogram", rev = "COMMIT_SHA" }

Otherwise, stable from crates.io is the safe default.


Quick start

use ferogram::Client;

const API_ID: i32 = 0;
const API_HASH: &str = "";

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let (client, _) = Client::quick_connect("my.session", API_ID, API_HASH).await?;

    client.send_message("me", "Hello from ferogram!").await?;
    Ok(())
}

Python support

Love Python as much as we do? Ferogram is also available for Python with a clean, user-friendly API while keeping the heavy lifting in Rust.

Powered by same high-performance Rust core, it takes care of networking, encryption, TL parsing, and session management. Explore the ferogram python source, learn about its architecture, or install the pre-built wheels for your platform from PyPI, no Rust toolchain needed.

All you need is:

pip install ferogram

Features

  • TgCalls: Voice and video calling for Telegram clients, wrapping Telegram's native calling stack in a Rust API for joining voice chats and streaming audio or video. See tgcalls.

  • Dispatcher & Filters: A flexible update dispatcher with composable filters (&, |, !) for building expressive and maintainable handlers.

  • FSM: A type-safe finite state machine for multi-step conversations, featuring pluggable storage backends and configurable state strategies. See ferogram-fsm.

  • Session Backends: Binary file storage by default, with built-in support for SQLite, LibSQL (Turso), and base64 sessions. Custom storage backends can be implemented via SessionBackend.

  • MTProxy: Native support for Classic, DD, and FakeTLS MTProxy transports.

  • Raw API: Access the complete Telegram MTProto API by invoking any TL function directly with client.invoke(), giving you full control whenever the high-level API doesn't cover a use case.

...and more features like this throughout the codebase!

Raw API example
use ferogram::tl;

let req = tl::functions::bots::SetBotCommands {
    scope: tl::enums::BotCommandScope::Default(tl::types::BotCommandScopeDefault {}),
    lang_code: "en".into(),
    commands: vec![tl::enums::BotCommand::BotCommand(tl::types::BotCommand {
        command: "start".into(),
        description: "Start the bot".into(),
    })],
};
client.invoke(&req).await?;
client.invoke_on_dc(2, &req).await?;

See the crate documentation for a complete overview of all supported features.


What's covered

See what's covered for the quick feature list, or try the runnable examples to see it in action.

If something is missing, feel free to open a feature request or share your ideas in @FerogramChat.


Community and links

Join the ferogram community! Questions, discussions, bugs report and feedback are always welcome.

License

This project is dual-licensed under:

  • MIT License
  • Apache License 2.0

You may choose either license.

You are free to use, modify, and distribute this software, including for commercial use, provided the original license and copyright notice are included.

See LICENSE-MIT and LICENSE-APACHE for full details.

Usage must comply with Telegram's API's Terms.

About

A native, elegant, and asynchronous MTProto framework in Rust for Telegram clients, bots, and applications.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

29 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages