Expand description
§layer-client
Production-grade 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 update::Update;pub use media::UploadedFile;pub use media::DownloadIter;pub use participants::Participant;pub use typing_guard::TypingGuard;pub use socks5::Socks5Config;pub use session_backend::SessionBackend;pub use session_backend::BinaryFileBackend;pub use session_backend::InMemoryBackend;
Modules§
- dc_pool
- Multi-DC connection pool.
- inline_
iter - Paginated inline query iterator.
- media
- Media upload and download support.
- parsers
- Text formatting parsers: HTML and Markdown ↔ Telegram [
MessageEntity] - participants
- Chat participant and member management.
- pts
- Update gap detection and recovery via
updates.getDifference. - session_
backend - Pluggable session storage backend.
- socks5
- SOCKS5 proxy connector.
- transport_
intermediate - MTProto Intermediate and Full transport framing.
- transport_
obfuscated - Obfuscated MTProto transport.
- typing_
guard - RAII typing indicator guard.
- update
- High-level update types delivered by
crate::Client::stream_updates.
Structs§
- Auto
Sleep - Automatically sleep on FLOOD_WAIT and retry once on I/O errors.
- Client
- The main Telegram client. Cheap to clone — internally Arc-wrapped.
- Config
- Configuration for
Client::connect. - Dialog
- A Telegram dialog (chat, user, channel).
- Dialog
Iter - Cursor-based iterator over dialogs. Created by
Client::iter_dialogs. - 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. - NoRetries
- Never retry.
- Password
Token - Opaque 2FA challenge token returned in
SignInError::PasswordRequired. - 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.
Traits§
- Retry
Policy - Controls how the client reacts when an RPC call fails.