Grammers
(tele)gramme.rs - use Telegram's API from Rust
Install / Use
/learn @Lonami/GrammersREADME
Moved to https://codeberg.org/Lonami/grammers. The GitHub repository may be deleted in the future.
gramme.rs
A set of Rust crates to interact with Telegram's API, hence the name (tele)gramme.rs.
Current status
It works! The high-level interface is slowly taking shape, and it can already be used to build real projects, such as RSS bots.
For an up-to-date taste on how the library looks like, refer to the client examples folder.
For the API reference, please refer to https://docs.rs/grammers-client/.
Crates
- grammers-client: high-level API. Depends on:
grammers-tl-typesto both invoke requests and wrap raw types.grammers-sessionto persist home datacenter, logged-in user and cache peers.grammers-mtsenderto connect to Telegram's servers and exchange messages.grammers-cryptoto support Two-Factor Authentication logins.
- grammers-mtsender: network connection to Telegram. Depends on:
grammers-tl-typesto initialize the connection and offer an ergonomic RPC interface.grammers-sessionto persist the DC configuration and corresponding Authorization Keys.grammers-mtprototo serialize messages and manage the connection state.grammers-cryptofor efficient buffer usage.
- grammers-session: session storages for the client. Depends on:
grammers-tl-typesto provide a more ergonomic interface over peers.
- grammers-mtproto: implementation of the Mobile Transport Protocol. Depends on:
grammers-tl-typesto invoke and parse the core messages of the protocol.grammers-cryptoto encrypt the communication with Telegram.
- grammers-tl-types: generated Rust types for a certain layer. Depends on:
grammers-tl-gento generate the Rust code that makes up the crate itself.grammers-tl-parserto parse the TL files with all definitions used by Telegram.
- grammers-crypto: cryptography-related methods.
- grammers-tl-gen: Rust code generator from TL definitions. Depends on:
grammers-tl-parserto compose functions referencing the parsed definition types.
- grammers-tl-parser: a Type Language parser.
Security
It is recommended to always use cargo-crev to verify the trustworthiness of each of your dependencies, including this one.
As far as I know, this code has not been audited, so if, for any reason, you're using this crate
where security is critical, I strongly encourage you to review at least grammers-crypto and the
authentication part of grammers-mtproto. I am not a security expert, although I trust my code
enough to use it myself.
If you know about some published audit for this crate, please let me know, so that I can link it here and review the issues found.
License
All the libraries and binaries contained in this repository are licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Thank you for considering to contribute! I'll try my best to provide quick, constructive feedback on your issues or pull requests. Please do call me out if you think my behaviour is not acceptable at any time. I will try to keep the discussion as technical as possible. Similarly, I will not tolerate poor behaviour from your side towards other people (including myself).
It is recommended to run these commands to make the Git experience a bit nicer:
git config --local blame.ignoreRevsFile .git-blame-ignore-revs
cp pre-commit .git/hooks/
If you don't have the time to contribute code, you may contribute by reporting issues or feature ideas. Please note that every feature added will increase maintenance burden on my part, so be mindful when suggesting things. It may be possible that your idea could exist as its own crate, offered as extensions to grammers.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Related Skills
gh-issues
343.3kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
oracle
343.3kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
tmux
343.3kRemote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
