Struct teloxide_core::Bot

source ·
pub struct Bot { /* private fields */ }
Expand description

A requests sender.

This is the main type of the library, it allows to send requests to the Telegram Bot API and download files.

§TBA methods

All TBA methods are located in the Requester impl for Bot. This allows for opt-in behaviours using requester adaptors.

use teloxide_core::prelude::*;

let bot = Bot::new("TOKEN");
dbg!(bot.get_me().await?);

§File download

In the similar way as with TBA methods, file downloading methods are located in a trait — Download<'_>. See its documentation for more.

§Clone cost

Bot::clone is relatively cheap, so if you need to share Bot, it’s recommended to clone it, instead of wrapping it in Arc<_>.

Implementations§

source§

impl Bot

Constructors

source

pub fn new<S>(token: S) -> Self
where S: Into<String>,

Creates a new Bot with the specified token and the default http-client.

§Panics

If it cannot create reqwest::Client.

source

pub fn with_client<S>(token: S, client: Client) -> Self
where S: Into<String>,

Creates a new Bot with the specified token and your reqwest::Client.

§Caution

Your custom client might not be configured correctly to be able to work in long time durations, see issue 223.

source

pub fn from_env() -> Self

Creates a new Bot with the TELOXIDE_TOKEN & TELOXIDE_PROXY environmental variables (a bot’s token & a proxy) and the default reqwest::Client.

This function passes the value of TELOXIDE_PROXY into reqwest::Proxy::all, if it exists, otherwise returns the default client.

§Panics
  • If cannot get the TELOXIDE_TOKEN environmental variable.
  • If it cannot create reqwest::Client.
Examples found in repository?
examples/self_info.rs (line 13)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    pretty_env_logger::init();

    let chat_id =
        ChatId(std::env::var("CHAT_ID").expect("Expected CHAT_ID env var").parse::<i64>()?);

    let bot = Bot::from_env().parse_mode(ParseMode::MarkdownV2);

    let Me { user: me, .. } = bot.get_me().await?;

    bot.send_dice(chat_id).emoji(DiceEmoji::Dice).await?;
    bot.send_message(chat_id, format!("Hi, my name is **{}** 👋", me.first_name)).await?;

    Ok(())
}
More examples
Hide additional examples
examples/erased.rs (line 32)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    pretty_env_logger::init();

    let chat_id =
        ChatId(std::env::var("CHAT_ID").expect("Expected CHAT_ID env var").parse::<i64>()?);

    let trace_settings = match std::env::var("TRACE").as_deref() {
        Ok("EVERYTHING_VERBOSE") => trace::Settings::TRACE_EVERYTHING_VERBOSE,
        Ok("EVERYTHING") => trace::Settings::TRACE_EVERYTHING,
        Ok("REQUESTS_VERBOSE") => trace::Settings::TRACE_REQUESTS_VERBOSE,
        Ok("REQUESTS") => trace::Settings::TRACE_REQUESTS,
        Ok("RESPONSES_VERBOSE") => trace::Settings::TRACE_RESPONSES_VERBOSE,
        Ok("RESPONSES") => trace::Settings::TRACE_RESPONSES,
        Ok("EMPTY") | Ok("") | Err(VarError::NotPresent) => trace::Settings::empty(),
        Ok(_) | Err(VarError::NotUnicode(_)) => {
            panic!(
                "Expected `TRACE` environment variable to be equal to any of the following: \
                 `EVERYTHING_VERBOSE`, `EVERYTHING`, `REQUESTS_VERBOSE`, `REQUESTS`, \
                 `RESPONSES_VERBOSE`, `RESPONSES`, `EMPTY`, `` (empty string)"
            )
        }
    };

    log::info!("Trace settings: {:?}", trace_settings);

    let bot = if trace_settings.is_empty() {
        Bot::from_env().erase()
    } else {
        Bot::from_env().trace(trace_settings).erase()
    };

    bot.send_chat_action(chat_id, ChatAction::Typing).await?;
    tokio::time::sleep(Duration::from_secs(1)).await;
    bot.send_message(chat_id, "Hey hey hey").await?;

    Ok(())
}
source

pub fn from_env_with_client(client: Client) -> Self

Creates a new Bot with the TELOXIDE_TOKEN environmental variable (a bot’s token) and your reqwest::Client.

§Panics

If cannot get the TELOXIDE_TOKEN environmental variable.

§Caution

Your custom client might not be configured correctly to be able to work in long time durations, see issue 223.

source

pub fn set_api_url(self, url: Url) -> Self

Sets a custom API URL.

For example, you can run your own Telegram bot API server and set its URL using this method.

§Examples
use teloxide_core::{
    requests::{Request, Requester},
    Bot,
};

let url = reqwest::Url::parse("https://localhost/tbas").unwrap();
let bot = Bot::new("TOKEN").set_api_url(url);
// From now all methods will use "https://localhost/tbas" as an API URL.
bot.get_me().await
§Multi-instance behaviour

This method only sets the url for one bot instace, older clones are unaffected.

use teloxide_core::Bot;

let bot = Bot::new("TOKEN");
let bot2 = bot.clone();
let bot = bot.set_api_url(reqwest::Url::parse("https://example.com/").unwrap());

