Skip to main content

Crate ferogram

Crate ferogram 

Source
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_WAIT auto-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 search::GlobalSearchBuilder;
pub use search::SearchBuilder;
pub use session_backend::SqliteBackend;sqlite-session
pub 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;parser
pub use ferogram_tl_gen as codegen;codegen

Modules§

authentication
Sans-IO MTProto authorization key generation.
builder
ClientBuilder for constructing a Config and 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 all Client methods.
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::Update to the first matching arm.

Structs§

AuthKey
A Telegram authorization key (256 bytes) plus pre-computed identifiers.
AutoSleep
Automatically sleep on FLOOD_WAIT and 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 DcOption bitmask.
Dialog
A Telegram dialog (chat, user, channel).
DialogIter
Cursor-based iterator over dialogs. Created by Client::iter_dialogs.
Finished
The final output of a successful auth key handshake.
FixedInterval
InputMessage
Builder for composing outgoing messages.
LoginToken
Opaque token returned by crate::Client::request_login_code.
MessageIter
Cursor-based iterator over message history. Created by Client::iter_messages.
NeverRestart
NoRetries
Never retry: propagate every error immediately.
PasswordToken
Opaque 2FA challenge token returned in SignInError::PasswordRequired.
PeerCache
Caches access hashes for users and channels so every API call carries the correct hash without re-resolving peers.
RetryContext
Context passed to RetryPolicy::should_retry on each failure.
RpcError
An error returned by Telegram’s servers in response to an RPC call.
UpdateStream
Asynchronous stream of Updates.

Enums§

InvocationError
The error type returned from any Client method that talks to Telegram.
SignInError
Errors returned by crate::Client::sign_in.
TransportKind
Which MTProto transport framing to use for all connections.

Constants§

LAYER
The API layer this code was generated from.

Traits§

ConnectionRestartPolicy
Identifiable
Every generated type has a unique 32-bit constructor ID.
RetryPolicy
Controls how the client reacts when an RPC call fails.
Serializable
Serialize self into TL binary format.

Functions§

finish
Finalise the handshake.
is_bool_false
is_bool_true
step1
Generate a req_pq_multi request. Returns the request + opaque state.
step2
Process ResPQ and generate req_DH_params.
step3
Process ServerDhParams into a reusable DhParamsForRetry + send the first set_client_DH_params request.

Type Aliases§

ShutdownToken
A token that can be used to gracefully shut down a Client.