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
impl Bot
Constructors
sourcepub fn new<S>(token: S) -> Selfwhere
S: Into<String>,
pub fn new<S>(token: S) -> Selfwhere S: Into<String>,
Creates a new Bot
with the specified token and the default
http-client.
Panics
If it cannot create reqwest::Client
.
sourcepub fn with_client<S>(token: S, client: Client) -> Selfwhere
S: Into<String>,
pub fn with_client<S>(token: S, client: Client) -> Selfwhere 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.
sourcepub fn from_env() -> Self
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?
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
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(())
}
sourcepub fn from_env_with_client(client: Client) -> Self
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.
sourcepub fn set_api_url(self, url: Url) -> Self
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/");
Trait Implementations§
source§impl<'w> Download<'w> for Bot
impl<'w> Download<'w> for Bot
§type Err = DownloadError
type Err = DownloadError
download_file
.§type Fut = Pin<Box<dyn Future<Output = Result<(), DownloadError>> + Send + 'w, Global>>
type Fut = Pin<Box<dyn Future<Output = Result<(), DownloadError>> + Send + 'w, Global>>
download_file
.source§fn download_file(
&self,
path: &str,
destination: &'w mut (dyn AsyncWrite + Unpin + Send)
) -> Self::Fut
fn download_file( &self, path: &str, destination: &'w mut (dyn AsyncWrite + Unpin + Send) ) -> Self::Fut
destination
. Read more§type StreamErr = Error
type StreamErr = Error
download_file_stream
.source§impl Requester for Bot
impl Requester for Bot
§type Err = RequestError
type Err = RequestError
type GetUpdates = JsonRequest<GetUpdates>
source§fn get_updates(&self) -> Self::GetUpdates
fn get_updates(&self) -> Self::GetUpdates
GetUpdates
.type SetWebhook = MultipartRequest<SetWebhook>
source§fn set_webhook(&self, url: Url) -> Self::SetWebhook
fn set_webhook(&self, url: Url) -> Self::SetWebhook
SetWebhook
.type DeleteWebhook = JsonRequest<DeleteWebhook>
source§fn delete_webhook(&self) -> Self::DeleteWebhook
fn delete_webhook(&self) -> Self::DeleteWebhook
DeleteWebhook
.type GetWebhookInfo = JsonRequest<GetWebhookInfo>
source§fn get_webhook_info(&self) -> Self::GetWebhookInfo
fn get_webhook_info(&self) -> Self::GetWebhookInfo
GetWebhookInfo
.type GetMe = JsonRequest<GetMe>
type SendMessage = JsonRequest<SendMessage>
source§fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessagewhere
C: Into<Recipient>,
T: Into<String>,
fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessagewhere C: Into<Recipient>, T: Into<String>,
SendMessage
.type ForwardMessage = JsonRequest<ForwardMessage>
source§fn forward_message<C, F>(
&self,
chat_id: C,
from_chat_id: F,
message_id: MessageId
) -> Self::ForwardMessagewhere
C: Into<Recipient>,
F: Into<Recipient>,
fn forward_message<C, F>( &self, chat_id: C, from_chat_id: F, message_id: MessageId ) -> Self::ForwardMessagewhere C: Into<Recipient>, F: Into<Recipient>,
ForwardMessage
.type SendPhoto = MultipartRequest<SendPhoto>
source§fn send_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SendPhotowhere
C: Into<Recipient>,
fn send_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SendPhotowhere C: Into<Recipient>,
SendPhoto
.type SendAudio = MultipartRequest<SendAudio>
source§fn send_audio<C>(&self, chat_id: C, audio: InputFile) -> Self::SendAudiowhere
C: Into<Recipient>,
fn send_audio<C>(&self, chat_id: C, audio: InputFile) -> Self::SendAudiowhere C: Into<Recipient>,
SendAudio
.type SendDocument = MultipartRequest<SendDocument>
source§fn send_document<C>(&self, chat_id: C, document: InputFile) -> Self::SendDocumentwhere
C: Into<Recipient>,
fn send_document<C>(&self, chat_id: C, document: InputFile) -> Self::SendDocumentwhere C: Into<Recipient>,
SendDocument
.type SendVideo = MultipartRequest<SendVideo>
source§fn send_video<C>(&self, chat_id: C, video: InputFile) -> Self::SendVideowhere
C: Into<Recipient>,
fn send_video<C>(&self, chat_id: C, video: InputFile) -> Self::SendVideowhere C: Into<Recipient>,
SendVideo
.type SendAnimation = MultipartRequest<SendAnimation>
source§fn send_animation<C>(
&self,
chat_id: C,
animation: InputFile
) -> Self::SendAnimationwhere
C: Into<Recipient>,
fn send_animation<C>( &self, chat_id: C, animation: InputFile ) -> Self::SendAnimationwhere C: Into<Recipient>,
SendAnimation
.type SendVoice = MultipartRequest<SendVoice>
source§fn send_voice<C>(&self, chat_id: C, voice: InputFile) -> Self::SendVoicewhere
C: Into<Recipient>,
fn send_voice<C>(&self, chat_id: C, voice: InputFile) -> Self::SendVoicewhere C: Into<Recipient>,
SendVoice
.type SendVideoNote = MultipartRequest<SendVideoNote>
source§fn send_video_note<C>(
&self,
chat_id: C,
video_note: InputFile
) -> Self::SendVideoNotewhere
C: Into<Recipient>,
fn send_video_note<C>( &self, chat_id: C, video_note: InputFile ) -> Self::SendVideoNotewhere C: Into<Recipient>,
SendVideoNote
.type SendMediaGroup = MultipartRequest<SendMediaGroup>
source§fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroupwhere
C: Into<Recipient>,
M: IntoIterator<Item = InputMedia>,
fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroupwhere C: Into<Recipient>, M: IntoIterator<Item = InputMedia>,
SendMediaGroup
.type SendLocation = JsonRequest<SendLocation>
source§fn send_location<C>(
&self,
chat_id: C,
latitude: f64,
longitude: f64
) -> Self::SendLocationwhere
C: Into<Recipient>,
fn send_location<C>( &self, chat_id: C, latitude: f64, longitude: f64 ) -> Self::SendLocationwhere C: Into<Recipient>,
SendLocation
.type EditMessageLiveLocation = JsonRequest<EditMessageLiveLocation>
source§fn edit_message_live_location<C>(
&self,
chat_id: C,
message_id: MessageId,
latitude: f64,
longitude: f64
) -> Self::EditMessageLiveLocationwhere
C: Into<Recipient>,
fn edit_message_live_location<C>( &self, chat_id: C, message_id: MessageId, latitude: f64, longitude: f64 ) -> Self::EditMessageLiveLocationwhere C: Into<Recipient>,
EditMessageLiveLocation
.type EditMessageLiveLocationInline = JsonRequest<EditMessageLiveLocationInline>
source§fn edit_message_live_location_inline<I>(
&self,
inline_message_id: I,
latitude: f64,
longitude: f64
) -> Self::EditMessageLiveLocationInlinewhere
I: Into<String>,
fn edit_message_live_location_inline<I>( &self, inline_message_id: I, latitude: f64, longitude: f64 ) -> Self::EditMessageLiveLocationInlinewhere I: Into<String>,
EditMessageLiveLocationInline
.type StopMessageLiveLocation = JsonRequest<StopMessageLiveLocation>
source§fn stop_message_live_location<C>(
&self,
chat_id: C,
message_id: MessageId,
latitude: f64,
longitude: f64
) -> Self::StopMessageLiveLocationwhere
C: Into<Recipient>,
fn stop_message_live_location<C>( &self, chat_id: C, message_id: MessageId, latitude: f64, longitude: f64 ) -> Self::StopMessageLiveLocationwhere C: Into<Recipient>,
StopMessageLiveLocation
.type StopMessageLiveLocationInline = JsonRequest<StopMessageLiveLocationInline>
source§fn stop_message_live_location_inline<I>(
&self,
inline_message_id: I,
latitude: f64,
longitude: f64
) -> Self::StopMessageLiveLocationInlinewhere
I: Into<String>,
fn stop_message_live_location_inline<I>( &self, inline_message_id: I, latitude: f64, longitude: f64 ) -> Self::StopMessageLiveLocationInlinewhere I: Into<String>,
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::SendVenuewhere
C: Into<Recipient>,
T: Into<String>,
A: Into<String>,
fn send_venue<C, T, A>( &self, chat_id: C, latitude: f64, longitude: f64, title: T, address: A ) -> Self::SendVenuewhere C: Into<Recipient>, T: Into<String>, A: Into<String>,
SendVenue
.type SendContact = JsonRequest<SendContact>
source§fn send_contact<C, P, F>(
&self,
chat_id: C,
phone_number: P,
first_name: F
) -> Self::SendContactwhere
C: Into<Recipient>,
P: Into<String>,
F: Into<String>,
fn send_contact<C, P, F>( &self, chat_id: C, phone_number: P, first_name: F ) -> Self::SendContactwhere C: Into<Recipient>, P: Into<String>, F: Into<String>,
SendContact
.type SendPoll = JsonRequest<SendPoll>
source§fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPollwhere
C: Into<Recipient>,
Q: Into<String>,
O: IntoIterator<Item = String>,
fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPollwhere C: Into<Recipient>, Q: Into<String>, O: IntoIterator<Item = String>,
SendPoll
.type SendDice = JsonRequest<SendDice>
source§fn send_dice<C>(&self, chat_id: C) -> Self::SendDicewhere
C: Into<Recipient>,
fn send_dice<C>(&self, chat_id: C) -> Self::SendDicewhere C: Into<Recipient>,
SendDice
.type SendChatAction = JsonRequest<SendChatAction>
source§fn send_chat_action<C>(
&self,
chat_id: C,
action: ChatAction
) -> Self::SendChatActionwhere
C: Into<Recipient>,
fn send_chat_action<C>( &self, chat_id: C, action: ChatAction ) -> Self::SendChatActionwhere C: Into<Recipient>,
SendChatAction
.type GetUserProfilePhotos = JsonRequest<GetUserProfilePhotos>
source§fn get_user_profile_photos(&self, user_id: UserId) -> Self::GetUserProfilePhotos
fn get_user_profile_photos(&self, user_id: UserId) -> Self::GetUserProfilePhotos
GetUserProfilePhotos
.type GetFile = JsonRequest<GetFile>
source§fn get_file<F>(&self, file_id: F) -> Self::GetFilewhere
F: Into<String>,
fn get_file<F>(&self, file_id: F) -> Self::GetFilewhere F: Into<String>,
GetFile
.type KickChatMember = JsonRequest<KickChatMember>
source§fn kick_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::KickChatMemberwhere
C: Into<Recipient>,
fn kick_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::KickChatMemberwhere C: Into<Recipient>,
KickChatMember
.type BanChatMember = JsonRequest<BanChatMember>
source§fn ban_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::BanChatMemberwhere
C: Into<Recipient>,
fn ban_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::BanChatMemberwhere C: Into<Recipient>,
BanChatMember
.type UnbanChatMember = JsonRequest<UnbanChatMember>
source§fn unban_chat_member<C>(
&self,
chat_id: C,
user_id: UserId
) -> Self::UnbanChatMemberwhere
C: Into<Recipient>,
fn unban_chat_member<C>( &self, chat_id: C, user_id: UserId ) -> Self::UnbanChatMemberwhere C: Into<Recipient>,
UnbanChatMember
.type RestrictChatMember = JsonRequest<RestrictChatMember>
source§fn restrict_chat_member<C>(
&self,
chat_id: C,
user_id: UserId,
permissions: ChatPermissions
) -> Self::RestrictChatMemberwhere
C: Into<Recipient>,
fn restrict_chat_member<C>( &self, chat_id: C, user_id: UserId, permissions: ChatPermissions ) -> Self::RestrictChatMemberwhere C: Into<Recipient>,
RestrictChatMember
.type PromoteChatMember = JsonRequest<PromoteChatMember>
source§fn promote_chat_member<C>(
&self,
chat_id: C,
user_id: UserId
) -> Self::PromoteChatMemberwhere
C: Into<Recipient>,
fn promote_chat_member<C>( &self, chat_id: C, user_id: UserId ) -> Self::PromoteChatMemberwhere C: Into<Recipient>,
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::SetChatAdministratorCustomTitlewhere
Ch: Into<Recipient>,
Cu: Into<String>,
fn set_chat_administrator_custom_title<Ch, Cu>( &self, chat_id: Ch, user_id: UserId, custom_title: Cu ) -> Self::SetChatAdministratorCustomTitlewhere Ch: Into<Recipient>, Cu: Into<String>,
SetChatAdministratorCustomTitle
.type BanChatSenderChat = JsonRequest<BanChatSenderChat>
source§fn ban_chat_sender_chat<C, S>(
&self,
chat_id: C,
sender_chat_id: S
) -> Self::BanChatSenderChatwhere
C: Into<Recipient>,
S: Into<ChatId>,
fn ban_chat_sender_chat<C, S>( &self, chat_id: C, sender_chat_id: S ) -> Self::BanChatSenderChatwhere C: Into<Recipient>, S: Into<ChatId>,
BanChatSenderChat
.type UnbanChatSenderChat = JsonRequest<UnbanChatSenderChat>
source§fn unban_chat_sender_chat<C, S>(
&self,
chat_id: C,
sender_chat_id: S
) -> Self::UnbanChatSenderChatwhere
C: Into<Recipient>,
S: Into<ChatId>,
fn unban_chat_sender_chat<C, S>( &self, chat_id: C, sender_chat_id: S ) -> Self::UnbanChatSenderChatwhere C: Into<Recipient>, S: Into<ChatId>,
UnbanChatSenderChat
.type SetChatPermissions = JsonRequest<SetChatPermissions>
source§fn set_chat_permissions<C>(
&self,
chat_id: C,
permissions: ChatPermissions
) -> Self::SetChatPermissionswhere
C: Into<Recipient>,
fn set_chat_permissions<C>( &self, chat_id: C, permissions: ChatPermissions ) -> Self::SetChatPermissionswhere C: Into<Recipient>,
SetChatPermissions
.type ExportChatInviteLink = JsonRequest<ExportChatInviteLink>
source§fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLinkwhere
C: Into<Recipient>,
fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLinkwhere C: Into<Recipient>,
ExportChatInviteLink
.type CreateChatInviteLink = JsonRequest<CreateChatInviteLink>
source§fn create_chat_invite_link<C>(&self, chat_id: C) -> Self::CreateChatInviteLinkwhere
C: Into<Recipient>,
fn create_chat_invite_link<C>(&self, chat_id: C) -> Self::CreateChatInviteLinkwhere C: Into<Recipient>,
CreateChatInviteLink
.type EditChatInviteLink = JsonRequest<EditChatInviteLink>
source§fn edit_chat_invite_link<C, I>(
&self,
chat_id: C,
invite_link: I
) -> Self::EditChatInviteLinkwhere
C: Into<Recipient>,
I: Into<String>,
fn edit_chat_invite_link<C, I>( &self, chat_id: C, invite_link: I ) -> Self::EditChatInviteLinkwhere C: Into<Recipient>, I: Into<String>,
EditChatInviteLink
.type RevokeChatInviteLink = JsonRequest<RevokeChatInviteLink>
source§fn revoke_chat_invite_link<C, I>(
&self,
chat_id: C,
invite_link: I
) -> Self::RevokeChatInviteLinkwhere
C: Into<Recipient>,
I: Into<String>,
fn revoke_chat_invite_link<C, I>( &self, chat_id: C, invite_link: I ) -> Self::RevokeChatInviteLinkwhere C: Into<Recipient>, I: Into<String>,
RevokeChatInviteLink
.type ApproveChatJoinRequest = JsonRequest<ApproveChatJoinRequest>
source§fn approve_chat_join_request<C>(
&self,
chat_id: C,
user_id: UserId
) -> Self::ApproveChatJoinRequestwhere
C: Into<Recipient>,
fn approve_chat_join_request<C>( &self, chat_id: C, user_id: UserId ) -> Self::ApproveChatJoinRequestwhere C: Into<Recipient>,
ApproveChatJoinRequest
.type DeclineChatJoinRequest = JsonRequest<DeclineChatJoinRequest>
source§fn decline_chat_join_request<C>(
&self,
chat_id: C,
user_id: UserId
) -> Self::DeclineChatJoinRequestwhere
C: Into<Recipient>,
fn decline_chat_join_request<C>( &self, chat_id: C, user_id: UserId ) -> Self::DeclineChatJoinRequestwhere C: Into<Recipient>,
DeclineChatJoinRequest
.type SetChatPhoto = MultipartRequest<SetChatPhoto>
source§fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhotowhere
C: Into<Recipient>,
fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhotowhere C: Into<Recipient>,
SetChatPhoto
.type DeleteChatPhoto = JsonRequest<DeleteChatPhoto>
source§fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhotowhere
C: Into<Recipient>,
fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhotowhere C: Into<Recipient>,
DeleteChatPhoto
.type SetChatTitle = JsonRequest<SetChatTitle>
source§fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitlewhere
C: Into<Recipient>,
T: Into<String>,
fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitlewhere C: Into<Recipient>, T: Into<String>,
SetChatTitle
.type SetChatDescription = JsonRequest<SetChatDescription>
source§fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescriptionwhere
C: Into<Recipient>,
fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescriptionwhere C: Into<Recipient>,
SetChatDescription
.type PinChatMessage = JsonRequest<PinChatMessage>
source§fn pin_chat_message<C>(
&self,
chat_id: C,
message_id: MessageId
) -> Self::PinChatMessagewhere
C: Into<Recipient>,
fn pin_chat_message<C>( &self, chat_id: C, message_id: MessageId ) -> Self::PinChatMessagewhere C: Into<Recipient>,
PinChatMessage
.type UnpinChatMessage = JsonRequest<UnpinChatMessage>
source§fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessagewhere
C: Into<Recipient>,
fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessagewhere C: Into<Recipient>,
UnpinChatMessage
.type LeaveChat = JsonRequest<LeaveChat>
source§fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChatwhere
C: Into<Recipient>,
fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChatwhere C: Into<Recipient>,
LeaveChat
.type GetChat = JsonRequest<GetChat>
source§fn get_chat<C>(&self, chat_id: C) -> Self::GetChatwhere
C: Into<Recipient>,
fn get_chat<C>(&self, chat_id: C) -> Self::GetChatwhere C: Into<Recipient>,
GetChat
.type GetChatAdministrators = JsonRequest<GetChatAdministrators>
source§fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministratorswhere
C: Into<Recipient>,
fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministratorswhere C: Into<Recipient>,
GetChatAdministrators
.type GetChatMembersCount = JsonRequest<GetChatMembersCount>
source§fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCountwhere
C: Into<Recipient>,
fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCountwhere C: Into<Recipient>,
GetChatMembersCount
.type GetChatMemberCount = JsonRequest<GetChatMemberCount>
source§fn get_chat_member_count<C>(&self, chat_id: C) -> Self::GetChatMemberCountwhere
C: Into<Recipient>,
fn get_chat_member_count<C>(&self, chat_id: C) -> Self::GetChatMemberCountwhere C: Into<Recipient>,
GetChatMemberCount
.type GetChatMember = JsonRequest<GetChatMember>
source§fn get_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::GetChatMemberwhere
C: Into<Recipient>,
fn get_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::GetChatMemberwhere C: Into<Recipient>,
GetChatMember
.type SetChatStickerSet = JsonRequest<SetChatStickerSet>
source§fn set_chat_sticker_set<C, S>(
&self,
chat_id: C,
sticker_set_name: S
) -> Self::SetChatStickerSetwhere
C: Into<Recipient>,
S: Into<String>,
fn set_chat_sticker_set<C, S>( &self, chat_id: C, sticker_set_name: S ) -> Self::SetChatStickerSetwhere C: Into<Recipient>, S: Into<String>,
SetChatStickerSet
.type DeleteChatStickerSet = JsonRequest<DeleteChatStickerSet>
source§fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSetwhere
C: Into<Recipient>,
fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSetwhere C: Into<Recipient>,
DeleteChatStickerSet
.type GetForumTopicIconStickers = JsonRequest<GetForumTopicIconStickers>
source§fn get_forum_topic_icon_stickers(&self) -> Self::GetForumTopicIconStickers
fn get_forum_topic_icon_stickers(&self) -> Self::GetForumTopicIconStickers
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::CreateForumTopicwhere
C: Into<Recipient>,
N: Into<String>,
I: Into<String>,
fn create_forum_topic<C, N, I>( &self, chat_id: C, name: N, icon_color: u32, icon_custom_emoji_id: I ) -> Self::CreateForumTopicwhere C: Into<Recipient>, N: Into<String>, I: Into<String>,
CreateForumTopic
.type EditForumTopic = JsonRequest<EditForumTopic>
source§fn edit_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: i32
) -> Self::EditForumTopicwhere
C: Into<Recipient>,
fn edit_forum_topic<C>( &self, chat_id: C, message_thread_id: i32 ) -> Self::EditForumTopicwhere C: Into<Recipient>,
EditForumTopic
.type CloseForumTopic = JsonRequest<CloseForumTopic>
source§fn close_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: i32
) -> Self::CloseForumTopicwhere
C: Into<Recipient>,
fn close_forum_topic<C>( &self, chat_id: C, message_thread_id: i32 ) -> Self::CloseForumTopicwhere C: Into<Recipient>,
CloseForumTopic
.type ReopenForumTopic = JsonRequest<ReopenForumTopic>
source§fn reopen_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: i32
) -> Self::ReopenForumTopicwhere
C: Into<Recipient>,
fn reopen_forum_topic<C>( &self, chat_id: C, message_thread_id: i32 ) -> Self::ReopenForumTopicwhere C: Into<Recipient>,
ReopenForumTopic
.type DeleteForumTopic = JsonRequest<DeleteForumTopic>
source§fn delete_forum_topic<C>(
&self,
chat_id: C,
message_thread_id: i32
) -> Self::DeleteForumTopicwhere
C: Into<Recipient>,
fn delete_forum_topic<C>( &self, chat_id: C, message_thread_id: i32 ) -> Self::DeleteForumTopicwhere C: Into<Recipient>,
DeleteForumTopic
.type UnpinAllForumTopicMessages = JsonRequest<UnpinAllForumTopicMessages>
source§fn unpin_all_forum_topic_messages<C>(
&self,
chat_id: C,
message_thread_id: i32
) -> Self::UnpinAllForumTopicMessageswhere
C: Into<Recipient>,
fn unpin_all_forum_topic_messages<C>( &self, chat_id: C, message_thread_id: i32 ) -> Self::UnpinAllForumTopicMessageswhere C: Into<Recipient>,
UnpinAllForumTopicMessages
.type EditGeneralForumTopic = JsonRequest<EditGeneralForumTopic>
source§fn edit_general_forum_topic<C, N>(
&self,
chat_id: C,
name: N
) -> Self::EditGeneralForumTopicwhere
C: Into<Recipient>,
N: Into<String>,
fn edit_general_forum_topic<C, N>( &self, chat_id: C, name: N ) -> Self::EditGeneralForumTopicwhere C: Into<Recipient>, N: Into<String>,
EditGeneralForumTopic
.type CloseGeneralForumTopic = JsonRequest<CloseGeneralForumTopic>
source§fn close_general_forum_topic<C>(
&self,
chat_id: C
) -> Self::CloseGeneralForumTopicwhere
C: Into<Recipient>,
fn close_general_forum_topic<C>( &self, chat_id: C ) -> Self::CloseGeneralForumTopicwhere C: Into<Recipient>,
CloseGeneralForumTopic
.type ReopenGeneralForumTopic = JsonRequest<ReopenGeneralForumTopic>
source§fn reopen_general_forum_topic<C>(
&self,
chat_id: C
) -> Self::ReopenGeneralForumTopicwhere
C: Into<Recipient>,
fn reopen_general_forum_topic<C>( &self, chat_id: C ) -> Self::ReopenGeneralForumTopicwhere C: Into<Recipient>,
ReopenGeneralForumTopic
.type HideGeneralForumTopic = JsonRequest<HideGeneralForumTopic>
source§fn hide_general_forum_topic<C>(&self, chat_id: C) -> Self::HideGeneralForumTopicwhere
C: Into<Recipient>,
fn hide_general_forum_topic<C>(&self, chat_id: C) -> Self::HideGeneralForumTopicwhere C: Into<Recipient>,
HideGeneralForumTopic
.type UnhideGeneralForumTopic = JsonRequest<UnhideGeneralForumTopic>
source§fn unhide_general_forum_topic<C>(
&self,
chat_id: C
) -> Self::UnhideGeneralForumTopicwhere
C: Into<Recipient>,
fn unhide_general_forum_topic<C>( &self, chat_id: C ) -> Self::UnhideGeneralForumTopicwhere C: Into<Recipient>,
UnhideGeneralForumTopic
.type AnswerCallbackQuery = JsonRequest<AnswerCallbackQuery>
source§fn answer_callback_query<C>(
&self,
callback_query_id: C
) -> Self::AnswerCallbackQuerywhere
C: Into<String>,
fn answer_callback_query<C>( &self, callback_query_id: C ) -> Self::AnswerCallbackQuerywhere C: Into<String>,
AnswerCallbackQuery
.type SetMyCommands = JsonRequest<SetMyCommands>
source§fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommandswhere
C: IntoIterator<Item = BotCommand>,
fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommandswhere C: IntoIterator<Item = BotCommand>,
SetMyCommands
.type GetMyCommands = JsonRequest<GetMyCommands>
source§fn get_my_commands(&self) -> Self::GetMyCommands
fn get_my_commands(&self) -> Self::GetMyCommands
GetMyCommands
.type SetChatMenuButton = JsonRequest<SetChatMenuButton>
SetChatMenuButton
.type GetChatMenuButton = JsonRequest<GetChatMenuButton>
GetChatMenuButton
.type SetMyDefaultAdministratorRights = JsonRequest<SetMyDefaultAdministratorRights>
source§fn set_my_default_administrator_rights(
&self
) -> Self::SetMyDefaultAdministratorRights
fn set_my_default_administrator_rights( &self ) -> Self::SetMyDefaultAdministratorRights
SetMyDefaultAdministratorRights
.type GetMyDefaultAdministratorRights = JsonRequest<GetMyDefaultAdministratorRights>
source§fn get_my_default_administrator_rights(
&self
) -> Self::GetMyDefaultAdministratorRights
fn get_my_default_administrator_rights( &self ) -> Self::GetMyDefaultAdministratorRights
GetMyDefaultAdministratorRights
.type DeleteMyCommands = JsonRequest<DeleteMyCommands>
source§fn delete_my_commands(&self) -> Self::DeleteMyCommands
fn delete_my_commands(&self) -> Self::DeleteMyCommands
DeleteMyCommands
.type AnswerInlineQuery = JsonRequest<AnswerInlineQuery>
source§fn answer_inline_query<I, R>(
&self,
inline_query_id: I,
results: R
) -> Self::AnswerInlineQuerywhere
I: Into<String>,
R: IntoIterator<Item = InlineQueryResult>,
fn answer_inline_query<I, R>( &self, inline_query_id: I, results: R ) -> Self::AnswerInlineQuerywhere I: Into<String>, R: IntoIterator<Item = InlineQueryResult>,
AnswerInlineQuery
.type AnswerWebAppQuery = JsonRequest<AnswerWebAppQuery>
source§fn answer_web_app_query<W>(
&self,
web_app_query_id: W,
result: InlineQueryResult
) -> Self::AnswerWebAppQuerywhere
W: Into<String>,
fn answer_web_app_query<W>( &self, web_app_query_id: W, result: InlineQueryResult ) -> Self::AnswerWebAppQuerywhere W: Into<String>,
AnswerWebAppQuery
.type EditMessageText = JsonRequest<EditMessageText>
source§fn edit_message_text<C, T>(
&self,
chat_id: C,
message_id: MessageId,
text: T
) -> Self::EditMessageTextwhere
C: Into<Recipient>,
T: Into<String>,
fn edit_message_text<C, T>( &self, chat_id: C, message_id: MessageId, text: T ) -> Self::EditMessageTextwhere C: Into<Recipient>, T: Into<String>,
EditMessageText
.type EditMessageTextInline = JsonRequest<EditMessageTextInline>
source§fn edit_message_text_inline<I, T>(
&self,
inline_message_id: I,
text: T
) -> Self::EditMessageTextInlinewhere
I: Into<String>,
T: Into<String>,
fn edit_message_text_inline<I, T>( &self, inline_message_id: I, text: T ) -> Self::EditMessageTextInlinewhere I: Into<String>, T: Into<String>,
EditMessageTextInline
.type EditMessageCaption = JsonRequest<EditMessageCaption>
EditMessageCaption
.type EditMessageCaptionInline = JsonRequest<EditMessageCaptionInline>
EditMessageCaptionInline
.type EditMessageMedia = MultipartRequest<EditMessageMedia>
source§fn edit_message_media<C>(
&self,
chat_id: C,
message_id: MessageId,
media: InputMedia
) -> Self::EditMessageMediawhere
C: Into<Recipient>,
fn edit_message_media<C>( &self, chat_id: C, message_id: MessageId, media: InputMedia ) -> Self::EditMessageMediawhere C: Into<Recipient>,
EditMessageMedia
.type EditMessageMediaInline = MultipartRequest<EditMessageMediaInline>
source§fn edit_message_media_inline<I>(
&self,
inline_message_id: I,
media: InputMedia
) -> Self::EditMessageMediaInlinewhere
I: Into<String>,
fn edit_message_media_inline<I>( &self, inline_message_id: I, media: InputMedia ) -> Self::EditMessageMediaInlinewhere I: Into<String>,
EditMessageMediaInline
.type EditMessageReplyMarkup = JsonRequest<EditMessageReplyMarkup>
source§fn edit_message_reply_markup<C>(
&self,
chat_id: C,
message_id: MessageId
) -> Self::EditMessageReplyMarkupwhere
C: Into<Recipient>,
fn edit_message_reply_markup<C>( &self, chat_id: C, message_id: MessageId ) -> Self::EditMessageReplyMarkupwhere C: Into<Recipient>,
EditMessageReplyMarkup
.type EditMessageReplyMarkupInline = JsonRequest<EditMessageReplyMarkupInline>
source§fn edit_message_reply_markup_inline<I>(
&self,
inline_message_id: I
) -> Self::EditMessageReplyMarkupInlinewhere
I: Into<String>,
fn edit_message_reply_markup_inline<I>( &self, inline_message_id: I ) -> Self::EditMessageReplyMarkupInlinewhere I: Into<String>,
EditMessageReplyMarkupInline
.type StopPoll = JsonRequest<StopPoll>
source§fn stop_poll<C>(&self, chat_id: C, message_id: MessageId) -> Self::StopPollwhere
C: Into<Recipient>,
fn stop_poll<C>(&self, chat_id: C, message_id: MessageId) -> Self::StopPollwhere C: Into<Recipient>,
StopPoll
.type DeleteMessage = JsonRequest<DeleteMessage>
source§fn delete_message<C>(
&self,
chat_id: C,
message_id: MessageId
) -> Self::DeleteMessagewhere
C: Into<Recipient>,
fn delete_message<C>( &self, chat_id: C, message_id: MessageId ) -> Self::DeleteMessagewhere C: Into<Recipient>,
DeleteMessage
.type SendSticker = MultipartRequest<SendSticker>
source§fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendStickerwhere
C: Into<Recipient>,
fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendStickerwhere C: Into<Recipient>,
SendSticker
.type GetStickerSet = JsonRequest<GetStickerSet>
source§fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSetwhere
N: Into<String>,
fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSetwhere N: Into<String>,
GetStickerSet
.type GetCustomEmojiStickers = JsonRequest<GetCustomEmojiStickers>
source§fn get_custom_emoji_stickers<C>(
&self,
custom_emoji_ids: C
) -> Self::GetCustomEmojiStickerswhere
C: IntoIterator<Item = String>,
fn get_custom_emoji_stickers<C>( &self, custom_emoji_ids: C ) -> Self::GetCustomEmojiStickerswhere C: IntoIterator<Item = String>,
GetCustomEmojiStickers
.type UploadStickerFile = MultipartRequest<UploadStickerFile>
source§fn upload_sticker_file(
&self,
user_id: UserId,
png_sticker: InputFile
) -> Self::UploadStickerFile
fn upload_sticker_file( &self, user_id: UserId, png_sticker: InputFile ) -> Self::UploadStickerFile
UploadStickerFile
.type CreateNewStickerSet = MultipartRequest<CreateNewStickerSet>
source§fn create_new_sticker_set<N, T, E>(
&self,
user_id: UserId,
name: N,
title: T,
sticker: InputSticker,
emojis: E
) -> Self::CreateNewStickerSetwhere
N: Into<String>,
T: Into<String>,
E: Into<String>,
fn create_new_sticker_set<N, T, E>( &self, user_id: UserId, name: N, title: T, sticker: InputSticker, emojis: E ) -> Self::CreateNewStickerSetwhere N: Into<String>, T: Into<String>, E: Into<String>,
CreateNewStickerSet
.type AddStickerToSet = MultipartRequest<AddStickerToSet>
source§fn add_sticker_to_set<N, E>(
&self,
user_id: UserId,
name: N,
sticker: InputSticker,
emojis: E
) -> Self::AddStickerToSetwhere
N: Into<String>,
E: Into<String>,
fn add_sticker_to_set<N, E>( &self, user_id: UserId, name: N, sticker: InputSticker, emojis: E ) -> Self::AddStickerToSetwhere N: Into<String>, E: Into<String>,
AddStickerToSet
.type SetStickerPositionInSet = JsonRequest<SetStickerPositionInSet>
source§fn set_sticker_position_in_set<S>(
&self,
sticker: S,
position: u32
) -> Self::SetStickerPositionInSetwhere
S: Into<String>,
fn set_sticker_position_in_set<S>( &self, sticker: S, position: u32 ) -> Self::SetStickerPositionInSetwhere S: Into<String>,
SetStickerPositionInSet
.type DeleteStickerFromSet = JsonRequest<DeleteStickerFromSet>
source§fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSetwhere
S: Into<String>,
fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSetwhere S: Into<String>,
DeleteStickerFromSet
.type SetStickerSetThumb = MultipartRequest<SetStickerSetThumb>
source§fn set_sticker_set_thumb<N>(
&self,
name: N,
user_id: UserId
) -> Self::SetStickerSetThumbwhere
N: Into<String>,
fn set_sticker_set_thumb<N>( &self, name: N, user_id: UserId ) -> Self::SetStickerSetThumbwhere N: Into<String>,
SetStickerSetThumb
.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::SendInvoicewhere
Ch: Into<Recipient>,
T: Into<String>,
D: Into<String>,
Pa: Into<String>,
P: Into<String>,
C: Into<String>,
Pri: IntoIterator<Item = LabeledPrice>,
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::SendInvoicewhere Ch: Into<Recipient>, T: Into<String>, D: Into<String>, Pa: Into<String>, P: Into<String>, C: Into<String>, Pri: IntoIterator<Item = LabeledPrice>,
SendInvoice
.type CreateInvoiceLink = JsonRequest<CreateInvoiceLink>
source§fn create_invoice_link<T, D, Pa, P, C, Pri>(
&self,
title: T,
description: D,
payload: Pa,
provider_token: P,
currency: C,
prices: Pri
) -> Self::CreateInvoiceLinkwhere
T: Into<String>,
D: Into<String>,
Pa: Into<String>,
P: Into<String>,
C: Into<String>,
Pri: IntoIterator<Item = LabeledPrice>,
fn create_invoice_link<T, D, Pa, P, C, Pri>( &self, title: T, description: D, payload: Pa, provider_token: P, currency: C, prices: Pri ) -> Self::CreateInvoiceLinkwhere T: Into<String>, D: Into<String>, Pa: Into<String>, P: Into<String>, C: Into<String>, Pri: IntoIterator<Item = LabeledPrice>,
CreateInvoiceLink
.type AnswerShippingQuery = JsonRequest<AnswerShippingQuery>
source§fn answer_shipping_query<S>(
&self,
shipping_query_id: S,
ok: bool
) -> Self::AnswerShippingQuerywhere
S: Into<String>,
fn answer_shipping_query<S>( &self, shipping_query_id: S, ok: bool ) -> Self::AnswerShippingQuerywhere S: Into<String>,
AnswerShippingQuery
.type AnswerPreCheckoutQuery = JsonRequest<AnswerPreCheckoutQuery>
source§fn answer_pre_checkout_query<P>(
&self,
pre_checkout_query_id: P,
ok: bool
) -> Self::AnswerPreCheckoutQuerywhere
P: Into<String>,
fn answer_pre_checkout_query<P>( &self, pre_checkout_query_id: P, ok: bool ) -> Self::AnswerPreCheckoutQuerywhere P: Into<String>,
AnswerPreCheckoutQuery
.type SetPassportDataErrors = JsonRequest<SetPassportDataErrors>
source§fn set_passport_data_errors<E>(
&self,
user_id: UserId,
errors: E
) -> Self::SetPassportDataErrorswhere
E: IntoIterator<Item = PassportElementError>,
fn set_passport_data_errors<E>( &self, user_id: UserId, errors: E ) -> Self::SetPassportDataErrorswhere E: IntoIterator<Item = PassportElementError>,
SetPassportDataErrors
.type SendGame = JsonRequest<SendGame>
source§fn send_game<G>(&self, chat_id: u32, game_short_name: G) -> Self::SendGamewhere
G: Into<String>,
fn send_game<G>(&self, chat_id: u32, game_short_name: G) -> Self::SendGamewhere G: Into<String>,
SendGame
.type SetGameScore = JsonRequest<SetGameScore>
source§fn set_game_score(
&self,
user_id: UserId,
score: u64,
chat_id: u32,
message_id: MessageId
) -> Self::SetGameScore
fn set_game_score( &self, user_id: UserId, score: u64, chat_id: u32, message_id: MessageId ) -> Self::SetGameScore
SetGameScore
.type SetGameScoreInline = JsonRequest<SetGameScoreInline>
source§fn set_game_score_inline<I>(
&self,
user_id: UserId,
score: u64,
inline_message_id: I
) -> Self::SetGameScoreInlinewhere
I: Into<String>,
fn set_game_score_inline<I>( &self, user_id: UserId, score: u64, inline_message_id: I ) -> Self::SetGameScoreInlinewhere I: Into<String>,
SetGameScoreInline
.type GetGameHighScores = JsonRequest<GetGameHighScores>
source§fn get_game_high_scores<T>(
&self,
user_id: UserId,
target: T
) -> Self::GetGameHighScoreswhere
T: Into<TargetMessage>,
fn get_game_high_scores<T>( &self, user_id: UserId, target: T ) -> Self::GetGameHighScoreswhere T: Into<TargetMessage>,
GetGameHighScores
.type LogOut = JsonRequest<LogOut>
type Close = JsonRequest<Close>
type CopyMessage = JsonRequest<CopyMessage>
source§fn copy_message<C, F>(
&self,
chat_id: C,
from_chat_id: F,
message_id: MessageId
) -> Self::CopyMessagewhere
C: Into<Recipient>,
F: Into<Recipient>,
fn copy_message<C, F>( &self, chat_id: C, from_chat_id: F, message_id: MessageId ) -> Self::CopyMessagewhere C: Into<Recipient>, F: Into<Recipient>,
CopyMessage
.type UnpinAllChatMessages = JsonRequest<UnpinAllChatMessages>
source§fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessageswhere
C: Into<Recipient>,
fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessageswhere C: Into<Recipient>,
UnpinAllChatMessages
.