assert_eq!(bot.api_url().as_str(), "https://example.com/");
assert_eq!(bot.clone().api_url().as_str(), "https://example.com/");
assert_ne!(bot2.api_url().as_str(), "https://example.com/");
source§

impl Bot

Getters

source

pub fn token(&self) -> &str

Returns currently used token.

source

pub fn client(&self) -> &Client

Returns currently used http-client.

source

pub fn api_url(&self) -> Url

Returns currently used token API url.

Trait Implementations§

source§

impl Clone for Bot

source§

fn clone(&self) -> Bot

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Bot

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Download for Bot

§

type Err<'dst> = DownloadError

An error returned from download_file.
§

type Fut<'dst> = Pin<Box<dyn Future<Output = Result<(), DownloadError>> + Send + 'dst>>

A future returned from download_file.
source§

fn download_file<'dst>( &self, path: &str, destination: &'dst mut (dyn AsyncWrite + Unpin + Send), ) -> Self::Fut<'dst>

Download a file from Telegram into destination. Read more
§

type StreamErr = Error

An error returned from download_file_stream.
§

type Stream = Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send>>

A stream returned from download_file_stream.
source§

fn download_file_stream(&self, path: &str) -> Self::Stream

Download a file from Telegram as Stream. Read more
source§

impl Requester for Bot

§

type Err = RequestError

Error type returned by all requests.
§

type GetUpdates = JsonRequest<GetUpdates>

source§

fn get_updates(&self) -> Self::GetUpdates

For Telegram documentation see GetUpdates.
§

type SetWebhook = MultipartRequest<SetWebhook>

source§

fn set_webhook(&self, url: Url) -> Self::SetWebhook

For Telegram documentation see SetWebhook.
§

type DeleteWebhook = JsonRequest<DeleteWebhook>

source§

fn delete_webhook(&self) -> Self::DeleteWebhook

For Telegram documentation see DeleteWebhook.
§

type GetWebhookInfo = JsonRequest<GetWebhookInfo>

source§

fn get_webhook_info(&self) -> Self::GetWebhookInfo

For Telegram documentation see GetWebhookInfo.
§

type GetMe = JsonRequest<GetMe>

source§

fn get_me(&self) -> Self::GetMe

For Telegram documentation see GetMe.
§

type SendMessage = JsonRequest<SendMessage>

source§

fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage
where C: Into<Recipient>, T: Into<String>,

For Telegram documentation see SendMessage.
§

type ForwardMessage = JsonRequest<ForwardMessage>

source§

fn forward_message<C, F>( &self, chat_id: C, from_chat_id: F, message_id: MessageId, ) -> Self::ForwardMessage
where C: Into<Recipient>, F: Into<Recipient>,

For Telegram documentation see ForwardMessage.
§

type ForwardMessages = JsonRequest<ForwardMessages>

source§

fn forward_messages<C, F, M>( &self, chat_id: C, from_chat_id: F, message_ids: M, ) -> Self::ForwardMessages
where C: Into<Recipient>, F: Into<Recipient>, M: IntoIterator<Item = MessageId>,

For Telegram documentation see ForwardMessages.
§

type SendPhoto = MultipartRequest<SendPhoto>

source§

fn send_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SendPhoto
where C: Into<Recipient>,

For Telegram documentation see SendPhoto.
§

type SendAudio = MultipartRequest<SendAudio>

source§

fn send_audio<C>(&self, chat_id: C, audio: InputFile) -> Self::SendAudio
where C: Into<Recipient>,

For Telegram documentation see SendAudio.
§

type SendDocument = MultipartRequest<SendDocument>

source§

fn send_document<C>( &self, chat_id: C, document: InputFile, ) -> Self::SendDocument
where C: Into<Recipient>,

For Telegram documentation see SendDocument.
§

type SendVideo = MultipartRequest<SendVideo>

source§

fn send_video<C>(&self, chat_id: C, video: InputFile) -> Self::SendVideo
where C: Into<Recipient>,

For Telegram documentation see SendVideo.
§

type SendAnimation = MultipartRequest<SendAnimation>

source§

fn send_animation<C>( &self, chat_id: C, animation: InputFile, ) -> Self::SendAnimation
where C: Into<Recipient>,

For Telegram documentation see SendAnimation.
§

type SendVoice = MultipartRequest<SendVoice>

source§

fn send_voice<C>(&self, chat_id: C, voice: InputFile) -> Self::SendVoice
where C: Into<Recipient>,

For Telegram documentation see SendVoice.
§

type SendVideoNote = MultipartRequest<SendVideoNote>

source§

fn send_video_note<C>( &self, chat_id: C, video_note: InputFile, ) -> Self::SendVideoNote
where C: Into<Recipient>,

For Telegram documentation see SendVideoNote.
§

type SendMediaGroup = MultipartRequest<SendMediaGroup>

source§

fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroup
where C: Into<Recipient>, M: IntoIterator<Item = InputMedia>,

For Telegram documentation see SendMediaGroup.
§

type SendLocation = JsonRequest<SendLocation>

source§

