5
56
Fork
You've already forked grammers
24
(tele)gramme.rs - use Telegram's API from Rust
  • Rust 99.7%
  • Python 0.3%
Find a file
2026年07月13日 17:51:44 +02:00
.cargo Add empty TG_ID/HASH in env to avoid errors in examples ( #253 ) 2024年07月27日 08:21:33 +02:00
.forgejo Explicitly mention policy against AI usage in PR template 2026年06月30日 21:27:37 +02:00
assets Round corners of README diagram 2025年10月30日 19:35:08 +01:00
grammers Bump to v0.10.0 2026年07月02日 21:48:00 +02:00
grammers-client Allow customizing the number of tries in the AutoSleep retry policy ( #54 ) 2026年07月13日 17:51:44 +02:00
grammers-crypto Bump to v0.10.0 2026年07月02日 21:48:00 +02:00
grammers-mtproto Bump to v0.10.0 2026年07月02日 21:48:00 +02:00
grammers-mtsender Bump to v0.10.0 2026年07月02日 21:48:00 +02:00
grammers-session Update to layer 228 2026年07月11日 11:31:28 +02:00
grammers-tl-gen Bump to v0.10.0 2026年07月02日 21:48:00 +02:00
grammers-tl-parser Bump to v0.10.0 2026年07月02日 21:48:00 +02:00
grammers-tl-types Update to layer 228 2026年07月11日 11:31:28 +02:00
includes Move all workspace crates out of lib subfolder 2025年10月25日 18:58:14 +02:00
.editorconfig Add .editorconfig ( #269 ) 2024年10月03日 17:08:46 +02:00
.git-blame-ignore-revs Complete renaming files out of lib/ 2025年10月25日 19:06:08 +02:00
.gitignore Add CLI tool to scrape Telegram's documentation 2020年12月20日 01:26:02 +01:00
.rustfmt.toml Add missing style_edition to .rustfmt.toml 2026年03月26日 18:20:15 +01:00
Cargo.toml Complete renaming files out of lib/ 2025年10月25日 19:06:08 +02:00
LICENSE-APACHE Add license boilerplate 2020年01月31日 11:31:46 +01:00
LICENSE-MIT Update license 2021年02月14日 14:43:07 +01:00
logo.svg Add logo 2020年02月01日 15:05:59 +01:00
Makefile Add type Error to Session trait ( #43 ) 2026年06月10日 07:05:56 +02:00
pre-commit Consistently format all top-level lines 2026年01月03日 20:38:58 +01:00
README.md Update contribution guidelines 2026年02月23日 19:39:50 +01:00

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

Diagram depicting the crate hierarchy

  • grammers-client : high-level API. Depends on:
  • grammers-mtsender : network connection to Telegram. Depends on:
    • grammers-tl-types to initialize the connection and offer an ergonomic RPC interface.
    • grammers-session to persist the DC configuration and corresponding Authorization Keys.
    • grammers-mtproto to serialize messages and manage the connection state.
    • grammers-crypto for efficient buffer usage.
  • grammers-session : session storages for the client. Depends on:
    • grammers-tl-types to provide a more ergonomic interface over peers.
  • grammers-mtproto : implementation of the Mobile Transport Protocol. Depends on:
    • grammers-tl-types to invoke and parse the core messages of the protocol.
    • grammers-crypto to encrypt the communication with Telegram.
  • grammers-tl-types : generated Rust types for a certain layer. Depends on:
    • grammers-tl-gen to generate the Rust code that makes up the crate itself.
    • grammers-tl-parser to 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-parser to 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

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

Please only submit issues and pull requests authored entirely by you or other fellow humans. If you don't feel capable of authoring code yourself, I encourage you to still try, as I believe that's the best way to learn and get better. If you're still not comfortable, please submit a feature-request instead, for discussion, so that someone else can implement it instead.

You may use translation assistance if writing English is also not something you're comfortable with. But please choose a translation tool that doesn't overly try to rewrite and twist your thoughts. Browsers like Firefox have a decently good offline translator built-in that you may use.

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.