Expand description
§ferogram
Async Telegram client built on MTProto.
§Features
- User login (phone + code + 2FA SRP) and bot token login
- Peer access-hash caching: API calls always carry correct access hashes
FLOOD_WAITauto-retry with configurable policy- Typed async update stream:
NewMessage,MessageEdited,MessageDeleted,CallbackQuery,InlineQuery,InlineSend,Raw - Send / edit / delete / forward / pin messages
- Search messages (per-chat and global)
- Mark as read, delete dialogs, clear mentions
- Join chat / accept invite links
- Chat action (typing, uploading, …)
get_me(): fetch own User info- Paginated dialog and message iterators
- DC migration, session persistence, reconnect
Re-exports§
pub use builder::BuilderError;pub use builder::ClientBuilder;pub use keyboard::Button;pub use keyboard::InlineKeyboard;pub use keyboard::ReplyKeyboard;pub use media::Document;pub use media::DownloadIter;pub use media::Downloadable;pub use media::Photo;pub use media::Sticker;pub use media::UploadedFile;pub use participants::Participant;pub use participants::ProfilePhotoIter;pub use peer_ref::PeerRef;pub use proxy::MtProxyConfig;pub use proxy::parse_proxy_link;pub use search::GlobalSearchBuilder;pub use search::SearchBuilder;pub use session_backend::SqliteBackend;sqlite-sessionpub use session_backend::BinaryFileBackend;pub use session_backend::InMemoryBackend;pub use session_backend::SessionBackend;pub use session_backend::StringSessionBackend;pub use session_backend::UpdateStateChange;pub use socks5::Socks5Config;pub use types::ChannelKind;pub use types::Channel;pub use types::Chat;pub use types::Group;pub use types::User;pub use typing_guard::TypingGuard;pub use update::Update;pub use update::ChatActionUpdate;pub use update::UserStatusUpdate;pub use ferogram_tl_types as tl;pub use ferogram_mtproto as mtproto;pub use ferogram_crypto as crypto;pub use ferogram_tl_parser as parser;parserpub use ferogram_tl_gen as codegen;codegen
Modules§
- authentication
- Sans-IO MTProto authorization key generation.
- builder
ClientBuilderfor constructing aConfigand connecting.- dc_
migration - DC migration helpers.
- dc_pool
- Multi-DC connection pool.
- inline_
iter - Inline query support: two directions:
- keyboard
- Inline keyboard builder: create reply markups without raw TL verbosity.
- macros
- The [
dispatch!] macro for pattern-matching over updates. - media
- Media upload, download, and typed wrappers.
- parsers
- Text formatting parsers: HTML and Markdown ↔ Telegram [
MessageEntity] - participants
- Chat participant and member management.
- peer_
ref PeerRef: flexible peer argument accepted by allClientmethods.- proxy
- MTProxy secret parsing, transport auto-selection, and TCP connect.
- pts
- Update gap detection and recovery.
- reactions
InputReactions: typed parameter for reacting to messages.- search
- Fluent search builders.
- session_
backend - Pluggable session storage backend.
- socks5
- SOCKS5 proxy connector.
- transport_
intermediate - MTProto Intermediate and Full transport framing.
- transport_
obfuscated - Obfuscated MTProto transport (Obfuscated2).
- types
- Typed wrappers over raw TL user and chat types.
- typing_
guard - RAII typing indicator guard.
- update
- High-level update types delivered by
crate::Client::stream_updates.
Macros§
- dispatch
- Route a
crate::update::Updateto the first matching arm.
Structs§
- AuthKey
- A Telegram authorization key (256 bytes) plus pre-computed identifiers.
- Auto
Sleep - Automatically sleep on
FLOOD_WAITand retry once on transient I/O errors. - Client
- The main Telegram client. Cheap to clone: internally Arc-wrapped.
- Config
- Configuration for
Client::connect. - DcEntry
- One entry in the DC address table.
- DcFlags
- Per-DC option flags mirroring the tDesktop
DcOptionbitmask. - Dialog
- A Telegram dialog (chat, user, channel).
- Dialog
Iter - Cursor-based iterator over dialogs. Created by
Client::iter_dialogs. - Finished
- The final output of a successful auth key handshake.
- Fixed
Interval - Input
Message - Builder for composing outgoing messages.
- Login
Token - Opaque token returned by
crate::Client::request_login_code. - Message
Iter - Cursor-based iterator over message history. Created by
Client::iter_messages. - Never
Restart - NoRetries
- Never retry: propagate every error immediately.
- Password
Token - Opaque 2FA challenge token returned in
SignInError::PasswordRequired. - Peer
Cache - Caches access hashes for users and channels so every API call carries the correct hash without re-resolving peers.
- Retry
Context - Context passed to
RetryPolicy::should_retryon each failure. - RpcError
- An error returned by Telegram’s servers in response to an RPC call.
- Update
Stream - Asynchronous stream of
Updates.
Enums§
- Invocation
Error - The error type returned from any
Clientmethod that talks to Telegram. - Sign
InError - Errors returned by
crate::Client::sign_in. - Transport
Kind - Which MTProto transport framing to use for all connections.
Constants§
- LAYER
- The API layer this code was generated from.
Traits§
- Connection
Restart Policy - Identifiable
- Every generated type has a unique 32-bit constructor ID.
- Retry
Policy - Controls how the client reacts when an RPC call fails.
- Serializable
- Serialize
selfinto TL binary format.
Functions§
- finish
- Finalise the handshake.
- is_
bool_ false - is_
bool_ true - step1
- Generate a
req_pq_multirequest. Returns the request + opaque state. - step2
- Process
ResPQand generatereq_DH_params. - step3
- Process
ServerDhParamsinto a reusableDhParamsForRetry+ send the firstset_client_DH_paramsrequest.
Type Aliases§
- Shutdown
Token - A token that can be used to gracefully shut down a
Client.