fn send_location<C>( &self, chat_id: C, latitude: f64, longitude: f64, ) -> Self::SendLocation
where C: Into<Recipient>,

For Telegram documentation see SendLocation.
§

type EditMessageLiveLocation = JsonRequest<EditMessageLiveLocation>

source§

fn edit_message_live_location<C>( &self, chat_id: C, message_id: MessageId, latitude: f64, longitude: f64, ) -> Self::EditMessageLiveLocation
where C: Into<Recipient>,

For Telegram documentation see EditMessageLiveLocation.
§

type EditMessageLiveLocationInline = JsonRequest<EditMessageLiveLocationInline>

source§

fn edit_message_live_location_inline<I>( &self, inline_message_id: I, latitude: f64, longitude: f64, ) -> Self::EditMessageLiveLocationInline
where I: Into<String>,

For Telegram documentation see EditMessageLiveLocationInline.
§

type StopMessageLiveLocation = JsonRequest<StopMessageLiveLocation>

source§

fn stop_message_live_location<C>( &self, chat_id: C, message_id: MessageId, ) -> Self::StopMessageLiveLocation
where C: Into<Recipient>,

For Telegram documentation see StopMessageLiveLocation.
§

type StopMessageLiveLocationInline = JsonRequest<StopMessageLiveLocationInline>

source§

fn stop_message_live_location_inline<I>( &self, inline_message_id: I, ) -> Self::StopMessageLiveLocationInline
where I: Into<String>,

For Telegram documentation see StopMessageLiveLocationInline.
§

type SendVenue = JsonRequest<SendVenue>

source§

fn send_venue<C, T, A>( &self, chat_id: C, latitude: f64, longitude: f64, title: T, address: A, ) -> Self::SendVenue
where C: Into<Recipient>, T: Into<String>, A: Into<String>,

For Telegram documentation see SendVenue.
§

type SendContact = JsonRequest<SendContact>

source§

fn send_contact<C, P, F>( &self, chat_id: C, phone_number: P, first_name: F, ) -> Self::SendContact
where C: Into<Recipient>, P: Into<String>, F: Into<String>,

For Telegram documentation see SendContact.
§

type SendPoll = JsonRequest<SendPoll>

source§

fn send_poll<C, Q, O>( &self, chat_id: C, question: Q, options: O, ) -> Self::SendPoll
where C: Into<Recipient>, Q: Into<String>, O: IntoIterator<Item = String>,

For Telegram documentation see SendPoll.
§

type SendDice = JsonRequest<SendDice>

source§

fn send_dice<C>(&self, chat_id: C) -> Self::SendDice
where C: Into<Recipient>,

For Telegram documentation see SendDice.
§

type SendChatAction = JsonRequest<SendChatAction>

source§

fn send_chat_action<C>( &self, chat_id: C, action: ChatAction, ) -> Self::SendChatAction
where C: Into<Recipient>,

For Telegram documentation see SendChatAction.
§

type SetMessageReaction = JsonRequest<SetMessageReaction>

source§

fn set_message_reaction<C>( &self, chat_id: C, message_id: MessageId, ) -> Self::SetMessageReaction
where C: Into<Recipient>,

For Telegram documentation see SetMessageReaction.
§

type GetUserProfilePhotos = JsonRequest<GetUserProfilePhotos>

source§

fn get_user_profile_photos(&self, user_id: UserId) -> Self::GetUserProfilePhotos

For Telegram documentation see GetUserProfilePhotos.
§

type GetFile = JsonRequest<GetFile>

source§

fn get_file<F>(&self, file_id: F) -> Self::GetFile
where F: Into<String>,

For Telegram documentation see GetFile.
§

type KickChatMember = JsonRequest<KickChatMember>

source§

fn kick_chat_member<C>( &self, chat_id: C, user_id: UserId, ) -> Self::KickChatMember
where C: Into<Recipient>,

For Telegram documentation see KickChatMember.
§

type BanChatMember = JsonRequest<BanChatMember>

source§

fn ban_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::BanChatMember
where C: Into<Recipient>,

For Telegram documentation see BanChatMember.
§

type UnbanChatMember = JsonRequest<UnbanChatMember>

source§

fn unban_chat_member<C>( &self, chat_id: C, user_id: UserId, ) -> Self::UnbanChatMember
where C: Into<Recipient>,

For Telegram documentation see UnbanChatMember.
§

type RestrictChatMember = JsonRequest<RestrictChatMember>

source§

fn restrict_chat_member<C>( &self, chat_id: C, user_id: UserId, permissions: ChatPermissions, ) -> Self::RestrictChatMember
where C: Into<Recipient>,

For Telegram documentation see RestrictChatMember.
§

type PromoteChatMember = JsonRequest<PromoteChatMember>

source§

fn promote_chat_member<C>( &self, chat_id: C, user_id: UserId, ) -> Self::PromoteChatMember
where C: Into<Recipient>,

For Telegram documentation see PromoteChatMember.
§

type SetChatAdministratorCustomTitle = JsonRequest<SetChatAdministratorCustomTitle>

source§

fn set_chat_administrator_custom_title<Ch, Cu>( &self, chat_id: Ch, user_id: UserId, custom_title: Cu, ) -> Self::SetChatAdministratorCustomTitle
where Ch: Into<Recipient>, Cu: Into<String>,

