pub struct Client { /* private fields */ }Expand description
The main Telegram client. Cheap to clone: internally Arc-wrapped.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn bot_sign_in(&self, token: &str) -> Result<String, InvocationError>
pub async fn bot_sign_in(&self, token: &str) -> Result<String, InvocationError>
Sign in as a bot.
Sourcepub async fn request_login_code(
&self,
phone: &str,
) -> Result<LoginToken, InvocationError>
pub async fn request_login_code( &self, phone: &str, ) -> Result<LoginToken, InvocationError>
Request a login code for a user account.
Sourcepub async fn sign_in(
&self,
token: &LoginToken,
code: &str,
) -> Result<String, SignInError>
pub async fn sign_in( &self, token: &LoginToken, code: &str, ) -> Result<String, SignInError>
Complete sign-in with the code sent to the phone.
Sourcepub async fn check_password(
&self,
token: PasswordToken,
password: impl AsRef<[u8]>,
) -> Result<String, InvocationError>
pub async fn check_password( &self, token: PasswordToken, password: impl AsRef<[u8]>, ) -> Result<String, InvocationError>
Complete 2FA login.
Sourcepub async fn sign_out(&self) -> Result<bool, InvocationError>
pub async fn sign_out(&self) -> Result<bool, InvocationError>
Sign out and invalidate the current session.
Sourcepub async fn get_users_by_id(
&self,
ids: &[i64],
) -> Result<Vec<Option<User>>, InvocationError>
pub async fn get_users_by_id( &self, ids: &[i64], ) -> Result<Vec<Option<User>>, InvocationError>
Fetch user info by ID. Returns None for each ID that is not found.
Used internally by update::IncomingMessage::sender_user.
Sourcepub async fn get_user_from_message(
&self,
peer: InputPeer,
msg_id: i32,
user_id: i64,
) -> Result<Option<User>, InvocationError>
pub async fn get_user_from_message( &self, peer: InputPeer, msg_id: i32, user_id: i64, ) -> Result<Option<User>, InvocationError>
Resolve a user by message context (no access_hash required).
Returns None if Telegram returns no matching user.
Sourcepub async fn get_me(&self) -> Result<User, InvocationError>
pub async fn get_me(&self) -> Result<User, InvocationError>
Fetch information about the logged-in user.
Sourcepub async fn export_login_token(
&self,
) -> Result<(Vec<u8>, i32), InvocationError>
pub async fn export_login_token( &self, ) -> Result<(Vec<u8>, i32), InvocationError>
Generate a QR-code login token.
Returns (token_bytes, expires_unix_ts). Encode token_bytes as a
tg://login?token=<base64url> URL and present as a QR code.
Call [import_qr_token] once the user scans it, then poll until you
receive Update::Raw with updateLoginToken (constructor 0x564fe691),
or call [export_login_token] again to check.
§Example
let (token, expires) = client.export_login_token().await?;
// base64url-encode `token` and make a QR codeSourcepub async fn check_qr_login(
&self,
token: Vec<u8>,
) -> Result<Option<String>, InvocationError>
pub async fn check_qr_login( &self, token: Vec<u8>, ) -> Result<Option<String>, InvocationError>
Check whether a QR-code token has been scanned.
Returns Some(username) if the user has scanned and confirmed the QR
code, or None if still pending.
Source§impl Client
impl Client
Sourcepub async fn delete_channel(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn delete_channel( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Permanently delete a channel or supergroup.
Only the creator can delete a channel. This action is irreversible.
Sourcepub async fn delete_chat(&self, chat_id: i64) -> Result<(), InvocationError>
pub async fn delete_chat(&self, chat_id: i64) -> Result<(), InvocationError>
Delete a legacy group chat (basic group).
Only the creator can delete the chat. For channels use [delete_channel].
Sourcepub async fn leave_chat(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn leave_chat( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Leave a channel or supergroup.
For basic groups, kick yourself with [kick_participant] or use
[delete_dialog] to just hide it.
Sourcepub async fn migrate_chat(&self, chat_id: i64) -> Result<Chat, InvocationError>
pub async fn migrate_chat(&self, chat_id: i64) -> Result<Chat, InvocationError>
Upgrade a legacy group to a supergroup (megagroup).
Returns the new channel/supergroup peer. The original chat ID becomes invalid after migration.
Source§impl Client
impl Client
Sourcepub async fn get_dialogs(
&self,
limit: i32,
) -> Result<Vec<Dialog>, InvocationError>
pub async fn get_dialogs( &self, limit: i32, ) -> Result<Vec<Dialog>, InvocationError>
Fetch up to limit dialogs, most recent first. Populates entity/message.
pub async fn delete_dialog( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Sourcepub async fn mark_as_read(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn mark_as_read( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Mark all messages in a chat as read.
Sourcepub async fn clear_mentions(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn clear_mentions( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Clear unread mention markers.
Sourcepub async fn join_chat(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn join_chat( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Join a public chat or channel by username/peer.
Sourcepub async fn accept_invite_link(
&self,
link: &str,
) -> Result<(), InvocationError>
pub async fn accept_invite_link( &self, link: &str, ) -> Result<(), InvocationError>
Accept and join via an invite link.
Sourcepub fn parse_invite_hash(link: &str) -> Option<&str>
pub fn parse_invite_hash(link: &str) -> Option<&str>
Extract hash from https://t.me/+HASH or https://t.me/joinchat/HASH.
Sourcepub fn iter_dialogs(&self) -> DialogIter
pub fn iter_dialogs(&self) -> DialogIter
Returns a DialogIter that can be advanced with DialogIter::next.
Lets you page through all dialogs without loading them all at once.
§Example
let mut iter = client.iter_dialogs();
while let Some(dialog) = iter.next(&client).await? {
println!("{}", dialog.title());
}Sourcepub fn iter_messages(&self, peer: impl Into<PeerRef>) -> MessageIter
pub fn iter_messages(&self, peer: impl Into<PeerRef>) -> MessageIter
Fetch messages from a peer, page by page.
Returns a MessageIter that can be advanced with MessageIter::next.
§Example
let mut iter = client.iter_messages(peer);
while let Some(msg) = iter.next(&client).await? {
println!("{:?}", msg.text());
}Sourcepub async fn sync_drafts(&self) -> Result<(), InvocationError>
pub async fn sync_drafts(&self) -> Result<(), InvocationError>
Fetch all saved drafts across all chats.
The server responds with an Updates containing updateDraftMessage
entries; this method triggers that push and returns immediately.
Sourcepub async fn clear_all_drafts(&self) -> Result<(), InvocationError>
pub async fn clear_all_drafts(&self) -> Result<(), InvocationError>
Delete all saved drafts across all chats.
Sourcepub async fn pin_dialog(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn pin_dialog( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Pin a dialog to the top of the dialog list.
Sourcepub async fn unpin_dialog(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn unpin_dialog( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Unpin a previously pinned dialog.
Sourcepub async fn archive_chat(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn archive_chat( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Archive a dialog (move it to folder 1).
Archived chats are hidden from the main dialog list.
§Example
client.archive_chat("@somebot").await?;Sourcepub async fn unarchive_chat(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn unarchive_chat( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Unarchive a dialog (move it back to folder 0 - the main list).
§Example
client.unarchive_chat("@somebot").await?;Sourcepub async fn mark_dialog_read(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn mark_dialog_read( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Mark a dialog as read (clears the unread mark).
Source§impl Client
impl Client
Sourcepub fn search(&self, peer: impl Into<PeerRef>, query: &str) -> SearchBuilder
pub fn search(&self, peer: impl Into<PeerRef>, query: &str) -> SearchBuilder
Fluent search builder for in-chat message search.
Sourcepub fn search_global(&self, query: &str) -> GlobalSearchBuilder
pub fn search_global(&self, query: &str) -> GlobalSearchBuilder
Fluent builder for global cross-chat search.
Source§impl Client
impl Client
Sourcepub async fn read_reactions(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn read_reactions( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Mark all unread reactions in a chat as read.
Sourcepub async fn clear_recent_reactions(&self) -> Result<(), InvocationError>
pub async fn clear_recent_reactions(&self) -> Result<(), InvocationError>
Clear the recent reactions list shown in the reaction picker.
Sourcepub async fn get_online_count(
&self,
peer: impl Into<PeerRef>,
) -> Result<i32, InvocationError>
pub async fn get_online_count( &self, peer: impl Into<PeerRef>, ) -> Result<i32, InvocationError>
Get the approximate number of online members in a group or channel.
Source§impl Client
impl Client
Sourcepub async fn get_contacts(&self) -> Result<Vec<User>, InvocationError>
pub async fn get_contacts(&self) -> Result<Vec<User>, InvocationError>
Fetch the full contact list of the current user.
Returns an empty list when the server reports no changes since the last fetch.
Sourcepub async fn delete_contacts(
&self,
user_ids: &[i64],
) -> Result<(), InvocationError>
pub async fn delete_contacts( &self, user_ids: &[i64], ) -> Result<(), InvocationError>
Remove one or more users from the contact list.
Sourcepub async fn block_user(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn block_user( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Block a user or peer so they can no longer send you messages.
Sourcepub async fn unblock_user(
&self,
peer: impl Into<PeerRef>,
) -> Result<(), InvocationError>
pub async fn unblock_user( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
Unblock a previously blocked user or peer.
Sourcepub async fn set_online(&self) -> Result<(), InvocationError>
pub async fn set_online(&self) -> Result<(), InvocationError>
Appear online to other users.
Sourcepub async fn set_offline(&self) -> Result<(), InvocationError>
pub async fn set_offline(&self) -> Result<(), InvocationError>
Appear offline immediately.
Sourcepub async fn terminate_session(&self, hash: i64) -> Result<(), InvocationError>
pub async fn terminate_session(&self, hash: i64) -> Result<(), InvocationError>
Terminate a specific session by its hash (obtained from [get_authorizations]).
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Return a fluent [ClientBuilder] for constructing and connecting a client.
§Example
let (client, _shutdown) = Client::builder()
.api_id(12345)
.api_hash("abc123")
.session("my.session")
.catch_up(true)
.connect().await?;pub async fn connect( config: Config, ) -> Result<(Self, ShutdownToken), InvocationError>
Sourcepub async fn save_session(&self) -> Result<(), InvocationError>
pub async fn save_session(&self) -> Result<(), InvocationError>
Persist the current session to the configured [SessionBackend].
Sourcepub async fn export_session_string(&self) -> Result<String, InvocationError>
pub async fn export_session_string(&self) -> Result<String, InvocationError>
Export the current session as a portable URL-safe base64 string.
The returned string encodes the auth key, DC, update state, and peer
cache. Store it in an environment variable or secret manager and pass
it back via Config::with_string_session to restore the session
without re-authenticating.
Sourcepub async fn media_dc_addr(&self, dc_id: i32) -> Option<String>
pub async fn media_dc_addr(&self, dc_id: i32) -> Option<String>
Return the media-only DC address for the given DC id, if known.
Media DCs (media_only = true in DcOption) are preferred for file
uploads and downloads because they are not subject to the API rate
limits applied to the main DC connection.
Sourcepub async fn best_media_dc_addr(&self) -> Option<(i32, String)>
pub async fn best_media_dc_addr(&self) -> Option<(i32, String)>
Return the best media DC address for the current home DC (falls back to any known media DC if no home-DC media entry exists).
Returns true if the client is already authorized.
Sourcepub fn stream_updates(&self) -> UpdateStream
pub fn stream_updates(&self) -> UpdateStream
Return an UpdateStream that yields incoming [Update]s.
The reader task (started inside connect()) sends all updates to
inner.update_tx. This method proxies those updates into a fresh
caller-owned channel: typically called once per bot/app loop.
Sourcepub fn signal_network_restored(&self)
pub fn signal_network_restored(&self)
Signal that network connectivity has been restored.
Call this from platform network-change callbacks: Android’s
ConnectivityManager, iOS NWPathMonitor, or any other OS hook
to make the client attempt an immediate reconnect instead of waiting
for the exponential backoff timer to expire.
Safe to call at any time: if the connection is healthy the hint is silently ignored by the reader task; if it is in a backoff loop it wakes up and tries again right away.
pub async fn send_message( &self, peer: impl Into<PeerRef>, msg: impl Into<InputMessage>, ) -> Result<IncomingMessage, InvocationError>
pub async fn open_mini_app( &self, peer: impl Into<PeerRef>, app: MiniApp, ) -> Result<MiniAppSession, InvocationError>
pub async fn send_to_self( &self, msg: impl Into<InputMessage>, ) -> Result<IncomingMessage, InvocationError>
Sourcepub async fn edit_message(
&self,
peer: impl Into<PeerRef>,
message_id: i32,
new_text: impl Into<InputMessage>,
) -> Result<(), InvocationError>
pub async fn edit_message( &self, peer: impl Into<PeerRef>, message_id: i32, new_text: impl Into<InputMessage>, ) -> Result<(), InvocationError>
Edit the text of an existing message.
pub async fn forward_messages( &self, destination: impl Into<PeerRef>, message_ids: &[i32], source: impl Into<PeerRef>, opts: ForwardOptions, ) -> Result<Vec<IncomingMessage>, InvocationError>
pub async fn delete_messages( &self, message_ids: &[i32], revoke: bool, ) -> Result<(), InvocationError>
Sourcepub async fn get_message_by_id(
&self,
peer: impl Into<PeerRef>,
id: i32,
) -> Result<Option<IncomingMessage>, InvocationError>
pub async fn get_message_by_id( &self, peer: impl Into<PeerRef>, id: i32, ) -> Result<Option<IncomingMessage>, InvocationError>
Fetch a single message by ID.
pub async fn get_messages_by_id( &self, peer: impl Into<PeerRef>, ids: &[i32], ) -> Result<Vec<IncomingMessage>, InvocationError>
pub async fn get_pinned_message( &self, peer: impl Into<PeerRef>, ) -> Result<Option<IncomingMessage>, InvocationError>
pub async fn pin_message( &self, peer: impl Into<PeerRef>, message_id: i32, silent: bool, ) -> Result<(), InvocationError>
pub async fn unpin_message( &self, peer: impl Into<PeerRef>, message_id: i32, ) -> Result<(), InvocationError>
pub async fn unpin_all_messages( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
pub async fn get_scheduled_messages( &self, peer: impl Into<PeerRef>, ) -> Result<Vec<IncomingMessage>, InvocationError>
pub async fn delete_scheduled_messages( &self, peer: impl Into<PeerRef>, ids: &[i32], ) -> Result<(), InvocationError>
pub async fn answer_callback_query( &self, query_id: i64, text: Option<&str>, alert: bool, ) -> Result<bool, InvocationError>
pub async fn answer_inline_query( &self, query_id: i64, results: Vec<InputBotInlineResult>, cache_time: i32, is_personal: bool, next_offset: Option<String>, ) -> Result<bool, InvocationError>
pub async fn get_dialogs_slice( &self, req: GetDialogs, ) -> Result<Vec<Dialog>, InvocationError>
pub async fn get_dialogs_paginated( &self, req: GetDialogs, ) -> Result<(Vec<Dialog>, Option<i32>), InvocationError>
pub async fn get_message_history( &self, peer: impl Into<PeerRef>, limit: i32, offset_id: i32, ) -> Result<Vec<IncomingMessage>, InvocationError>
pub async fn download_file( &self, location: InputFileLocation, path: impl AsRef<Path>, ) -> Result<(), InvocationError>
pub async fn download_file_to_path( &self, location: InputFileLocation, dc_id: i32, path: impl AsRef<Path>, ) -> Result<(), InvocationError>
pub async fn send_chat_action( &self, peer: impl Into<PeerRef>, action: SendMessageAction, ) -> Result<(), InvocationError>
pub async fn get_history_range( &self, peer: impl Into<PeerRef>, limit: i32, offset_id: i32, ) -> Result<Vec<IncomingMessage>, InvocationError>
Sourcepub async fn resolve<P: Into<PeerRef>>(
&self,
peer: P,
) -> Result<Peer, InvocationError>
pub async fn resolve<P: Into<PeerRef>>( &self, peer: P, ) -> Result<Peer, InvocationError>
Resolve any peer reference to a tl::enums::Peer.
Accepts everything PeerRef accepts:
&str/String:"@username","me","self", numeric string,t.me/URL, invite link, E.164 phonei64/i32: Bot-API encoded numeric IDtl::enums::Peer: returned as-is (zero cost)tl::enums::InputPeer: hash cached, then stripped toPeer
Resolution is cache-first; an RPC is only made on a genuine cache miss.
Sourcepub async fn resolve_peer(&self, peer: &str) -> Result<Peer, InvocationError>
pub async fn resolve_peer(&self, peer: &str) -> Result<Peer, InvocationError>
Resolve a peer string to a tl::enums::Peer.
Accepts: "me", "self", "@username", "username", numeric strings
(Bot-API encoded), t.me/ URLs, E.164 phones (+digits), and invite
links. Cache-first for usernames and phones; RPC only on miss.
Prefer Client::resolve when the input may not be a string.
Sourcepub async fn join_by_invite(
&self,
link: &str,
) -> Result<InputPeer, InvocationError>
pub async fn join_by_invite( &self, link: &str, ) -> Result<InputPeer, InvocationError>
Join a chat by invite link and return its InputPeer.
Calls messages.importChatInvite, caches all returned entities, and
returns the InputPeer of the joined chat.
Sourcepub async fn check_invite(
&self,
link: &str,
) -> Result<ChatInvite, InvocationError>
pub async fn check_invite( &self, link: &str, ) -> Result<ChatInvite, InvocationError>
Peek at an invite link without joining.
Returns the title and participant count of the chat the link points to.
pub async fn invoke<R: RemoteCall>( &self, req: &R, ) -> Result<R::Return, InvocationError>
Sourcepub fn disconnect(&self)
pub fn disconnect(&self)
Gracefully shut down the client.
Signals the reader task to exit cleanly. Same as cancelling the
ShutdownToken returned from Client::connect.
In-flight RPCs will receive a Dropped error. Call save_session()
before this if you want to persist the current auth state.
Sourcepub async fn warm_peer_cache_from_dialogs(&self) -> Result<(), InvocationError>
pub async fn warm_peer_cache_from_dialogs(&self) -> Result<(), InvocationError>
Warm the peer cache with access_hashes by fetching the first page of
dialogs (messages.getDialogs).
§When to use
This is an explicit, opt-in cache-warming call. It is not called automatically during startup. Access hashes are resolved lazily:
- Channels already seen in a previous session have their hash restored
from the persisted
peerslist in the session file. - New channels receive their hash from the entities embedded in incoming
updates,
getDifference, orgetChannelDifferenceresponses.
Call this only when you know that a channel the client needs to interact
with has never appeared in an update (e.g. the very first send_message
to a channel before any update has been received).
§Why it is not called at startup
messages.getDialogs forces full deserialization of
Dialog / DraftMessage / PollResults / PeerNotifySettings / Story.
These are high-churn Telegram objects that change silently across beta
layers, causing spurious parse failures that break startup even when the
bot would otherwise work perfectly. Removing this from the startup path
makes Ferogram resilient to Telegram schema drift - exactly the strategy
Sourcepub async fn resolve_to_input_peer(
&self,
peer: &Peer,
) -> Result<InputPeer, InvocationError>
pub async fn resolve_to_input_peer( &self, peer: &Peer, ) -> Result<InputPeer, InvocationError>
Try to resolve a peer to InputPeer, returning an error if the access_hash is unknown (i.e. the peer has not been seen in any prior API call).
Sourcepub async fn invoke_on_dc<R: RemoteCall>(
&self,
dc_id: i32,
req: &R,
) -> Result<R::Return, InvocationError>
pub async fn invoke_on_dc<R: RemoteCall>( &self, dc_id: i32, req: &R, ) -> Result<R::Return, InvocationError>
Invoke a request on a specific DC, using the pool.
If the target DC has no auth key yet, one is acquired via DH and then
authorized via auth.exportAuthorization / auth.importAuthorization
so the worker DC can serve user-account requests too.
pub async fn answer_precheckout_query( &self, query_id: i64, ok: bool, error_message: Option<String>, ) -> Result<(), InvocationError>
pub async fn answer_shipping_query( &self, query_id: i64, error: Option<String>, shipping_options: Option<Vec<ShippingOption>>, ) -> Result<(), InvocationError>
pub async fn start_bot( &self, bot_user_id: i64, peer: impl Into<PeerRef>, start_param: impl Into<String>, ) -> Result<(), InvocationError>
pub async fn set_game_score( &self, peer: impl Into<PeerRef>, msg_id: i32, user_id: i64, score: i32, force: bool, edit_message: bool, ) -> Result<(), InvocationError>
pub async fn get_game_high_scores( &self, peer: impl Into<PeerRef>, msg_id: i32, user_id: i64, ) -> Result<Vec<HighScore>, InvocationError>
pub async fn edit_inline_message( &self, id: InputBotInlineMessageId, new_text: &str, reply_markup: Option<ReplyMarkup>, ) -> Result<bool, InvocationError>
pub async fn send_dice( &self, peer: impl Into<PeerRef>, emoticon: impl Into<String>, ) -> Result<(), InvocationError>
pub async fn send_poll( &self, peer: impl Into<PeerRef>, question: impl Into<String>, answers: &[impl AsRef<str>], quiz: bool, correct_index: Option<usize>, multiple_choice: bool, ) -> Result<(), InvocationError>
pub async fn set_bot_commands( &self, commands: &[(&str, &str)], scope: Option<BotCommandScope>, lang_code: &str, ) -> Result<bool, InvocationError>
pub async fn delete_bot_commands( &self, scope: Option<BotCommandScope>, lang_code: &str, ) -> Result<bool, InvocationError>
pub async fn set_bot_info( &self, name: Option<&str>, about: Option<&str>, description: Option<&str>, lang_code: &str, ) -> Result<bool, InvocationError>
pub async fn get_bot_info( &self, lang_code: &str, ) -> Result<BotInfo, InvocationError>
pub async fn send_invoice( &self, peer: impl Into<PeerRef>, title: impl Into<String>, description: impl Into<String>, payload: impl Into<String>, options: InvoiceOptions, ) -> Result<IncomingMessage, InvocationError>
pub async fn get_chat_full( &self, peer: impl Into<PeerRef>, ) -> Result<ChatFull, InvocationError>
pub async fn delete_chat_history( &self, peer: impl Into<PeerRef>, max_id: i32, revoke: bool, ) -> Result<(), InvocationError>
pub async fn save_draft( &self, peer: impl Into<PeerRef>, text: impl Into<String>, ) -> Result<(), InvocationError>
pub async fn get_pinned_dialogs( &self, folder_id: i32, ) -> Result<Vec<Dialog>, InvocationError>
pub async fn mark_dialog_unread( &self, peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
pub async fn download_media_to_file( &self, location: InputFileLocation, path: impl AsRef<Path>, ) -> Result<(), InvocationError>
pub async fn upload_media( &self, peer: impl Into<PeerRef>, media: InputMedia, ) -> Result<MessageMedia, InvocationError>
pub async fn get_media_group( &self, peer: impl Into<PeerRef>, msg_id: i32, ) -> Result<Vec<IncomingMessage>, InvocationError>
pub async fn create_group( &self, title: impl Into<String>, user_ids: Vec<i64>, ) -> Result<Chat, InvocationError>
pub async fn create_channel( &self, title: impl Into<String>, about: impl Into<String>, broadcast: bool, ) -> Result<Chat, InvocationError>
pub async fn edit_chat_title( &self, peer: impl Into<PeerRef>, title: impl Into<String>, ) -> Result<(), InvocationError>
pub async fn edit_chat_about( &self, peer: impl Into<PeerRef>, about: impl Into<String>, ) -> Result<(), InvocationError>
pub async fn edit_chat_photo( &self, peer: impl Into<PeerRef>, photo: InputChatPhoto, ) -> Result<(), InvocationError>
pub async fn edit_chat_default_banned_rights( &self, peer: impl Into<PeerRef>, build: impl FnOnce(BannedRightsBuilder) -> BannedRightsBuilder, ) -> Result<(), InvocationError>
pub async fn upload_profile_photo( &self, file: UploadedFile, ) -> Result<Photo, InvocationError>
pub async fn invite_users( &self, peer: impl Into<PeerRef>, user_ids: &[i64], ) -> Result<(), InvocationError>
pub async fn set_history_ttl( &self, peer: impl Into<PeerRef>, period: i32, ) -> Result<(), InvocationError>
pub async fn get_common_chats( &self, user_id: i64, max_id: i64, limit: i32, ) -> Result<Vec<Chat>, InvocationError>
pub async fn export_invite_link( &self, peer: impl Into<PeerRef>, expire_date: Option<i32>, usage_limit: Option<i32>, request_needed: bool, title: Option<String>, ) -> Result<ExportedChatInvite, InvocationError>
pub async fn revoke_invite_link( &self, peer: impl Into<PeerRef>, link: impl Into<String>, ) -> Result<ExportedChatInvite, InvocationError>
pub async fn edit_invite_link( &self, peer: impl Into<PeerRef>, link: impl Into<String>, expire_date: Option<i32>, usage_limit: Option<i32>, request_needed: Option<bool>, title: Option<String>, ) -> Result<ExportedChatInvite, InvocationError>
pub async fn get_invite_links( &self, peer: impl Into<PeerRef>, admin_id: i64, revoked: bool, limit: i32, offset_date: Option<i32>, offset_link: Option<String>, ) -> Result<Vec<ExportedChatInvite>, InvocationError>
pub async fn delete_invite_link( &self, peer: impl Into<PeerRef>, link: impl Into<String>, ) -> Result<(), InvocationError>
pub async fn delete_revoked_invite_links( &self, peer: impl Into<PeerRef>, admin_id: i64, ) -> Result<(), InvocationError>
pub async fn join_request( &self, peer: impl Into<PeerRef>, user_id: i64, approve: bool, ) -> Result<(), InvocationError>
pub async fn all_join_requests( &self, peer: impl Into<PeerRef>, approve: bool, link: Option<String>, ) -> Result<(), InvocationError>
pub async fn get_invite_link_members( &self, peer: impl Into<PeerRef>, link: Option<String>, requested: bool, limit: i32, offset_date: i32, offset_user_id: i64, ) -> Result<Vec<ChatInviteImporter>, InvocationError>
pub async fn get_admins_with_invites( &self, peer: impl Into<PeerRef>, ) -> Result<ChatAdminsWithInvites, InvocationError>
pub async fn get_chat_administrators( &self, peer: impl Into<PeerRef>, ) -> Result<Vec<Participant>, InvocationError>
pub async fn get_forum_topics( &self, peer: impl Into<PeerRef>, query: Option<String>, limit: i32, offset_date: i32, offset_id: i32, offset_topic: i32, ) -> Result<Vec<ForumTopic>, InvocationError>
pub async fn get_forum_topics_by_id( &self, peer: impl Into<PeerRef>, topic_ids: Vec<i32>, ) -> Result<Vec<ForumTopic>, InvocationError>
pub async fn create_forum_topic( &self, peer: impl Into<PeerRef>, title: impl Into<String>, icon_color: Option<i32>, icon_emoji_id: Option<i64>, ) -> Result<(), InvocationError>
pub async fn edit_forum_topic( &self, peer: impl Into<PeerRef>, topic_id: i32, title: Option<String>, icon_emoji_id: Option<i64>, closed: Option<bool>, hidden: Option<bool>, ) -> Result<(), InvocationError>
pub async fn delete_forum_topic_history( &self, peer: impl Into<PeerRef>, top_msg_id: i32, ) -> Result<(), InvocationError>
pub async fn toggle_forum( &self, peer: impl Into<PeerRef>, enabled: bool, ) -> Result<(), InvocationError>
pub async fn transfer_chat_ownership( &self, peer: impl Into<PeerRef>, new_owner_id: i64, password: InputCheckPasswordSrp, ) -> Result<(), InvocationError>
pub async fn get_linked_channel( &self, peer: impl Into<PeerRef>, ) -> Result<Option<i64>, InvocationError>
pub async fn add_contact( &self, user_id: i64, first_name: impl Into<String>, last_name: impl Into<String>, phone: impl Into<String>, add_phone_privacy_exception: bool, ) -> Result<(), InvocationError>
pub async fn import_contacts( &self, contacts: &[(&str, &str, &str)], ) -> Result<ImportedContacts, InvocationError>
pub async fn get_blocked_users( &self, offset: i32, limit: i32, ) -> Result<Vec<Peer>, InvocationError>
pub async fn search_contacts( &self, query: impl Into<String>, limit: i32, ) -> Result<Vec<Peer>, InvocationError>
pub async fn set_profile_photo( &self, file: UploadedFile, ) -> Result<Photo, InvocationError>
pub async fn delete_profile_photos( &self, photo_ids: Vec<(i64, i64, Vec<u8>)>, ) -> Result<Vec<i64>, InvocationError>
pub async fn set_profile( &self, first_name: Option<String>, last_name: Option<String>, about: Option<String>, ) -> Result<User, InvocationError>
pub async fn set_username( &self, username: impl Into<String>, ) -> Result<User, InvocationError>
pub async fn get_user_full( &self, user_id: i64, ) -> Result<UserFull, InvocationError>
pub async fn set_emoji_status( &self, document_id: Option<i64>, until: Option<i32>, ) -> Result<(), InvocationError>
pub async fn get_broadcast_stats( &self, peer: impl Into<PeerRef>, ) -> Result<BroadcastStats, InvocationError>
pub async fn get_megagroup_stats( &self, peer: impl Into<PeerRef>, ) -> Result<MegagroupStats, InvocationError>
pub async fn send_scheduled_now( &self, peer: impl Into<PeerRef>, ids: &[i32], ) -> Result<(), InvocationError>
pub async fn get_message_read_participants( &self, peer: impl Into<PeerRef>, msg_id: i32, ) -> Result<Vec<ReadParticipantDate>, InvocationError>
pub async fn get_replies( &self, peer: impl Into<PeerRef>, msg_id: i32, limit: i32, offset_id: i32, ) -> Result<Vec<IncomingMessage>, InvocationError>
pub async fn get_discussion_message( &self, peer: impl Into<PeerRef>, msg_id: i32, ) -> Result<DiscussionMessage, InvocationError>
pub async fn read_discussion( &self, peer: impl Into<PeerRef>, msg_id: i32, read_max_id: i32, ) -> Result<(), InvocationError>
pub async fn get_web_page_preview( &self, text: impl Into<String>, ) -> Result<MessageMedia, InvocationError>
pub async fn get_reactions( &self, peer: impl Into<PeerRef>, msg_ids: Vec<i32>, ) -> Result<(), InvocationError>
pub async fn iter_reaction_users( &self, peer: impl Into<PeerRef>, msg_id: i32, reaction: Option<Reaction>, limit: i32, offset: Option<String>, ) -> Result<MessageReactionsList, InvocationError>
pub async fn send_paid_reaction( &self, peer: impl Into<PeerRef>, msg_id: i32, count: i32, ) -> Result<(), InvocationError>
pub async fn translate_messages( &self, peer: impl Into<PeerRef>, msg_ids: Vec<i32>, to_lang: impl Into<String>, ) -> Result<Vec<TextWithEntities>, InvocationError>
pub async fn transcribe_audio( &self, peer: impl Into<PeerRef>, msg_id: i32, ) -> Result<TranscribedAudio, InvocationError>
pub async fn toggle_peer_translations( &self, peer: impl Into<PeerRef>, disabled: bool, ) -> Result<(), InvocationError>
pub async fn get_admin_log( &self, peer: impl Into<PeerRef>, query: impl Into<String>, limit: i32, max_id: i64, min_id: i64, ) -> Result<Vec<ChannelAdminLogEvent>, InvocationError>
pub async fn toggle_no_forwards( &self, peer: impl Into<PeerRef>, enabled: bool, ) -> Result<(), InvocationError>
pub async fn set_chat_theme( &self, peer: impl Into<PeerRef>, emoticon: impl Into<String>, ) -> Result<(), InvocationError>
pub async fn set_chat_reactions( &self, peer: impl Into<PeerRef>, reactions: ChatReactions, ) -> Result<(), InvocationError>
pub async fn export_message_link( &self, peer: impl Into<PeerRef>, msg_id: i32, kind: LinkKind, ) -> Result<String, InvocationError>
pub async fn get_send_as_peers( &self, peer: impl Into<PeerRef>, ) -> Result<Vec<Peer>, InvocationError>
pub async fn set_default_send_as( &self, peer: impl Into<PeerRef>, send_as_peer: impl Into<PeerRef>, ) -> Result<(), InvocationError>
pub async fn send_vote( &self, peer: impl Into<PeerRef>, msg_id: i32, options: Vec<Vec<u8>>, ) -> Result<(), InvocationError>
pub async fn get_poll_results( &self, peer: impl Into<PeerRef>, msg_id: i32, poll_hash: i64, ) -> Result<(), InvocationError>
pub async fn get_poll_votes( &self, peer: impl Into<PeerRef>, msg_id: i32, option: Option<Vec<u8>>, limit: i32, offset: Option<String>, ) -> Result<VotesList, InvocationError>
pub async fn get_sticker_set( &self, stickerset: InputStickerSet, ) -> Result<StickerSet, InvocationError>
pub async fn install_sticker_set( &self, stickerset: InputStickerSet, archived: bool, ) -> Result<StickerSetInstallResult, InvocationError>
pub async fn uninstall_sticker_set( &self, stickerset: InputStickerSet, ) -> Result<(), InvocationError>
pub async fn get_all_stickers( &self, hash: i64, ) -> Result<Option<Vec<StickerSet>>, InvocationError>
pub async fn get_custom_emoji_documents( &self, document_ids: Vec<i64>, ) -> Result<Vec<Document>, InvocationError>
pub async fn get_privacy( &self, key: InputPrivacyKey, ) -> Result<Vec<PrivacyRule>, InvocationError>
pub async fn set_privacy( &self, key: InputPrivacyKey, rules: Vec<InputPrivacyRule>, ) -> Result<Vec<PrivacyRule>, InvocationError>
pub async fn get_notify_settings( &self, peer: impl Into<PeerRef>, ) -> Result<PeerNotifySettings, InvocationError>
pub async fn update_notify_settings( &self, peer: impl Into<PeerRef>, settings: InputPeerNotifySettings, ) -> Result<(), InvocationError>
Source§impl Client
impl Client
Sourcepub async fn upload_file(
&self,
data: &[u8],
name: &str,
mime_type: &str,
) -> Result<UploadedFile, InvocationError>
pub async fn upload_file( &self, data: &[u8], name: &str, mime_type: &str, ) -> Result<UploadedFile, InvocationError>
Upload bytes sequentially (single session).
Part size and big-file threshold:
- Part size chosen by
upload_part_size: < 1 MB → 32 KB, 1–32 MB → 64 KB, 32–512 MB → 128 KB, etc. upload.saveBigFilePartused for files > 30 MB (kUseBigFilesFrom).
For files that benefit from parallelism use [upload_file_concurrent].
Sourcepub async fn upload_file_concurrent(
&self,
data: Arc<Vec<u8>>,
name: &str,
mime_type: &str,
) -> Result<UploadedFile, InvocationError>
pub async fn upload_file_concurrent( &self, data: Arc<Vec<u8>>, name: &str, mime_type: &str, ) -> Result<UploadedFile, InvocationError>
Upload bytes with parallel worker sessions.
Parallel upload using per-worker connections. Worker count scales with file size. Part size: 32 KB for tiny files, 512 KB otherwise.
- Files < 10 MB ->
upload.saveFilePart(small-file API) - Files >= 10 MB ->
upload.saveBigFilePart(big-file API)
Sourcepub async fn upload_stream<R: AsyncRead + Unpin>(
&self,
reader: &mut R,
name: &str,
mime_type: &str,
) -> Result<UploadedFile, InvocationError>
pub async fn upload_stream<R: AsyncRead + Unpin>( &self, reader: &mut R, name: &str, mime_type: &str, ) -> Result<UploadedFile, InvocationError>
Upload from an AsyncRead. Reads fully into memory then uploads.
Sourcepub async fn send_file(
&self,
peer: impl Into<PeerRef>,
media: InputMedia,
msg: &InputMessage,
) -> Result<IncomingMessage, InvocationError>
pub async fn send_file( &self, peer: impl Into<PeerRef>, media: InputMedia, msg: &InputMessage, ) -> Result<IncomingMessage, InvocationError>
Send a file as a document or photo to a chat.
Sourcepub async fn send_album(
&self,
peer: impl Into<PeerRef>,
items: Vec<AlbumItem>,
) -> Result<Vec<IncomingMessage>, InvocationError>
pub async fn send_album( &self, peer: impl Into<PeerRef>, items: Vec<AlbumItem>, ) -> Result<Vec<IncomingMessage>, InvocationError>
Send multiple files as an album.
Each AlbumItem carries its own media, caption, entities (formatting),
and optional reply_to message ID.
use ferogram::media::AlbumItem;
let msgs = client.send_album(peer.clone(), vec![
AlbumItem::new(photo_media).caption_html("<b>First photo</b>"),
AlbumItem::new(video_media).caption("Second item").reply_to(Some(42)),
]).await?;
// Shorthand: legacy tuple API still works via From impl
client.send_album(peer, vec![
(photo_media2, "caption".to_string()).into(),
]).await?;Sourcepub fn iter_download(&self, location: InputFileLocation) -> DownloadIter
pub fn iter_download(&self, location: InputFileLocation) -> DownloadIter
Create a sequential chunk download iterator.
dc_id must be the DC that stores the file (Document::dc_id() /
Photo::dc_id()). Pass 0 to use the home DC (bots only).
Sourcepub fn iter_download_on_dc(
&self,
location: InputFileLocation,
dc_id: i32,
) -> DownloadIter
pub fn iter_download_on_dc( &self, location: InputFileLocation, dc_id: i32, ) -> DownloadIter
Like [iter_download] but routes to a specific DC.
Sourcepub async fn download_media(
&self,
location: InputFileLocation,
) -> Result<Vec<u8>, InvocationError>
pub async fn download_media( &self, location: InputFileLocation, ) -> Result<Vec<u8>, InvocationError>
Download all bytes of a media attachment at once (sequential).
Sourcepub async fn download_media_on_dc(
&self,
location: InputFileLocation,
dc_id: i32,
) -> Result<Vec<u8>, InvocationError>
pub async fn download_media_on_dc( &self, location: InputFileLocation, dc_id: i32, ) -> Result<Vec<u8>, InvocationError>
Like [download_media] but routes GetFile to dc_id.
Opens a dedicated DcConnection for this download so it never
shares the idle transfer-pool connection (which the server silently
closes after ~90 s of inactivity, causing early-eof on the next use).
Full AUTH_KEY_UNREGISTERED + FILE_MIGRATE recovery, the resilience of the concurrent worker path.
Sourcepub async fn download_media_concurrent(
&self,
location: InputFileLocation,
size: usize,
) -> Result<Vec<u8>, InvocationError>
pub async fn download_media_concurrent( &self, location: InputFileLocation, size: usize, ) -> Result<Vec<u8>, InvocationError>
Download a file using parallel sessions.
size must be the exact byte size of the file.
Returns the full file bytes in order.
Sourcepub async fn download_media_concurrent_on_dc(
&self,
location: InputFileLocation,
size: usize,
dc_id: i32,
) -> Result<Vec<u8>, InvocationError>
pub async fn download_media_concurrent_on_dc( &self, location: InputFileLocation, size: usize, dc_id: i32, ) -> Result<Vec<u8>, InvocationError>
Like [download_media_concurrent] but routes GetFile to dc_id.
Parallel download using per-worker connections. Worker count scales with file size.
Sourcepub async fn download<D: Downloadable>(
&self,
item: &D,
) -> Result<Vec<u8>, InvocationError>
pub async fn download<D: Downloadable>( &self, item: &D, ) -> Result<Vec<u8>, InvocationError>
Download any Downloadable item.
Uses concurrent mode for files > 30 MB (kUseBigFilesFrom),
sequential for smaller files.
Source§impl Client
impl Client
Sourcepub async fn get_participants(
&self,
peer: impl Into<PeerRef>,
limit: i32,
) -> Result<Vec<Participant>, InvocationError>
pub async fn get_participants( &self, peer: impl Into<PeerRef>, limit: i32, ) -> Result<Vec<Participant>, InvocationError>
Fetch all participants of a chat, group or channel.
For channels this uses channels.getParticipants; for basic groups it
uses messages.getFullChat.
Returns up to limit participants; pass 0 for the default (200 for channels).
Sourcepub async fn kick_participant(
&self,
peer: impl Into<PeerRef>,
user_id: i64,
) -> Result<(), InvocationError>
pub async fn kick_participant( &self, peer: impl Into<PeerRef>, user_id: i64, ) -> Result<(), InvocationError>
Kick a user from a group chat or channel.
For basic groups, this removes the user immediately. For channels and supergroups, it bans then unbans them (a Telegram kick).
Sourcepub async fn ban_participant(
&self,
channel: impl Into<PeerRef>,
user_id: i64,
) -> Result<(), InvocationError>
pub async fn ban_participant( &self, channel: impl Into<PeerRef>, user_id: i64, ) -> Result<(), InvocationError>
Permanently ban a user from a channel or supergroup.
Sourcepub async fn ban_participant_until(
&self,
channel: impl Into<PeerRef>,
user_id: i64,
until_ts: i32,
) -> Result<(), InvocationError>
pub async fn ban_participant_until( &self, channel: impl Into<PeerRef>, user_id: i64, until_ts: i32, ) -> Result<(), InvocationError>
Ban a user from a channel or supergroup until until_ts (Unix timestamp).
Use [ban_participant] for a permanent ban.
Sourcepub async fn promote_participant(
&self,
channel: impl Into<PeerRef>,
user_id: i64,
) -> Result<(), InvocationError>
pub async fn promote_participant( &self, channel: impl Into<PeerRef>, user_id: i64, ) -> Result<(), InvocationError>
Promote a user to admin in a channel or supergroup with default admin rights.
Sourcepub async fn demote_participant(
&self,
channel: impl Into<PeerRef>,
user_id: i64,
) -> Result<(), InvocationError>
pub async fn demote_participant( &self, channel: impl Into<PeerRef>, user_id: i64, ) -> Result<(), InvocationError>
Remove admin rights from a user in a channel or supergroup.
Sourcepub async fn get_profile_photos(
&self,
peer: impl Into<PeerRef>,
limit: i32,
) -> Result<Vec<Photo>, InvocationError>
pub async fn get_profile_photos( &self, peer: impl Into<PeerRef>, limit: i32, ) -> Result<Vec<Photo>, InvocationError>
Iterate profile photos of a user or channel.
Returns a list of photo objects (up to limit).
Sourcepub async fn iter_profile_photos(
&self,
peer: impl Into<PeerRef>,
chunk_size: i32,
) -> Result<ProfilePhotoIter, InvocationError>
pub async fn iter_profile_photos( &self, peer: impl Into<PeerRef>, chunk_size: i32, ) -> Result<ProfilePhotoIter, InvocationError>
Stream profile photos of a user lazily, one page at a time.
Returns a ProfilePhotoIter that fetches photos in pages of
chunk_size and exposes them one-by-one via .next().await.
Set chunk_size to 0 to use the default (100).
Only works for users: channels use messages.search with a photo
filter instead.
§Example
let mut iter = client.iter_profile_photos(peer, 0).await?;
while let Some(photo) = iter.next().await? {
println!("{photo:?}");
}Sourcepub async fn search_peer(
&self,
query: &str,
) -> Result<Vec<Peer>, InvocationError>
pub async fn search_peer( &self, query: &str, ) -> Result<Vec<Peer>, InvocationError>
Search for a peer (user, group, or channel) by name prefix.
Searches contacts, dialogs, and globally. Returns combined results.
Source§impl Client
impl Client
Sourcepub async fn set_banned_rights(
&self,
channel: impl Into<PeerRef>,
user_id: i64,
build: impl FnOnce(BannedRightsBuilder) -> BannedRightsBuilder,
) -> Result<(), InvocationError>
pub async fn set_banned_rights( &self, channel: impl Into<PeerRef>, user_id: i64, build: impl FnOnce(BannedRightsBuilder) -> BannedRightsBuilder, ) -> Result<(), InvocationError>
Apply granular ban rights to a user in a channel or supergroup.
Use BannedRightsBuilder to specify which rights to restrict.
Sourcepub async fn set_admin_rights(
&self,
channel: impl Into<PeerRef>,
user_id: i64,
build: impl FnOnce(AdminRightsBuilder) -> AdminRightsBuilder,
) -> Result<(), InvocationError>
pub async fn set_admin_rights( &self, channel: impl Into<PeerRef>, user_id: i64, build: impl FnOnce(AdminRightsBuilder) -> AdminRightsBuilder, ) -> Result<(), InvocationError>
Apply granular admin rights to a user in a channel or supergroup.
Use AdminRightsBuilder to specify which rights to grant.
Sourcepub async fn get_participants_filtered(
&self,
peer: impl Into<PeerRef>,
filter: Option<ChannelParticipantsFilter>,
limit: i32,
) -> Result<Vec<Participant>, InvocationError>
pub async fn get_participants_filtered( &self, peer: impl Into<PeerRef>, filter: Option<ChannelParticipantsFilter>, limit: i32, ) -> Result<Vec<Participant>, InvocationError>
Fetch participants with an optional filter, paginated.
filter defaults to ChannelParticipantsRecent when None.
Sourcepub async fn get_permissions(
&self,
channel: impl Into<PeerRef>,
user_id: i64,
) -> Result<ParticipantPermissions, InvocationError>
pub async fn get_permissions( &self, channel: impl Into<PeerRef>, user_id: i64, ) -> Result<ParticipantPermissions, InvocationError>
Get the effective permissions of a specific user in a channel.
Source§impl Client
impl Client
Sourcepub fn iter_inline_queries(&self) -> InlineQueryIter
pub fn iter_inline_queries(&self) -> InlineQueryIter
Return an iterator that yields every incoming inline query (bot side).
The internal channel is bounded to [INLINE_QUERY_CHANNEL_CAP] entries.
If the consumer stops calling InlineQueryIter::next and the backlog
fills, the feed task exits and the stream ends rather than growing memory
without bound.
Sourcepub async fn inline_query(
&self,
bot: Peer,
query: &str,
) -> Result<InlineResultIter, InvocationError>
pub async fn inline_query( &self, bot: Peer, query: &str, ) -> Result<InlineResultIter, InvocationError>
Query a bot’s inline mode and return a paginated InlineResultIter.
Equivalent to typing @bot_username query in a Telegram app.
§Example
let mut iter = client.inline_query(bot, "hello").await?;
while let Some(r) = iter.next().await? {
println!("{}", r.title().unwrap_or("(no title)"));
}Source§impl Client
impl Client
Sourcepub async fn typing(
&self,
peer: impl Into<PeerRef>,
) -> Result<TypingGuard, InvocationError>
pub async fn typing( &self, peer: impl Into<PeerRef>, ) -> Result<TypingGuard, InvocationError>
Start a scoped typing indicator that auto-cancels when dropped.
A convenience wrapper around TypingGuard::start.
Sourcepub async fn typing_in_topic(
&self,
peer: impl Into<PeerRef>,
topic_id: i32,
) -> Result<TypingGuard, InvocationError>
pub async fn typing_in_topic( &self, peer: impl Into<PeerRef>, topic_id: i32, ) -> Result<TypingGuard, InvocationError>
Start a scoped typing indicator in a forum topic thread.
topic_id is the top_msg_id of the forum topic.
Sourcepub async fn uploading_document(
&self,
peer: impl Into<PeerRef>,
) -> Result<TypingGuard, InvocationError>
pub async fn uploading_document( &self, peer: impl Into<PeerRef>, ) -> Result<TypingGuard, InvocationError>
Start a scoped “uploading document” action that auto-cancels when dropped.
Sourcepub async fn recording_video(
&self,
peer: impl Into<PeerRef>,
) -> Result<TypingGuard, InvocationError>
pub async fn recording_video( &self, peer: impl Into<PeerRef>, ) -> Result<TypingGuard, InvocationError>
Start a scoped “recording video” action that auto-cancels when dropped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more