For Telegram documentation see SetChatAdministratorCustomTitle.
§

type BanChatSenderChat = JsonRequest<BanChatSenderChat>

source§

fn ban_chat_sender_chat<C, S>( &self, chat_id: C, sender_chat_id: S, ) -> Self::BanChatSenderChat
where C: Into<Recipient>, S: Into<ChatId>,

For Telegram documentation see BanChatSenderChat.
§

type UnbanChatSenderChat = JsonRequest<UnbanChatSenderChat>

source§

fn unban_chat_sender_chat<C, S>( &self, chat_id: C, sender_chat_id: S, ) -> Self::UnbanChatSenderChat
where C: Into<Recipient>, S: Into<ChatId>,

For Telegram documentation see UnbanChatSenderChat.
§

type SetChatPermissions = JsonRequest<SetChatPermissions>

source§

fn set_chat_permissions<C>( &self, chat_id: C, permissions: ChatPermissions, ) -> Self::SetChatPermissions
where C: Into<Recipient>,

For Telegram documentation see SetChatPermissions.
For Telegram documentation see ExportChatInviteLink.
For Telegram documentation see CreateChatInviteLink.
For Telegram documentation see EditChatInviteLink.
For Telegram documentation see RevokeChatInviteLink.
§

type ApproveChatJoinRequest = JsonRequest<ApproveChatJoinRequest>

source§

fn approve_chat_join_request<C>( &self, chat_id: C, user_id: UserId, ) -> Self::ApproveChatJoinRequest
where C: Into<Recipient>,

For Telegram documentation see ApproveChatJoinRequest.
§

type DeclineChatJoinRequest = JsonRequest<DeclineChatJoinRequest>

source§

fn decline_chat_join_request<C>( &self, chat_id: C, user_id: UserId, ) -> Self::DeclineChatJoinRequest
where C: Into<Recipient>,

For Telegram documentation see DeclineChatJoinRequest.
§

type SetChatPhoto = MultipartRequest<SetChatPhoto>

source§

fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto
where C: Into<Recipient>,

For Telegram documentation see SetChatPhoto.
§

type DeleteChatPhoto = JsonRequest<DeleteChatPhoto>

source§

fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhoto
where C: Into<Recipient>,

For Telegram documentation see DeleteChatPhoto.
§

type SetChatTitle = JsonRequest<SetChatTitle>

source§

fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitle
where C: Into<Recipient>, T: Into<String>,

For Telegram documentation see SetChatTitle.
§

type SetChatDescription = JsonRequest<SetChatDescription>

source§

fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescription
where C: Into<Recipient>,

For Telegram documentation see SetChatDescription.
§

type PinChatMessage = JsonRequest<PinChatMessage>

source§

fn pin_chat_message<C>( &self, chat_id: C, message_id: MessageId, ) -> Self::PinChatMessage
where C: Into<Recipient>,

For Telegram documentation see PinChatMessage.
§

type UnpinChatMessage = JsonRequest<UnpinChatMessage>

source§

fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessage
where C: Into<Recipient>,

For Telegram documentation see UnpinChatMessage.
§

type LeaveChat = JsonRequest<LeaveChat>

source§

fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChat
where C: Into<Recipient>,

For Telegram documentation see LeaveChat.
§

type GetChat = JsonRequest<GetChat>

source§

fn get_chat<C>(&self, chat_id: C) -> Self::GetChat
where C: Into<Recipient>,

For Telegram documentation see GetChat.
§

type GetChatAdministrators = JsonRequest<GetChatAdministrators>

source§

fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministrators
where C: Into<Recipient>,

For Telegram documentation see GetChatAdministrators.
§

type GetChatMembersCount = JsonRequest<GetChatMembersCount>

source§

fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCount
where C: Into<Recipient>,

For Telegram documentation see GetChatMembersCount.
§

type GetChatMemberCount = JsonRequest<GetChatMemberCount>

source§

fn get_chat_member_count<C>(&self, chat_id: C) -> Self::GetChatMemberCount
where C: Into<Recipient>,

For Telegram documentation see GetChatMemberCount.
§

type GetChatMember = JsonRequest<GetChatMember>

source§

fn get_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::GetChatMember
where C: Into<Recipient>,

For Telegram documentation see GetChatMember.
§

type SetChatStickerSet = JsonRequest<SetChatStickerSet>

source§

fn set_chat_sticker_set<C, S>( &self, chat_id: C, sticker_set_name: S, ) -> Self::SetChatStickerSet
where C: Into<Recipient>, S: Into<String>,

For Telegram documentation see SetChatStickerSet.
§

type DeleteChatStickerSet = JsonRequest<DeleteChatStickerSet>

source§

fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSet
where C: Into<Recipient>,

For Telegram documentation see DeleteChatStickerSet.
§

type GetForumTopicIconStickers = JsonRequest<GetForumTopicIconStickers>

source§

fn get_forum_topic_icon_stickers(&self) -> Self::GetForumTopicIconStickers

For Telegram documentation see GetForumTopicIconStickers.
§

type CreateForumTopic = JsonRequest<CreateForumTopic>

source§

fn create_forum_topic<C, N, I>( &self, chat_id: C, name: N, icon_color: u32, icon_custom_emoji_id: I, ) -> Self::CreateForumTopic
where C: Into<Recipient>, N: Into<String>, I: Into<String>,

For Telegram documentation see CreateForumTopic.
§

type EditForumTopic = JsonRequest<EditForumTopic>

source§

fn edit_forum_topic<C>( &self, chat_id: C, message_thread_id: ThreadId, ) -> Self::EditForumTopic
where C: Into<Recipient>,

For Telegram documentation see EditForumTopic.
§

type CloseForumTopic = JsonRequest<CloseForumTopic>

source§

fn close_forum_topic<C>( &self, chat_id: C, message_thread_id: ThreadId, ) -> Self::CloseForumTopic
where C: Into<Recipient>,

For Telegram documentation see CloseForumTopic.
§

type ReopenForumTopic = JsonRequest<ReopenForumTopic>

source§

fn reopen_forum_topic<C>( &self, chat_id: C, message_thread_id: ThreadId, ) -> Self::ReopenForumTopic
where C: Into<Recipient>,

For Telegram documentation see ReopenForumTopic.
§

type DeleteForumTopic = JsonRequest<DeleteForumTopic>

source§

fn delete_forum_topic<C>( &self, chat_id: C, message_thread_id: ThreadId, ) -> Self::DeleteForumTopic
where C: Into<Recipient>,

For Telegram documentation see DeleteForumTopic.
§

type UnpinAllForumTopicMessages = JsonRequest<UnpinAllForumTopicMessages>

source§

fn unpin_all_forum_topic_messages<C>( &self, chat_id: C, message_thread_id: ThreadId, ) -> Self::UnpinAllForumTopicMessages
where C: Into<Recipient>,

For Telegram documentation see UnpinAllForumTopicMessages.
§

type EditGeneralForumTopic = JsonRequest<EditGeneralForumTopic>

source§

fn edit_general_forum_topic<C, N>( &self, chat_id: C, name: N, ) -> Self::EditGeneralForumTopic
where C: Into<Recipient>, N: Into<String>,

For Telegram documentation see EditGeneralForumTopic.
§

type CloseGeneralForumTopic = JsonRequest<CloseGeneralForumTopic>

source§

fn close_general_forum_topic<C>( &self, chat_id: C, ) -> Self::CloseGeneralForumTopic
where C: Into<Recipient>,

For Telegram documentation see CloseGeneralForumTopic.
§

type ReopenGeneralForumTopic = JsonRequest<ReopenGeneralForumTopic>

source§

fn reopen_general_forum_topic<C>( &self, chat_id: C, ) -> Self::ReopenGeneralForumTopic
where C: Into<Recipient>,

For Telegram documentation see ReopenGeneralForumTopic.
§

type HideGeneralForumTopic = JsonRequest<HideGeneralForumTopic>

source§

fn hide_general_forum_topic<C>(&self, chat_id: C) -> Self::HideGeneralForumTopic
where C: Into<Recipient>,

For Telegram documentation see HideGeneralForumTopic.
§

type UnhideGeneralForumTopic = JsonRequest<UnhideGeneralForumTopic>

source§

fn unhide_general_forum_topic<C>( &self, chat_id: C, ) -> Self::UnhideGeneralForumTopic
where C: Into<Recipient>,

For Telegram documentation see UnhideGeneralForumTopic.
§

type UnpinAllGeneralForumTopicMessages = JsonRequest<UnpinAllGeneralForumTopicMessages>

source§

fn unpin_all_general_forum_topic_messages<C>( &self, chat_id: C, ) -> Self::UnpinAllGeneralForumTopicMessages
where C: Into<Recipient>,

For Telegram documentation see UnpinAllGeneralForumTopicMessages.
§

type AnswerCallbackQuery = JsonRequest<AnswerCallbackQuery>

source§

fn answer_callback_query<C>( &self, callback_query_id: C, ) -> Self::AnswerCallbackQuery
where C: Into<String>,

For Telegram documentation see AnswerCallbackQuery.
§

type GetUserChatBoosts = JsonRequest<GetUserChatBoosts>

source§

fn get_user_chat_boosts<C>( &self, chat_id: C, user_id: UserId, ) -> Self::GetUserChatBoosts
where C: Into<Recipient>,

For Telegram documentation see GetUserChatBoosts.
§

type SetMyCommands = JsonRequest<SetMyCommands>

source§

fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands
where C: IntoIterator<Item = BotCommand>,

For Telegram documentation see SetMyCommands.
§

type GetMyCommands = JsonRequest<GetMyCommands>

source§

fn get_my_commands(&self) -> Self::GetMyCommands

For Telegram documentation see GetMyCommands.
§

type SetMyName = JsonRequest<SetMyName>

source§

fn set_my_name(&self) -> Self::SetMyName

For Telegram documentation see SetMyName.
§

type GetMyName = JsonRequest<GetMyName>

source§

fn get_my_name(&self) -> Self::GetMyName

For Telegram documentation see GetMyName.
§

type SetMyDescription = JsonRequest<SetMyDescription>

source§

fn set_my_description(&self) -> Self::SetMyDescription

For Telegram documentation see SetMyDescription.
§

type GetMyDescription = JsonRequest<GetMyDescription>

source§

fn get_my_description(&self) -> Self::GetMyDescription

For Telegram documentation see GetMyDescription.
§

type SetMyShortDescription = JsonRequest<SetMyShortDescription>

source§

fn set_my_short_description(&self) -> Self::SetMyShortDescription

For Telegram documentation see SetMyShortDescription.
§

type GetMyShortDescription = JsonRequest<GetMyShortDescription>

source§

fn get_my_short_description(&self) -> Self::GetMyShortDescription

For Telegram documentation see GetMyShortDescription.
§

type SetChatMenuButton = JsonRequest<SetChatMenuButton>

source§

fn set_chat_menu_button(&self) -> Self::SetChatMenuButton

For Telegram documentation see SetChatMenuButton.
§

type GetChatMenuButton = JsonRequest<GetChatMenuButton>

source§

fn get_chat_menu_button(&self) -> Self::GetChatMenuButton

For Telegram documentation see GetChatMenuButton.
§

type SetMyDefaultAdministratorRights = JsonRequest<SetMyDefaultAdministratorRights>

source§

fn set_my_default_administrator_rights( &self, ) -> Self::SetMyDefaultAdministratorRights

For Telegram documentation see SetMyDefaultAdministratorRights.
§

type GetMyDefaultAdministratorRights = JsonRequest<GetMyDefaultAdministratorRights>

source§

fn get_my_default_administrator_rights( &self, ) -> Self::GetMyDefaultAdministratorRights

For Telegram documentation see GetMyDefaultAdministratorRights.
§

type DeleteMyCommands = JsonRequest<DeleteMyCommands>

source§

fn delete_my_commands(&self) -> Self::DeleteMyCommands

For Telegram documentation see DeleteMyCommands.
§

type AnswerInlineQuery = JsonRequest<AnswerInlineQuery>

source§

fn answer_inline_query<I, R>( &self, inline_query_id: I, results: R, ) -> Self::AnswerInlineQuery
where I: Into<String>, R: IntoIterator<Item = InlineQueryResult>,

For Telegram documentation see AnswerInlineQuery.
§

type AnswerWebAppQuery = JsonRequest<AnswerWebAppQuery>

source§

fn answer_web_app_query<W>( &self, web_app_query_id: W, result: InlineQueryResult, ) -> Self::AnswerWebAppQuery
where W: Into<String>,

For Telegram documentation see AnswerWebAppQuery.
§

type EditMessageText = JsonRequest<EditMessageText>

source§

fn edit_message_text<C, T>( &self, chat_id: C, message_id: MessageId, text: T, ) -> Self::EditMessageText
where C: Into<Recipient>, T: Into<String>,

For Telegram documentation see EditMessageText.
§

type EditMessageTextInline = JsonRequest<EditMessageTextInline>

source§

fn edit_message_text_inline<I, T>( &self, inline_message_id: I, text: T, ) -> Self::EditMessageTextInline
where I: Into<String>, T: Into<String>,

For Telegram documentation see EditMessageTextInline.
§

type EditMessageCaption = JsonRequest<EditMessageCaption>

source§

fn edit_message_caption<C>( &self, chat_id: C, message_id: MessageId, ) -> Self::EditMessageCaption
where C: Into<Recipient>,

For Telegram documentation see EditMessageCaption.
§

type EditMessageCaptionInline = JsonRequest<EditMessageCaptionInline>

source§

fn edit_message_caption_inline<I>( &self, inline_message_id: I, ) -> Self::EditMessageCaptionInline
where I: Into<String>,

For Telegram documentation see EditMessageCaptionInline.
§

type EditMessageMedia = MultipartRequest<EditMessageMedia>

source§

fn edit_message_media<C>( &self, chat_id: C, message_id: MessageId, media: InputMedia, ) -> Self::EditMessageMedia
where C: Into<Recipient>,

For Telegram documentation see EditMessageMedia.
§

type EditMessageMediaInline = MultipartRequest<EditMessageMediaInline>

source§

fn edit_message_media_inline<I>( &self, inline_message_id: I, media: InputMedia, ) -> Self::EditMessageMediaInline
where I: Into<String>,

For Telegram documentation see EditMessageMediaInline.
§

type EditMessageReplyMarkup = JsonRequest<EditMessageReplyMarkup>

source§

fn edit_message_reply_markup<C>( &self, chat_id: C, message_id: MessageId, ) -> Self::EditMessageReplyMarkup
where C: Into<Recipient>,

For Telegram documentation see EditMessageReplyMarkup.
§

type EditMessageReplyMarkupInline = JsonRequest<EditMessageReplyMarkupInline>

source§

fn edit_message_reply_markup_inline<I>( &self, inline_message_id: I, ) -> Self::EditMessageReplyMarkupInline
where I: Into<String>,

For Telegram documentation see EditMessageReplyMarkupInline.
§

type StopPoll = JsonRequest<StopPoll>

source§

fn stop_poll<C>(&self, chat_id: C, message_id: MessageId) -> Self::StopPoll
where C: Into<Recipient>,

For Telegram documentation see StopPoll.
§

type DeleteMessage = JsonRequest<DeleteMessage>

source§

fn delete_message<C>( &self, chat_id: C, message_id: MessageId, ) -> Self::DeleteMessage
where C: Into<Recipient>,

For Telegram documentation see DeleteMessage.
§

type DeleteMessages = JsonRequest<DeleteMessages>

source§

fn delete_messages<C, M>( &self, chat_id: C, message_ids: M, ) -> Self::DeleteMessages
where C: Into<Recipient>, M: IntoIterator<Item = MessageId>,

For Telegram documentation see DeleteMessages.
§

type SendSticker = MultipartRequest<SendSticker>

source§

fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker
where C: Into<Recipient>,

For Telegram documentation see SendSticker.
§

type GetStickerSet = JsonRequest<GetStickerSet>

source§

fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSet
where N: Into<String>,

For Telegram documentation see GetStickerSet.
§

type GetCustomEmojiStickers = JsonRequest<GetCustomEmojiStickers>

source§

fn get_custom_emoji_stickers<C>( &self, custom_emoji_ids: C, ) -> Self::GetCustomEmojiStickers
where C: IntoIterator<Item = String>,

For Telegram documentation see GetCustomEmojiStickers.
§

type UploadStickerFile = MultipartRequest<UploadStickerFile>

source§

fn upload_sticker_file( &self, user_id: UserId, sticker: InputFile, sticker_format: StickerFormat, ) -> Self::UploadStickerFile

For Telegram documentation see UploadStickerFile.
§

type CreateNewStickerSet = MultipartRequest<CreateNewStickerSet>

source§

fn create_new_sticker_set<N, T, S>( &self, user_id: UserId, name: N, title: T, stickers: S, sticker_format: StickerFormat, ) -> Self::CreateNewStickerSet
where N: Into<String>, T: Into<String>, S: IntoIterator<Item = InputSticker>,

For Telegram documentation see CreateNewStickerSet.
§

type AddStickerToSet = MultipartRequest<AddStickerToSet>

source§

fn add_sticker_to_set<N>( &self, user_id: UserId, name: N, sticker: InputSticker, ) -> Self::AddStickerToSet
where N: Into<String>,

For Telegram documentation see AddStickerToSet.
§

type SetStickerPositionInSet = JsonRequest<SetStickerPositionInSet>

source§

fn set_sticker_position_in_set<S>( &self, sticker: S, position: u32, ) -> Self::SetStickerPositionInSet
where S: Into<String>,

For Telegram documentation see SetStickerPositionInSet.
§

type DeleteStickerFromSet = JsonRequest<DeleteStickerFromSet>

source§

fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSet
where S: Into<String>,

For Telegram documentation see DeleteStickerFromSet.
§

type SetStickerSetThumbnail = MultipartRequest<SetStickerSetThumbnail>

source§

fn set_sticker_set_thumbnail<N>( &self, name: N, user_id: UserId, ) -> Self::SetStickerSetThumbnail
where N: Into<String>,

For Telegram documentation see SetStickerSetThumbnail.
§

type SetCustomEmojiStickerSetThumbnail = JsonRequest<SetCustomEmojiStickerSetThumbnail>

source§

fn set_custom_emoji_sticker_set_thumbnail<N>( &self, name: N, ) -> Self::SetCustomEmojiStickerSetThumbnail
where N: Into<String>,

For Telegram documentation see SetCustomEmojiStickerSetThumbnail.
§

type SetStickerSetTitle = JsonRequest<SetStickerSetTitle>

source§

fn set_sticker_set_title<N, T>( &self, name: N, title: T, ) -> Self::SetStickerSetTitle
where N: Into<String>, T: Into<String>,

For Telegram documentation see SetStickerSetTitle.
§

type DeleteStickerSet = JsonRequest<DeleteStickerSet>

source§

fn delete_sticker_set<N>(&self, name: N) -> Self::DeleteStickerSet
where N: Into<String>,

For Telegram documentation see DeleteStickerSet.
§

type SetStickerEmojiList = JsonRequest<SetStickerEmojiList>

source§

fn set_sticker_emoji_list<S, E>( &self, sticker: S, emoji_list: E, ) -> Self::SetStickerEmojiList
where S: Into<String>, E: IntoIterator<Item = String>,

For Telegram documentation see SetStickerEmojiList.
§

type SetStickerKeywords = JsonRequest<SetStickerKeywords>

source§

fn set_sticker_keywords<S>(&self, sticker: S) -> Self::SetStickerKeywords
where S: Into<String>,

For Telegram documentation see SetStickerKeywords.
§

type SetStickerMaskPosition = JsonRequest<SetStickerMaskPosition>

source§

fn set_sticker_mask_position<S>( &self, sticker: S, ) -> Self::SetStickerMaskPosition
where S: Into<String>,

For Telegram documentation see SetStickerMaskPosition.
§

type SendInvoice = JsonRequest<SendInvoice>

source§

fn send_invoice<Ch, T, D, Pa, P, C, Pri>( &self, chat_id: Ch, title: T, description: D, payload: Pa, provider_token: P, currency: C, prices: Pri, ) -> Self::SendInvoice
where Ch: Into<Recipient>, T: Into<String>, D: Into<String>, Pa: Into<String>, P: Into<String>, C: Into<String>, Pri: IntoIterator<Item = LabeledPrice>,

For Telegram documentation see SendInvoice.
For Telegram documentation see CreateInvoiceLink.
§

type AnswerShippingQuery = JsonRequest<AnswerShippingQuery>

source§

fn answer_shipping_query<S>( &self, shipping_query_id: S, ok: bool, ) -> Self::AnswerShippingQuery
where S: Into<String>,

For Telegram documentation see AnswerShippingQuery.
§

type AnswerPreCheckoutQuery = JsonRequest<AnswerPreCheckoutQuery>

source§

fn answer_pre_checkout_query<P>( &self, pre_checkout_query_id: P, ok: bool, ) -> Self::AnswerPreCheckoutQuery
where P: Into<String>,

For Telegram documentation see AnswerPreCheckoutQuery.
§

type SetPassportDataErrors = JsonRequest<SetPassportDataErrors>

source§

fn set_passport_data_errors<E>( &self, user_id: UserId, errors: E, ) -> Self::SetPassportDataErrors

For Telegram documentation see SetPassportDataErrors.
§

type SendGame = JsonRequest<SendGame>

source§

fn send_game<C, G>(&self, chat_id: C, game_short_name: G) -> Self::SendGame
where C: Into<ChatId>, G: Into<String>,

For Telegram documentation see SendGame.
§

type SetGameScore = JsonRequest<SetGameScore>

source§

fn set_game_score( &self, user_id: UserId, score: u64, chat_id: u32, message_id: MessageId, ) -> Self::SetGameScore

For Telegram documentation see SetGameScore.
§

type SetGameScoreInline = JsonRequest<SetGameScoreInline>

source§

fn set_game_score_inline<I>( &self, user_id: UserId, score: u64, inline_message_id: I, ) -> Self::SetGameScoreInline
where I: Into<String>,

For Telegram documentation see SetGameScoreInline.
§

type GetGameHighScores = JsonRequest<GetGameHighScores>

source§

fn get_game_high_scores<T>( &self, user_id: UserId, target: T, ) -> Self::GetGameHighScores
where T: Into<TargetMessage>,

For Telegram documentation see GetGameHighScores.
§

type LogOut = JsonRequest<LogOut>

source§

fn log_out(&self) -> Self::LogOut

For Telegram documentation see LogOut.
§

type Close = JsonRequest<Close>

source§

fn close(&self) -> Self::Close

For Telegram documentation see Close.
§

type CopyMessage = JsonRequest<CopyMessage>

source§

fn copy_message<C, F>( &self, chat_id: C, from_chat_id: F, message_id: MessageId, ) -> Self::CopyMessage
where C: Into<Recipient>, F: Into<Recipient>,

For Telegram documentation see CopyMessage.
§

type CopyMessages = JsonRequest<CopyMessages>

source§

fn copy_messages<C, F, M>( &self, chat_id: C, from_chat_id: F, message_ids: M, ) -> Self::CopyMessages
where C: Into<Recipient>, F: Into<Recipient>, M: IntoIterator<Item = MessageId>,

For Telegram documentation see CopyMessages.
§

type UnpinAllChatMessages = JsonRequest<UnpinAllChatMessages>

source§

fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessages
where C: Into<Recipient>,

For Telegram documentation see UnpinAllChatMessages.

Auto Trait Implementations§

§

impl Freeze for Bot

§

impl !RefUnwindSafe for Bot

§

impl Send for Bot

§

impl Sync for Bot

§

impl Unpin for Bot

§

impl !UnwindSafe for Bot

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Erasable for T

source§

unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>

Unerase this erased pointer. Read more
source§

const ACK_1_1_0: bool = true

Available on non-enforce_1_1_0_semantics only.
Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
source§

fn erase(this: NonNull<Self>) -> NonNull<Erased>

Turn this erasable pointer into an erased pointer. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> RequesterExt for T
where T: Requester,

source§

fn cache_me(self) -> CacheMe<Self>
where Self: Sized,

Available on crate feature cache_me only.
Add get_me caching ability, see CacheMe for more.
source§

fn erase<'a>(self) -> ErasedRequester<'a, Self::Err>
where Self: 'a + Sized,

Available on crate feature erased only.
Erase requester type.
source§

fn trace(self, settings: Settings) -> Trace<Self>
where Self: Sized,

Available on crate feature trace_adaptor only.
Trace requests, see Trace for more.
source§

fn throttle(self, limits: Limits) -> Throttle<Self>
where Self: Sized + Clone + Send + Sync + 'static, Self::Err: AsResponseParameters, Self::GetChat: Send,

Available on crate feature throttle only.
Add throttling ability, see Throttle for more. Read more
source§

fn parse_mode(self, parse_mode: ParseMode) -> DefaultParseMode<Self>
where Self: Sized,

Specifies default ParseMode, which will be used during all calls to: Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more