#![allow(
clippy::too_many_arguments,
unused_mut,
rustdoc::bare_urls,
rustdoc::invalid_html_tags
)]
pub const BOUND_METHOD_COUNT: usize = 187;
impl super::CallbackQuery {
#[doc = "Builds `AnswerCallbackQuery` and fills fields bound by aiogram's `CallbackQuery.answer` shortcut."]
pub fn answer(&self) -> crate::Result<crate::methods::AnswerCallbackQuery> {
let mut method = crate::methods::AnswerCallbackQuery::new(self.id.clone());
Ok(method)
}
}
impl super::Chat {
#[doc = "Builds `BanChatMember` and fills fields bound by aiogram's `Chat.ban` shortcut."]
pub fn ban(&self, user_id: i64) -> crate::Result<crate::methods::BanChatMember> {
let mut method = crate::methods::BanChatMember::new(self.id, user_id);
Ok(method)
}
#[doc = "Builds `BanChatSenderChat` and fills fields bound by aiogram's `Chat.ban_sender_chat` shortcut."]
pub fn ban_sender_chat(
&self,
sender_chat_id: i64,
) -> crate::Result<crate::methods::BanChatSenderChat> {
let mut method = crate::methods::BanChatSenderChat::new(self.id, sender_chat_id);
Ok(method)
}
#[doc = "Builds `CreateChatInviteLink` and fills fields bound by aiogram's `Chat.create_invite_link` shortcut."]
pub fn create_invite_link(&self) -> crate::Result<crate::methods::CreateChatInviteLink> {
let mut method = crate::methods::CreateChatInviteLink::new(self.id);
Ok(method)
}
#[doc = "Builds `DeleteMessage` and fills fields bound by aiogram's `Chat.delete_message` shortcut."]
pub fn delete_message(&self, message_id: i64) -> crate::Result<crate::methods::DeleteMessage> {
let mut method = crate::methods::DeleteMessage::new(self.id, message_id);
Ok(method)
}
#[doc = "Builds `DeleteChatPhoto` and fills fields bound by aiogram's `Chat.delete_photo` shortcut."]
pub fn delete_photo(&self) -> crate::Result<crate::methods::DeleteChatPhoto> {
let mut method = crate::methods::DeleteChatPhoto::new(self.id);
Ok(method)
}
#[doc = "Builds `DeleteChatStickerSet` and fills fields bound by aiogram's `Chat.delete_sticker_set` shortcut."]
pub fn delete_sticker_set(&self) -> crate::Result<crate::methods::DeleteChatStickerSet> {
let mut method = crate::methods::DeleteChatStickerSet::new(self.id);
Ok(method)
}
#[doc = "Builds `SendChatAction` and fills fields bound by aiogram's `Chat.do` shortcut."]
pub fn r#do(&self, action: impl Into<String>) -> crate::Result<crate::methods::SendChatAction> {
let mut method = crate::methods::SendChatAction::new(self.id, action);
Ok(method)
}
#[doc = "Builds `EditChatInviteLink` and fills fields bound by aiogram's `Chat.edit_invite_link` shortcut."]
pub fn edit_invite_link(
&self,
invite_link: impl Into<String>,
) -> crate::Result<crate::methods::EditChatInviteLink> {
let mut method = crate::methods::EditChatInviteLink::new(self.id, invite_link);
Ok(method)
}
#[doc = "Builds `ExportChatInviteLink` and fills fields bound by aiogram's `Chat.export_invite_link` shortcut."]
pub fn export_invite_link(&self) -> crate::Result<crate::methods::ExportChatInviteLink> {
let mut method = crate::methods::ExportChatInviteLink::new(self.id);
Ok(method)
}
#[doc = "Builds `GetChatAdministrators` and fills fields bound by aiogram's `Chat.get_administrators` shortcut."]
pub fn get_administrators(&self) -> crate::Result<crate::methods::GetChatAdministrators> {
let mut method = crate::methods::GetChatAdministrators::new(self.id);
Ok(method)
}
#[doc = "Builds `GetChatMember` and fills fields bound by aiogram's `Chat.get_member` shortcut."]
pub fn get_member(&self, user_id: i64) -> crate::Result<crate::methods::GetChatMember> {
let mut method = crate::methods::GetChatMember::new(self.id, user_id);
Ok(method)
}
#[doc = "Builds `GetChatMemberCount` and fills fields bound by aiogram's `Chat.get_member_count` shortcut."]
pub fn get_member_count(&self) -> crate::Result<crate::methods::GetChatMemberCount> {
let mut method = crate::methods::GetChatMemberCount::new(self.id);
Ok(method)
}
#[doc = "Builds `LeaveChat` and fills fields bound by aiogram's `Chat.leave` shortcut."]
pub fn leave(&self) -> crate::Result<crate::methods::LeaveChat> {
let mut method = crate::methods::LeaveChat::new(self.id);
Ok(method)
}
#[doc = "Builds `PinChatMessage` and fills fields bound by aiogram's `Chat.pin_message` shortcut."]
pub fn pin_message(&self, message_id: i64) -> crate::Result<crate::methods::PinChatMessage> {
let mut method = crate::methods::PinChatMessage::new(self.id, message_id);
Ok(method)
}
#[doc = "Builds `PromoteChatMember` and fills fields bound by aiogram's `Chat.promote` shortcut."]
pub fn promote(&self, user_id: i64) -> crate::Result<crate::methods::PromoteChatMember> {
let mut method = crate::methods::PromoteChatMember::new(self.id, user_id);
Ok(method)
}
#[doc = "Builds `RestrictChatMember` and fills fields bound by aiogram's `Chat.restrict` shortcut."]
pub fn restrict(
&self,
user_id: i64,
permissions: crate::types::ChatPermissions,
) -> crate::Result<crate::methods::RestrictChatMember> {
let mut method = crate::methods::RestrictChatMember::new(self.id, user_id, permissions);
Ok(method)
}
#[doc = "Builds `RevokeChatInviteLink` and fills fields bound by aiogram's `Chat.revoke_invite_link` shortcut."]
pub fn revoke_invite_link(
&self,
invite_link: impl Into<String>,
) -> crate::Result<crate::methods::RevokeChatInviteLink> {
let mut method = crate::methods::RevokeChatInviteLink::new(self.id, invite_link);
Ok(method)
}
#[doc = "Builds `SetChatAdministratorCustomTitle` and fills fields bound by aiogram's `Chat.set_administrator_custom_title` shortcut."]
pub fn set_administrator_custom_title(
&self,
user_id: i64,
custom_title: impl Into<String>,
) -> crate::Result<crate::methods::SetChatAdministratorCustomTitle> {
let mut method =
crate::methods::SetChatAdministratorCustomTitle::new(self.id, user_id, custom_title);
Ok(method)
}
#[doc = "Builds `SetChatDescription` and fills fields bound by aiogram's `Chat.set_description` shortcut."]
pub fn set_description(&self) -> crate::Result<crate::methods::SetChatDescription> {
let mut method = crate::methods::SetChatDescription::new(self.id);
Ok(method)
}
#[doc = "Builds `SetChatMemberTag` and fills fields bound by aiogram's `Chat.set_member_tag` shortcut."]
pub fn set_member_tag(&self, user_id: i64) -> crate::Result<crate::methods::SetChatMemberTag> {
let mut method = crate::methods::SetChatMemberTag::new(self.id, user_id);
Ok(method)
}
#[doc = "Builds `SetChatPermissions` and fills fields bound by aiogram's `Chat.set_permissions` shortcut."]
pub fn set_permissions(
&self,
permissions: crate::types::ChatPermissions,
) -> crate::Result<crate::methods::SetChatPermissions> {
let mut method = crate::methods::SetChatPermissions::new(self.id, permissions);
Ok(method)
}
#[doc = "Builds `SetChatPhoto` and fills fields bound by aiogram's `Chat.set_photo` shortcut."]
pub fn set_photo(
&self,
photo: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SetChatPhoto> {
let mut method = crate::methods::SetChatPhoto::new(self.id, photo);
Ok(method)
}
#[doc = "Builds `SetChatStickerSet` and fills fields bound by aiogram's `Chat.set_sticker_set` shortcut."]
pub fn set_sticker_set(
&self,
sticker_set_name: impl Into<String>,
) -> crate::Result<crate::methods::SetChatStickerSet> {
let mut method = crate::methods::SetChatStickerSet::new(self.id, sticker_set_name);
Ok(method)
}
#[doc = "Builds `SetChatTitle` and fills fields bound by aiogram's `Chat.set_title` shortcut."]
pub fn set_title(
&self,
title: impl Into<String>,
) -> crate::Result<crate::methods::SetChatTitle> {
let mut method = crate::methods::SetChatTitle::new(self.id, title);
Ok(method)
}
#[doc = "Builds `UnbanChatMember` and fills fields bound by aiogram's `Chat.unban` shortcut."]
pub fn unban(&self, user_id: i64) -> crate::Result<crate::methods::UnbanChatMember> {
let mut method = crate::methods::UnbanChatMember::new(self.id, user_id);
Ok(method)
}
#[doc = "Builds `UnbanChatSenderChat` and fills fields bound by aiogram's `Chat.unban_sender_chat` shortcut."]
pub fn unban_sender_chat(
&self,
sender_chat_id: i64,
) -> crate::Result<crate::methods::UnbanChatSenderChat> {
let mut method = crate::methods::UnbanChatSenderChat::new(self.id, sender_chat_id);
Ok(method)
}
#[doc = "Builds `UnpinAllGeneralForumTopicMessages` and fills fields bound by aiogram's `Chat.unpin_all_general_forum_topic_messages` shortcut."]
pub fn unpin_all_general_forum_topic_messages(
&self,
) -> crate::Result<crate::methods::UnpinAllGeneralForumTopicMessages> {
let mut method = crate::methods::UnpinAllGeneralForumTopicMessages::new(self.id);
Ok(method)
}
#[doc = "Builds `UnpinAllChatMessages` and fills fields bound by aiogram's `Chat.unpin_all_messages` shortcut."]
pub fn unpin_all_messages(&self) -> crate::Result<crate::methods::UnpinAllChatMessages> {
let mut method = crate::methods::UnpinAllChatMessages::new(self.id);
Ok(method)
}
#[doc = "Builds `UnpinChatMessage` and fills fields bound by aiogram's `Chat.unpin_message` shortcut."]
pub fn unpin_message(&self) -> crate::Result<crate::methods::UnpinChatMessage> {
let mut method = crate::methods::UnpinChatMessage::new(self.id);
Ok(method)
}
}
impl super::ChatJoinRequest {
#[doc = "Builds `SendMessage` and fills fields bound by aiogram's `ChatJoinRequest.answer` shortcut."]
pub fn answer(&self, text: impl Into<String>) -> crate::Result<crate::methods::SendMessage> {
let mut method = crate::methods::SendMessage::new(self.chat.id, text);
Ok(method)
}
#[doc = "Builds `SendAnimation` and fills fields bound by aiogram's `ChatJoinRequest.answer_animation` shortcut."]
pub fn answer_animation(
&self,
animation: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAnimation> {
let mut method = crate::methods::SendAnimation::new(self.chat.id, animation);
Ok(method)
}
#[doc = "Builds `SendAnimation` and fills fields bound by aiogram's `ChatJoinRequest.answer_animation_pm` shortcut."]
pub fn answer_animation_pm(
&self,
animation: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAnimation> {
let mut method = crate::methods::SendAnimation::new(self.user_chat_id, animation);
Ok(method)
}
#[doc = "Builds `SendAudio` and fills fields bound by aiogram's `ChatJoinRequest.answer_audio` shortcut."]
pub fn answer_audio(
&self,
audio: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAudio> {
let mut method = crate::methods::SendAudio::new(self.chat.id, audio);
Ok(method)
}
#[doc = "Builds `SendAudio` and fills fields bound by aiogram's `ChatJoinRequest.answer_audio_pm` shortcut."]
pub fn answer_audio_pm(
&self,
audio: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAudio> {
let mut method = crate::methods::SendAudio::new(self.user_chat_id, audio);
Ok(method)
}
#[doc = "Builds `SendContact` and fills fields bound by aiogram's `ChatJoinRequest.answer_contact` shortcut."]
pub fn answer_contact(
&self,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> crate::Result<crate::methods::SendContact> {
let mut method = crate::methods::SendContact::new(self.chat.id, phone_number, first_name);
Ok(method)
}
#[doc = "Builds `SendContact` and fills fields bound by aiogram's `ChatJoinRequest.answer_contact_pm` shortcut."]
pub fn answer_contact_pm(
&self,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> crate::Result<crate::methods::SendContact> {
let mut method =
crate::methods::SendContact::new(self.user_chat_id, phone_number, first_name);
Ok(method)
}
#[doc = "Builds `SendDice` and fills fields bound by aiogram's `ChatJoinRequest.answer_dice` shortcut."]
pub fn answer_dice(&self) -> crate::Result<crate::methods::SendDice> {
let mut method = crate::methods::SendDice::new(self.chat.id);
Ok(method)
}
#[doc = "Builds `SendDice` and fills fields bound by aiogram's `ChatJoinRequest.answer_dice_pm` shortcut."]
pub fn answer_dice_pm(&self) -> crate::Result<crate::methods::SendDice> {
let mut method = crate::methods::SendDice::new(self.user_chat_id);
Ok(method)
}
#[doc = "Builds `SendDocument` and fills fields bound by aiogram's `ChatJoinRequest.answer_document` shortcut."]
pub fn answer_document(
&self,
document: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendDocument> {
let mut method = crate::methods::SendDocument::new(self.chat.id, document);
Ok(method)
}
#[doc = "Builds `SendDocument` and fills fields bound by aiogram's `ChatJoinRequest.answer_document_pm` shortcut."]
pub fn answer_document_pm(
&self,
document: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendDocument> {
let mut method = crate::methods::SendDocument::new(self.user_chat_id, document);
Ok(method)
}
#[doc = "Builds `SendGame` and fills fields bound by aiogram's `ChatJoinRequest.answer_game` shortcut."]
pub fn answer_game(
&self,
game_short_name: impl Into<String>,
) -> crate::Result<crate::methods::SendGame> {
let mut method = crate::methods::SendGame::new(self.chat.id, game_short_name);
Ok(method)
}
#[doc = "Builds `SendGame` and fills fields bound by aiogram's `ChatJoinRequest.answer_game_pm` shortcut."]
pub fn answer_game_pm(
&self,
game_short_name: impl Into<String>,
) -> crate::Result<crate::methods::SendGame> {
let mut method = crate::methods::SendGame::new(self.user_chat_id, game_short_name);
Ok(method)
}
#[doc = "Builds `SendInvoice` and fills fields bound by aiogram's `ChatJoinRequest.answer_invoice` shortcut."]
pub fn answer_invoice(
&self,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<crate::types::LabeledPrice>,
) -> crate::Result<crate::methods::SendInvoice> {
let mut method = crate::methods::SendInvoice::new(
self.chat.id,
title,
description,
payload,
currency,
prices,
);
Ok(method)
}
#[doc = "Builds `SendInvoice` and fills fields bound by aiogram's `ChatJoinRequest.answer_invoice_pm` shortcut."]
pub fn answer_invoice_pm(
&self,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<crate::types::LabeledPrice>,
) -> crate::Result<crate::methods::SendInvoice> {
let mut method = crate::methods::SendInvoice::new(
self.user_chat_id,
title,
description,
payload,
currency,
prices,
);
Ok(method)
}
#[doc = "Builds `SendLocation` and fills fields bound by aiogram's `ChatJoinRequest.answer_location` shortcut."]
pub fn answer_location(
&self,
latitude: f64,
longitude: f64,
) -> crate::Result<crate::methods::SendLocation> {
let mut method = crate::methods::SendLocation::new(self.chat.id, latitude, longitude);
Ok(method)
}
#[doc = "Builds `SendLocation` and fills fields bound by aiogram's `ChatJoinRequest.answer_location_pm` shortcut."]
pub fn answer_location_pm(
&self,
latitude: f64,
longitude: f64,
) -> crate::Result<crate::methods::SendLocation> {
let mut method = crate::methods::SendLocation::new(self.user_chat_id, latitude, longitude);
Ok(method)
}
#[doc = "Builds `SendMediaGroup` and fills fields bound by aiogram's `ChatJoinRequest.answer_media_group` shortcut."]
pub fn answer_media_group(
&self,
media: Vec<crate::types::MediaUnion>,
) -> crate::Result<crate::methods::SendMediaGroup> {
let mut method = crate::methods::SendMediaGroup::new(self.chat.id, media);
Ok(method)
}
#[doc = "Builds `SendMediaGroup` and fills fields bound by aiogram's `ChatJoinRequest.answer_media_group_pm` shortcut."]
pub fn answer_media_group_pm(
&self,
media: Vec<crate::types::MediaUnion>,
) -> crate::Result<crate::methods::SendMediaGroup> {
let mut method = crate::methods::SendMediaGroup::new(self.user_chat_id, media);
Ok(method)
}
#[doc = "Builds `SendPhoto` and fills fields bound by aiogram's `ChatJoinRequest.answer_photo` shortcut."]
pub fn answer_photo(
&self,
photo: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendPhoto> {
let mut method = crate::methods::SendPhoto::new(self.chat.id, photo);
Ok(method)
}
#[doc = "Builds `SendPhoto` and fills fields bound by aiogram's `ChatJoinRequest.answer_photo_pm` shortcut."]
pub fn answer_photo_pm(
&self,
photo: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendPhoto> {
let mut method = crate::methods::SendPhoto::new(self.user_chat_id, photo);
Ok(method)
}
#[doc = "Builds `SendMessage` and fills fields bound by aiogram's `ChatJoinRequest.answer_pm` shortcut."]
pub fn answer_pm(&self, text: impl Into<String>) -> crate::Result<crate::methods::SendMessage> {
let mut method = crate::methods::SendMessage::new(self.user_chat_id, text);
Ok(method)
}
#[doc = "Builds `SendPoll` and fills fields bound by aiogram's `ChatJoinRequest.answer_poll` shortcut."]
pub fn answer_poll(
&self,
question: impl Into<String>,
options: Vec<crate::types::InputPollOptionUnion>,
) -> crate::Result<crate::methods::SendPoll> {
let mut method = crate::methods::SendPoll::new(self.chat.id, question, options);
Ok(method)
}
#[doc = "Builds `SendPoll` and fills fields bound by aiogram's `ChatJoinRequest.answer_poll_pm` shortcut."]
pub fn answer_poll_pm(
&self,
question: impl Into<String>,
options: Vec<crate::types::InputPollOptionUnion>,
) -> crate::Result<crate::methods::SendPoll> {
let mut method = crate::methods::SendPoll::new(self.user_chat_id, question, options);
Ok(method)
}
#[doc = "Builds `AnswerChatJoinRequestQuery` and fills fields bound by aiogram's `ChatJoinRequest.answer_query` shortcut."]
pub fn answer_query(
&self,
result: impl Into<String>,
) -> crate::Result<crate::methods::AnswerChatJoinRequestQuery> {
let mut method = crate::methods::AnswerChatJoinRequestQuery::new(self.query_id.clone().ok_or_else(|| crate::Error::InvalidPayload("ChatJoinRequest.answer_query requires source field for chat_join_request_query_id".to_owned()))?, result);
Ok(method)
}
#[doc = "Builds `SendSticker` and fills fields bound by aiogram's `ChatJoinRequest.answer_sticker` shortcut."]
pub fn answer_sticker(
&self,
sticker: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendSticker> {
let mut method = crate::methods::SendSticker::new(self.chat.id, sticker);
Ok(method)
}
#[doc = "Builds `SendSticker` and fills fields bound by aiogram's `ChatJoinRequest.answer_sticker_pm` shortcut."]
pub fn answer_sticker_pm(
&self,
sticker: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendSticker> {
let mut method = crate::methods::SendSticker::new(self.user_chat_id, sticker);
Ok(method)
}
#[doc = "Builds `SendVenue` and fills fields bound by aiogram's `ChatJoinRequest.answer_venue` shortcut."]
pub fn answer_venue(
&self,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> crate::Result<crate::methods::SendVenue> {
let mut method =
crate::methods::SendVenue::new(self.chat.id, latitude, longitude, title, address);
Ok(method)
}
#[doc = "Builds `SendVenue` and fills fields bound by aiogram's `ChatJoinRequest.answer_venue_pm` shortcut."]
pub fn answer_venue_pm(
&self,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> crate::Result<crate::methods::SendVenue> {
let mut method =
crate::methods::SendVenue::new(self.user_chat_id, latitude, longitude, title, address);
Ok(method)
}
#[doc = "Builds `SendVideo` and fills fields bound by aiogram's `ChatJoinRequest.answer_video` shortcut."]
pub fn answer_video(
&self,
video: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideo> {
let mut method = crate::methods::SendVideo::new(self.chat.id, video);
Ok(method)
}
#[doc = "Builds `SendVideoNote` and fills fields bound by aiogram's `ChatJoinRequest.answer_video_note` shortcut."]
pub fn answer_video_note(
&self,
video_note: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideoNote> {
let mut method = crate::methods::SendVideoNote::new(self.chat.id, video_note);
Ok(method)
}
#[doc = "Builds `SendVideoNote` and fills fields bound by aiogram's `ChatJoinRequest.answer_video_note_pm` shortcut."]
pub fn answer_video_note_pm(
&self,
video_note: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideoNote> {
let mut method = crate::methods::SendVideoNote::new(self.user_chat_id, video_note);
Ok(method)
}
#[doc = "Builds `SendVideo` and fills fields bound by aiogram's `ChatJoinRequest.answer_video_pm` shortcut."]
pub fn answer_video_pm(
&self,
video: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideo> {
let mut method = crate::methods::SendVideo::new(self.user_chat_id, video);
Ok(method)
}
#[doc = "Builds `SendVoice` and fills fields bound by aiogram's `ChatJoinRequest.answer_voice` shortcut."]
pub fn answer_voice(
&self,
voice: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVoice> {
let mut method = crate::methods::SendVoice::new(self.chat.id, voice);
Ok(method)
}
#[doc = "Builds `SendVoice` and fills fields bound by aiogram's `ChatJoinRequest.answer_voice_pm` shortcut."]
pub fn answer_voice_pm(
&self,
voice: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVoice> {
let mut method = crate::methods::SendVoice::new(self.user_chat_id, voice);
Ok(method)
}
#[doc = "Builds `ApproveChatJoinRequest` and fills fields bound by aiogram's `ChatJoinRequest.approve` shortcut."]
pub fn approve(&self) -> crate::Result<crate::methods::ApproveChatJoinRequest> {
let mut method =
crate::methods::ApproveChatJoinRequest::new(self.chat.id, self.from_user.id);
Ok(method)
}
#[doc = "Builds `DeclineChatJoinRequest` and fills fields bound by aiogram's `ChatJoinRequest.decline` shortcut."]
pub fn decline(&self) -> crate::Result<crate::methods::DeclineChatJoinRequest> {
let mut method =
crate::methods::DeclineChatJoinRequest::new(self.chat.id, self.from_user.id);
Ok(method)
}
#[doc = "Builds `SendChatJoinRequestWebApp` and fills fields bound by aiogram's `ChatJoinRequest.send_webapp` shortcut."]
pub fn send_webapp(
&self,
web_app_url: impl Into<String>,
) -> crate::Result<crate::methods::SendChatJoinRequestWebApp> {
let mut method = crate::methods::SendChatJoinRequestWebApp::new(self.query_id.clone().ok_or_else(|| crate::Error::InvalidPayload("ChatJoinRequest.send_webapp requires source field for chat_join_request_query_id".to_owned()))?, web_app_url);
Ok(method)
}
}
impl super::ChatMemberUpdated {
#[doc = "Builds `SendMessage` and fills fields bound by aiogram's `ChatMemberUpdated.answer` shortcut."]
pub fn answer(&self, text: impl Into<String>) -> crate::Result<crate::methods::SendMessage> {
let mut method = crate::methods::SendMessage::new(self.chat.id, text);
Ok(method)
}
#[doc = "Builds `SendAnimation` and fills fields bound by aiogram's `ChatMemberUpdated.answer_animation` shortcut."]
pub fn answer_animation(
&self,
animation: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAnimation> {
let mut method = crate::methods::SendAnimation::new(self.chat.id, animation);
Ok(method)
}
#[doc = "Builds `SendAudio` and fills fields bound by aiogram's `ChatMemberUpdated.answer_audio` shortcut."]
pub fn answer_audio(
&self,
audio: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAudio> {
let mut method = crate::methods::SendAudio::new(self.chat.id, audio);
Ok(method)
}
#[doc = "Builds `SendContact` and fills fields bound by aiogram's `ChatMemberUpdated.answer_contact` shortcut."]
pub fn answer_contact(
&self,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> crate::Result<crate::methods::SendContact> {
let mut method = crate::methods::SendContact::new(self.chat.id, phone_number, first_name);
Ok(method)
}
#[doc = "Builds `SendDice` and fills fields bound by aiogram's `ChatMemberUpdated.answer_dice` shortcut."]
pub fn answer_dice(&self) -> crate::Result<crate::methods::SendDice> {
let mut method = crate::methods::SendDice::new(self.chat.id);
Ok(method)
}
#[doc = "Builds `SendDocument` and fills fields bound by aiogram's `ChatMemberUpdated.answer_document` shortcut."]
pub fn answer_document(
&self,
document: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendDocument> {
let mut method = crate::methods::SendDocument::new(self.chat.id, document);
Ok(method)
}
#[doc = "Builds `SendGame` and fills fields bound by aiogram's `ChatMemberUpdated.answer_game` shortcut."]
pub fn answer_game(
&self,
game_short_name: impl Into<String>,
) -> crate::Result<crate::methods::SendGame> {
let mut method = crate::methods::SendGame::new(self.chat.id, game_short_name);
Ok(method)
}
#[doc = "Builds `SendInvoice` and fills fields bound by aiogram's `ChatMemberUpdated.answer_invoice` shortcut."]
pub fn answer_invoice(
&self,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<crate::types::LabeledPrice>,
) -> crate::Result<crate::methods::SendInvoice> {
let mut method = crate::methods::SendInvoice::new(
self.chat.id,
title,
description,
payload,
currency,
prices,
);
Ok(method)
}
#[doc = "Builds `SendLocation` and fills fields bound by aiogram's `ChatMemberUpdated.answer_location` shortcut."]
pub fn answer_location(
&self,
latitude: f64,
longitude: f64,
) -> crate::Result<crate::methods::SendLocation> {
let mut method = crate::methods::SendLocation::new(self.chat.id, latitude, longitude);
Ok(method)
}
#[doc = "Builds `SendMediaGroup` and fills fields bound by aiogram's `ChatMemberUpdated.answer_media_group` shortcut."]
pub fn answer_media_group(
&self,
media: Vec<crate::types::MediaUnion>,
) -> crate::Result<crate::methods::SendMediaGroup> {
let mut method = crate::methods::SendMediaGroup::new(self.chat.id, media);
Ok(method)
}
#[doc = "Builds `SendPhoto` and fills fields bound by aiogram's `ChatMemberUpdated.answer_photo` shortcut."]
pub fn answer_photo(
&self,
photo: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendPhoto> {
let mut method = crate::methods::SendPhoto::new(self.chat.id, photo);
Ok(method)
}
#[doc = "Builds `SendPoll` and fills fields bound by aiogram's `ChatMemberUpdated.answer_poll` shortcut."]
pub fn answer_poll(
&self,
question: impl Into<String>,
options: Vec<crate::types::InputPollOptionUnion>,
) -> crate::Result<crate::methods::SendPoll> {
let mut method = crate::methods::SendPoll::new(self.chat.id, question, options);
Ok(method)
}
#[doc = "Builds `SendSticker` and fills fields bound by aiogram's `ChatMemberUpdated.answer_sticker` shortcut."]
pub fn answer_sticker(
&self,
sticker: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendSticker> {
let mut method = crate::methods::SendSticker::new(self.chat.id, sticker);
Ok(method)
}
#[doc = "Builds `SendVenue` and fills fields bound by aiogram's `ChatMemberUpdated.answer_venue` shortcut."]
pub fn answer_venue(
&self,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> crate::Result<crate::methods::SendVenue> {
let mut method =
crate::methods::SendVenue::new(self.chat.id, latitude, longitude, title, address);
Ok(method)
}
#[doc = "Builds `SendVideo` and fills fields bound by aiogram's `ChatMemberUpdated.answer_video` shortcut."]
pub fn answer_video(
&self,
video: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideo> {
let mut method = crate::methods::SendVideo::new(self.chat.id, video);
Ok(method)
}
#[doc = "Builds `SendVideoNote` and fills fields bound by aiogram's `ChatMemberUpdated.answer_video_note` shortcut."]
pub fn answer_video_note(
&self,
video_note: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideoNote> {
let mut method = crate::methods::SendVideoNote::new(self.chat.id, video_note);
Ok(method)
}
#[doc = "Builds `SendVoice` and fills fields bound by aiogram's `ChatMemberUpdated.answer_voice` shortcut."]
pub fn answer_voice(
&self,
voice: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVoice> {
let mut method = crate::methods::SendVoice::new(self.chat.id, voice);
Ok(method)
}
}
impl super::InaccessibleMessage {
#[doc = "Builds `SendMessage` and fills fields bound by aiogram's `InaccessibleMessage.answer` shortcut."]
pub fn answer(&self, text: impl Into<String>) -> crate::Result<crate::methods::SendMessage> {
let mut method = crate::methods::SendMessage::new(self.chat.id, text);
Ok(method)
}
#[doc = "Builds `SendAnimation` and fills fields bound by aiogram's `InaccessibleMessage.answer_animation` shortcut."]
pub fn answer_animation(
&self,
animation: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAnimation> {
let mut method = crate::methods::SendAnimation::new(self.chat.id, animation);
Ok(method)
}
#[doc = "Builds `SendAudio` and fills fields bound by aiogram's `InaccessibleMessage.answer_audio` shortcut."]
pub fn answer_audio(
&self,
audio: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAudio> {
let mut method = crate::methods::SendAudio::new(self.chat.id, audio);
Ok(method)
}
#[doc = "Builds `SendContact` and fills fields bound by aiogram's `InaccessibleMessage.answer_contact` shortcut."]
pub fn answer_contact(
&self,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> crate::Result<crate::methods::SendContact> {
let mut method = crate::methods::SendContact::new(self.chat.id, phone_number, first_name);
Ok(method)
}
#[doc = "Builds `SendDice` and fills fields bound by aiogram's `InaccessibleMessage.answer_dice` shortcut."]
pub fn answer_dice(&self) -> crate::Result<crate::methods::SendDice> {
let mut method = crate::methods::SendDice::new(self.chat.id);
Ok(method)
}
#[doc = "Builds `SendDocument` and fills fields bound by aiogram's `InaccessibleMessage.answer_document` shortcut."]
pub fn answer_document(
&self,
document: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendDocument> {
let mut method = crate::methods::SendDocument::new(self.chat.id, document);
Ok(method)
}
#[doc = "Builds `SendGame` and fills fields bound by aiogram's `InaccessibleMessage.answer_game` shortcut."]
pub fn answer_game(
&self,
game_short_name: impl Into<String>,
) -> crate::Result<crate::methods::SendGame> {
let mut method = crate::methods::SendGame::new(self.chat.id, game_short_name);
Ok(method)
}
#[doc = "Builds `SendInvoice` and fills fields bound by aiogram's `InaccessibleMessage.answer_invoice` shortcut."]
pub fn answer_invoice(
&self,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<crate::types::LabeledPrice>,
) -> crate::Result<crate::methods::SendInvoice> {
let mut method = crate::methods::SendInvoice::new(
self.chat.id,
title,
description,
payload,
currency,
prices,
);
Ok(method)
}
#[doc = "Builds `SendLocation` and fills fields bound by aiogram's `InaccessibleMessage.answer_location` shortcut."]
pub fn answer_location(
&self,
latitude: f64,
longitude: f64,
) -> crate::Result<crate::methods::SendLocation> {
let mut method = crate::methods::SendLocation::new(self.chat.id, latitude, longitude);
Ok(method)
}
#[doc = "Builds `SendMediaGroup` and fills fields bound by aiogram's `InaccessibleMessage.answer_media_group` shortcut."]
pub fn answer_media_group(
&self,
media: Vec<crate::types::MediaUnion>,
) -> crate::Result<crate::methods::SendMediaGroup> {
let mut method = crate::methods::SendMediaGroup::new(self.chat.id, media);
Ok(method)
}
#[doc = "Builds `SendPaidMedia` and fills fields bound by aiogram's `InaccessibleMessage.answer_paid_media` shortcut."]
pub fn answer_paid_media(
&self,
star_count: i64,
media: Vec<crate::types::InputPaidMediaUnion>,
) -> crate::Result<crate::methods::SendPaidMedia> {
let mut method = crate::methods::SendPaidMedia::new(self.chat.id, star_count, media);
Ok(method)
}
#[doc = "Builds `SendPhoto` and fills fields bound by aiogram's `InaccessibleMessage.answer_photo` shortcut."]
pub fn answer_photo(
&self,
photo: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendPhoto> {
let mut method = crate::methods::SendPhoto::new(self.chat.id, photo);
Ok(method)
}
#[doc = "Builds `SendPoll` and fills fields bound by aiogram's `InaccessibleMessage.answer_poll` shortcut."]
pub fn answer_poll(
&self,
question: impl Into<String>,
options: Vec<crate::types::InputPollOptionUnion>,
) -> crate::Result<crate::methods::SendPoll> {
let mut method = crate::methods::SendPoll::new(self.chat.id, question, options);
Ok(method)
}
#[doc = "Builds `SendRichMessage` and fills fields bound by aiogram's `InaccessibleMessage.answer_rich` shortcut."]
pub fn answer_rich(
&self,
rich_message: crate::types::InputRichMessage,
) -> crate::Result<crate::methods::SendRichMessage> {
let mut method = crate::methods::SendRichMessage::new(self.chat.id, rich_message);
Ok(method)
}
#[doc = "Builds `SendSticker` and fills fields bound by aiogram's `InaccessibleMessage.answer_sticker` shortcut."]
pub fn answer_sticker(
&self,
sticker: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendSticker> {
let mut method = crate::methods::SendSticker::new(self.chat.id, sticker);
Ok(method)
}
#[doc = "Builds `SendVenue` and fills fields bound by aiogram's `InaccessibleMessage.answer_venue` shortcut."]
pub fn answer_venue(
&self,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> crate::Result<crate::methods::SendVenue> {
let mut method =
crate::methods::SendVenue::new(self.chat.id, latitude, longitude, title, address);
Ok(method)
}
#[doc = "Builds `SendVideo` and fills fields bound by aiogram's `InaccessibleMessage.answer_video` shortcut."]
pub fn answer_video(
&self,
video: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideo> {
let mut method = crate::methods::SendVideo::new(self.chat.id, video);
Ok(method)
}
#[doc = "Builds `SendVideoNote` and fills fields bound by aiogram's `InaccessibleMessage.answer_video_note` shortcut."]
pub fn answer_video_note(
&self,
video_note: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideoNote> {
let mut method = crate::methods::SendVideoNote::new(self.chat.id, video_note);
Ok(method)
}
#[doc = "Builds `SendVoice` and fills fields bound by aiogram's `InaccessibleMessage.answer_voice` shortcut."]
pub fn answer_voice(
&self,
voice: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVoice> {
let mut method = crate::methods::SendVoice::new(self.chat.id, voice);
Ok(method)
}
#[doc = "Builds `SendMessage` and fills fields bound by aiogram's `InaccessibleMessage.reply` shortcut."]
pub fn reply(&self, text: impl Into<String>) -> crate::Result<crate::methods::SendMessage> {
let mut method = crate::methods::SendMessage::new(self.chat.id, text);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendAnimation` and fills fields bound by aiogram's `InaccessibleMessage.reply_animation` shortcut."]
pub fn reply_animation(
&self,
animation: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAnimation> {
let mut method = crate::methods::SendAnimation::new(self.chat.id, animation);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendAudio` and fills fields bound by aiogram's `InaccessibleMessage.reply_audio` shortcut."]
pub fn reply_audio(
&self,
audio: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAudio> {
let mut method = crate::methods::SendAudio::new(self.chat.id, audio);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendContact` and fills fields bound by aiogram's `InaccessibleMessage.reply_contact` shortcut."]
pub fn reply_contact(
&self,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> crate::Result<crate::methods::SendContact> {
let mut method = crate::methods::SendContact::new(self.chat.id, phone_number, first_name);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendDice` and fills fields bound by aiogram's `InaccessibleMessage.reply_dice` shortcut."]
pub fn reply_dice(&self) -> crate::Result<crate::methods::SendDice> {
let mut method = crate::methods::SendDice::new(self.chat.id);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendDocument` and fills fields bound by aiogram's `InaccessibleMessage.reply_document` shortcut."]
pub fn reply_document(
&self,
document: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendDocument> {
let mut method = crate::methods::SendDocument::new(self.chat.id, document);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendGame` and fills fields bound by aiogram's `InaccessibleMessage.reply_game` shortcut."]
pub fn reply_game(
&self,
game_short_name: impl Into<String>,
) -> crate::Result<crate::methods::SendGame> {
let mut method = crate::methods::SendGame::new(self.chat.id, game_short_name);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendInvoice` and fills fields bound by aiogram's `InaccessibleMessage.reply_invoice` shortcut."]
pub fn reply_invoice(
&self,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<crate::types::LabeledPrice>,
) -> crate::Result<crate::methods::SendInvoice> {
let mut method = crate::methods::SendInvoice::new(
self.chat.id,
title,
description,
payload,
currency,
prices,
);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendLocation` and fills fields bound by aiogram's `InaccessibleMessage.reply_location` shortcut."]
pub fn reply_location(
&self,
latitude: f64,
longitude: f64,
) -> crate::Result<crate::methods::SendLocation> {
let mut method = crate::methods::SendLocation::new(self.chat.id, latitude, longitude);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendMediaGroup` and fills fields bound by aiogram's `InaccessibleMessage.reply_media_group` shortcut."]
pub fn reply_media_group(
&self,
media: Vec<crate::types::MediaUnion>,
) -> crate::Result<crate::methods::SendMediaGroup> {
let mut method = crate::methods::SendMediaGroup::new(self.chat.id, media);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendPaidMedia` and fills fields bound by aiogram's `InaccessibleMessage.reply_paid_media` shortcut."]
pub fn reply_paid_media(
&self,
star_count: i64,
media: Vec<crate::types::InputPaidMediaUnion>,
) -> crate::Result<crate::methods::SendPaidMedia> {
let mut method = crate::methods::SendPaidMedia::new(self.chat.id, star_count, media);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendPhoto` and fills fields bound by aiogram's `InaccessibleMessage.reply_photo` shortcut."]
pub fn reply_photo(
&self,
photo: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendPhoto> {
let mut method = crate::methods::SendPhoto::new(self.chat.id, photo);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendPoll` and fills fields bound by aiogram's `InaccessibleMessage.reply_poll` shortcut."]
pub fn reply_poll(
&self,
question: impl Into<String>,
options: Vec<crate::types::InputPollOptionUnion>,
) -> crate::Result<crate::methods::SendPoll> {
let mut method = crate::methods::SendPoll::new(self.chat.id, question, options);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendRichMessage` and fills fields bound by aiogram's `InaccessibleMessage.reply_rich` shortcut."]
pub fn reply_rich(
&self,
rich_message: crate::types::InputRichMessage,
) -> crate::Result<crate::methods::SendRichMessage> {
let mut method = crate::methods::SendRichMessage::new(self.chat.id, rich_message);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendSticker` and fills fields bound by aiogram's `InaccessibleMessage.reply_sticker` shortcut."]
pub fn reply_sticker(
&self,
sticker: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendSticker> {
let mut method = crate::methods::SendSticker::new(self.chat.id, sticker);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendVenue` and fills fields bound by aiogram's `InaccessibleMessage.reply_venue` shortcut."]
pub fn reply_venue(
&self,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> crate::Result<crate::methods::SendVenue> {
let mut method =
crate::methods::SendVenue::new(self.chat.id, latitude, longitude, title, address);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendVideo` and fills fields bound by aiogram's `InaccessibleMessage.reply_video` shortcut."]
pub fn reply_video(
&self,
video: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideo> {
let mut method = crate::methods::SendVideo::new(self.chat.id, video);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendVideoNote` and fills fields bound by aiogram's `InaccessibleMessage.reply_video_note` shortcut."]
pub fn reply_video_note(
&self,
video_note: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideoNote> {
let mut method = crate::methods::SendVideoNote::new(self.chat.id, video_note);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendVoice` and fills fields bound by aiogram's `InaccessibleMessage.reply_voice` shortcut."]
pub fn reply_voice(
&self,
voice: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVoice> {
let mut method = crate::methods::SendVoice::new(self.chat.id, voice);
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
}
impl super::InlineQuery {
#[doc = "Builds `AnswerInlineQuery` and fills fields bound by aiogram's `InlineQuery.answer` shortcut."]
pub fn answer(
&self,
results: Vec<crate::types::InlineQueryResultUnion>,
) -> crate::Result<crate::methods::AnswerInlineQuery> {
let mut method = crate::methods::AnswerInlineQuery::new(self.id.clone(), results);
Ok(method)
}
}
impl super::Message {
#[doc = "Builds `SendMessage` and fills fields bound by aiogram's `Message.answer` shortcut."]
pub fn answer(&self, text: impl Into<String>) -> crate::Result<crate::methods::SendMessage> {
let mut method = crate::methods::SendMessage::new(self.chat.id, text);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendAnimation` and fills fields bound by aiogram's `Message.answer_animation` shortcut."]
pub fn answer_animation(
&self,
animation: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAnimation> {
let mut method = crate::methods::SendAnimation::new(self.chat.id, animation);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendAudio` and fills fields bound by aiogram's `Message.answer_audio` shortcut."]
pub fn answer_audio(
&self,
audio: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAudio> {
let mut method = crate::methods::SendAudio::new(self.chat.id, audio);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendContact` and fills fields bound by aiogram's `Message.answer_contact` shortcut."]
pub fn answer_contact(
&self,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> crate::Result<crate::methods::SendContact> {
let mut method = crate::methods::SendContact::new(self.chat.id, phone_number, first_name);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendDice` and fills fields bound by aiogram's `Message.answer_dice` shortcut."]
pub fn answer_dice(&self) -> crate::Result<crate::methods::SendDice> {
let mut method = crate::methods::SendDice::new(self.chat.id);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendDocument` and fills fields bound by aiogram's `Message.answer_document` shortcut."]
pub fn answer_document(
&self,
document: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendDocument> {
let mut method = crate::methods::SendDocument::new(self.chat.id, document);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendGame` and fills fields bound by aiogram's `Message.answer_game` shortcut."]
pub fn answer_game(
&self,
game_short_name: impl Into<String>,
) -> crate::Result<crate::methods::SendGame> {
let mut method = crate::methods::SendGame::new(self.chat.id, game_short_name);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `AnswerGuestQuery` and fills fields bound by aiogram's `Message.answer_guest_query` shortcut."]
pub fn answer_guest_query(
&self,
result: impl Into<crate::types::InlineQueryResultUnion>,
) -> crate::Result<crate::methods::AnswerGuestQuery> {
let mut method = crate::methods::AnswerGuestQuery::new(
self.guest_query_id.clone().ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.answer_guest_query requires source field for guest_query_id"
.to_owned(),
)
})?,
result,
);
Ok(method)
}
#[doc = "Builds `SendInvoice` and fills fields bound by aiogram's `Message.answer_invoice` shortcut."]
pub fn answer_invoice(
&self,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<crate::types::LabeledPrice>,
) -> crate::Result<crate::methods::SendInvoice> {
let mut method = crate::methods::SendInvoice::new(
self.chat.id,
title,
description,
payload,
currency,
prices,
);
if let Some(value) = self.business_connection_id.clone() {
method.extra.insert(
"business_connection_id".to_owned(),
serde_json::to_value(value)?,
);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendLocation` and fills fields bound by aiogram's `Message.answer_location` shortcut."]
pub fn answer_location(
&self,
latitude: f64,
longitude: f64,
) -> crate::Result<crate::methods::SendLocation> {
let mut method = crate::methods::SendLocation::new(self.chat.id, latitude, longitude);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendMediaGroup` and fills fields bound by aiogram's `Message.answer_media_group` shortcut."]
pub fn answer_media_group(
&self,
media: Vec<crate::types::MediaUnion>,
) -> crate::Result<crate::methods::SendMediaGroup> {
let mut method = crate::methods::SendMediaGroup::new(self.chat.id, media);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendPaidMedia` and fills fields bound by aiogram's `Message.answer_paid_media` shortcut."]
pub fn answer_paid_media(
&self,
star_count: i64,
media: Vec<crate::types::InputPaidMediaUnion>,
) -> crate::Result<crate::methods::SendPaidMedia> {
let mut method = crate::methods::SendPaidMedia::new(self.chat.id, star_count, media);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendPhoto` and fills fields bound by aiogram's `Message.answer_photo` shortcut."]
pub fn answer_photo(
&self,
photo: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendPhoto> {
let mut method = crate::methods::SendPhoto::new(self.chat.id, photo);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendPoll` and fills fields bound by aiogram's `Message.answer_poll` shortcut."]
pub fn answer_poll(
&self,
question: impl Into<String>,
options: Vec<crate::types::InputPollOptionUnion>,
) -> crate::Result<crate::methods::SendPoll> {
let mut method = crate::methods::SendPoll::new(self.chat.id, question, options);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendRichMessage` and fills fields bound by aiogram's `Message.answer_rich` shortcut."]
pub fn answer_rich(
&self,
rich_message: crate::types::InputRichMessage,
) -> crate::Result<crate::methods::SendRichMessage> {
let mut method = crate::methods::SendRichMessage::new(self.chat.id, rich_message);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendSticker` and fills fields bound by aiogram's `Message.answer_sticker` shortcut."]
pub fn answer_sticker(
&self,
sticker: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendSticker> {
let mut method = crate::methods::SendSticker::new(self.chat.id, sticker);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendVenue` and fills fields bound by aiogram's `Message.answer_venue` shortcut."]
pub fn answer_venue(
&self,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> crate::Result<crate::methods::SendVenue> {
let mut method =
crate::methods::SendVenue::new(self.chat.id, latitude, longitude, title, address);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendVideo` and fills fields bound by aiogram's `Message.answer_video` shortcut."]
pub fn answer_video(
&self,
video: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideo> {
let mut method = crate::methods::SendVideo::new(self.chat.id, video);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendVideoNote` and fills fields bound by aiogram's `Message.answer_video_note` shortcut."]
pub fn answer_video_note(
&self,
video_note: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideoNote> {
let mut method = crate::methods::SendVideoNote::new(self.chat.id, video_note);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `SendVoice` and fills fields bound by aiogram's `Message.answer_voice` shortcut."]
pub fn answer_voice(
&self,
voice: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVoice> {
let mut method = crate::methods::SendVoice::new(self.chat.id, voice);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
Ok(method)
}
#[doc = "Builds `CopyMessage` and fills fields bound by aiogram's `Message.copy_to` shortcut."]
pub fn copy_to(
&self,
chat_id: impl Into<crate::types::ChatId>,
) -> crate::Result<crate::methods::CopyMessage> {
let mut method = crate::methods::CopyMessage::new(chat_id, self.chat.id, self.message_id);
Ok(method)
}
#[doc = "Builds `DeleteMessage` and fills fields bound by aiogram's `Message.delete` shortcut."]
pub fn delete(&self) -> crate::Result<crate::methods::DeleteMessage> {
let mut method = crate::methods::DeleteMessage::new(self.chat.id, self.message_id);
if let Some(value) = self.business_connection_id.clone() {
method.extra.insert(
"business_connection_id".to_owned(),
serde_json::to_value(value)?,
);
}
Ok(method)
}
#[doc = "Builds `DeleteEphemeralMessage` and fills fields bound by aiogram's `Message.delete_ephemeral` shortcut."]
pub fn delete_ephemeral(&self) -> crate::Result<crate::methods::DeleteEphemeralMessage> {
let mut method = crate::methods::DeleteEphemeralMessage::new(
self.chat.id,
self.receiver_user
.as_ref()
.map(|user| user.id)
.ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.delete_ephemeral requires source field for receiver_user_id"
.to_owned(),
)
})?,
self.ephemeral_message_id.ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.delete_ephemeral requires source field for ephemeral_message_id"
.to_owned(),
)
})?,
);
Ok(method)
}
#[doc = "Builds `EditMessageReplyMarkup` and fills fields bound by aiogram's `Message.delete_reply_markup` shortcut."]
pub fn delete_reply_markup(&self) -> crate::Result<crate::methods::EditMessageReplyMarkup> {
let mut method = crate::methods::EditMessageReplyMarkup::new();
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
method = method.chat_id(self.chat.id);
method = method.message_id(self.message_id);
Ok(method)
}
#[doc = "Builds `EditMessageCaption` and fills fields bound by aiogram's `Message.edit_caption` shortcut."]
pub fn edit_caption(&self) -> crate::Result<crate::methods::EditMessageCaption> {
let mut method = crate::methods::EditMessageCaption::new();
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
method = method.chat_id(self.chat.id);
method = method.message_id(self.message_id);
Ok(method)
}
#[doc = "Builds `EditEphemeralMessageCaption` and fills fields bound by aiogram's `Message.edit_ephemeral_caption` shortcut."]
pub fn edit_ephemeral_caption(
&self,
) -> crate::Result<crate::methods::EditEphemeralMessageCaption> {
let mut method = crate::methods::EditEphemeralMessageCaption::new(
self.chat.id,
self.receiver_user
.as_ref()
.map(|user| user.id)
.ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.edit_ephemeral_caption requires source field for receiver_user_id"
.to_owned(),
)
})?,
self.ephemeral_message_id.ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.edit_ephemeral_caption requires source field for ephemeral_message_id"
.to_owned(),
)
})?,
);
Ok(method)
}
#[doc = "Builds `EditEphemeralMessageMedia` and fills fields bound by aiogram's `Message.edit_ephemeral_media` shortcut."]
pub fn edit_ephemeral_media(
&self,
media: impl Into<crate::types::InputMediaUnion>,
) -> crate::Result<crate::methods::EditEphemeralMessageMedia> {
let mut method = crate::methods::EditEphemeralMessageMedia::new(
self.chat.id,
self.receiver_user
.as_ref()
.map(|user| user.id)
.ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.edit_ephemeral_media requires source field for receiver_user_id"
.to_owned(),
)
})?,
self.ephemeral_message_id.ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.edit_ephemeral_media requires source field for ephemeral_message_id"
.to_owned(),
)
})?,
media,
);
Ok(method)
}
#[doc = "Builds `EditEphemeralMessageReplyMarkup` and fills fields bound by aiogram's `Message.edit_ephemeral_reply_markup` shortcut."]
pub fn edit_ephemeral_reply_markup(
&self,
) -> crate::Result<crate::methods::EditEphemeralMessageReplyMarkup> {
let mut method = crate::methods::EditEphemeralMessageReplyMarkup::new(self.chat.id, self.receiver_user.as_ref().map(|user| user.id).ok_or_else(|| crate::Error::InvalidPayload("Message.edit_ephemeral_reply_markup requires source field for receiver_user_id".to_owned()))?, self.ephemeral_message_id.ok_or_else(|| crate::Error::InvalidPayload("Message.edit_ephemeral_reply_markup requires source field for ephemeral_message_id".to_owned()))?);
Ok(method)
}
#[doc = "Builds `EditEphemeralMessageText` and fills fields bound by aiogram's `Message.edit_ephemeral_text` shortcut."]
pub fn edit_ephemeral_text(
&self,
text: impl Into<String>,
) -> crate::Result<crate::methods::EditEphemeralMessageText> {
let mut method = crate::methods::EditEphemeralMessageText::new(
self.chat.id,
self.receiver_user
.as_ref()
.map(|user| user.id)
.ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.edit_ephemeral_text requires source field for receiver_user_id"
.to_owned(),
)
})?,
self.ephemeral_message_id.ok_or_else(|| {
crate::Error::InvalidPayload(
"Message.edit_ephemeral_text requires source field for ephemeral_message_id"
.to_owned(),
)
})?,
text,
);
Ok(method)
}
#[doc = "Builds `EditMessageLiveLocation` and fills fields bound by aiogram's `Message.edit_live_location` shortcut."]
pub fn edit_live_location(
&self,
latitude: f64,
longitude: f64,
) -> crate::Result<crate::methods::EditMessageLiveLocation> {
let mut method = crate::methods::EditMessageLiveLocation::new(latitude, longitude);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
method = method.chat_id(self.chat.id);
method = method.message_id(self.message_id);
Ok(method)
}
#[doc = "Builds `EditMessageMedia` and fills fields bound by aiogram's `Message.edit_media` shortcut."]
pub fn edit_media(
&self,
media: impl Into<crate::types::InputMediaUnion>,
) -> crate::Result<crate::methods::EditMessageMedia> {
let mut method = crate::methods::EditMessageMedia::new(media);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
method = method.chat_id(self.chat.id);
method = method.message_id(self.message_id);
Ok(method)
}
#[doc = "Builds `EditMessageReplyMarkup` and fills fields bound by aiogram's `Message.edit_reply_markup` shortcut."]
pub fn edit_reply_markup(&self) -> crate::Result<crate::methods::EditMessageReplyMarkup> {
let mut method = crate::methods::EditMessageReplyMarkup::new();
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
method = method.chat_id(self.chat.id);
method = method.message_id(self.message_id);
Ok(method)
}
#[doc = "Builds `EditMessageText` and fills fields bound by aiogram's `Message.edit_text` shortcut."]
pub fn edit_text(&self) -> crate::Result<crate::methods::EditMessageText> {
let mut method = crate::methods::EditMessageText::new();
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
method = method.chat_id(self.chat.id);
method = method.message_id(self.message_id);
Ok(method)
}
#[doc = "Builds `ForwardMessage` and fills fields bound by aiogram's `Message.forward` shortcut."]
pub fn forward(
&self,
chat_id: impl Into<crate::types::ChatId>,
) -> crate::Result<crate::methods::ForwardMessage> {
let mut method =
crate::methods::ForwardMessage::new(chat_id, self.chat.id, self.message_id);
Ok(method)
}
#[doc = "Builds `PinChatMessage` and fills fields bound by aiogram's `Message.pin` shortcut."]
pub fn pin(&self) -> crate::Result<crate::methods::PinChatMessage> {
let mut method = crate::methods::PinChatMessage::new(self.chat.id, self.message_id);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
Ok(method)
}
#[doc = "Builds `SetMessageReaction` and fills fields bound by aiogram's `Message.react` shortcut."]
pub fn react(&self) -> crate::Result<crate::methods::SetMessageReaction> {
let mut method = crate::methods::SetMessageReaction::new(self.chat.id, self.message_id);
if let Some(value) = self.business_connection_id.clone() {
method.extra.insert(
"business_connection_id".to_owned(),
serde_json::to_value(value)?,
);
}
Ok(method)
}
#[doc = "Builds `SendMessage` and fills fields bound by aiogram's `Message.reply` shortcut."]
pub fn reply(&self, text: impl Into<String>) -> crate::Result<crate::methods::SendMessage> {
let mut method = crate::methods::SendMessage::new(self.chat.id, text);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendAnimation` and fills fields bound by aiogram's `Message.reply_animation` shortcut."]
pub fn reply_animation(
&self,
animation: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAnimation> {
let mut method = crate::methods::SendAnimation::new(self.chat.id, animation);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendAudio` and fills fields bound by aiogram's `Message.reply_audio` shortcut."]
pub fn reply_audio(
&self,
audio: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendAudio> {
let mut method = crate::methods::SendAudio::new(self.chat.id, audio);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendContact` and fills fields bound by aiogram's `Message.reply_contact` shortcut."]
pub fn reply_contact(
&self,
phone_number: impl Into<String>,
first_name: impl Into<String>,
) -> crate::Result<crate::methods::SendContact> {
let mut method = crate::methods::SendContact::new(self.chat.id, phone_number, first_name);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendDice` and fills fields bound by aiogram's `Message.reply_dice` shortcut."]
pub fn reply_dice(&self) -> crate::Result<crate::methods::SendDice> {
let mut method = crate::methods::SendDice::new(self.chat.id);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method
.extra
.insert("receiver_user_id".to_owned(), serde_json::to_value(value)?);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendDocument` and fills fields bound by aiogram's `Message.reply_document` shortcut."]
pub fn reply_document(
&self,
document: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendDocument> {
let mut method = crate::methods::SendDocument::new(self.chat.id, document);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendGame` and fills fields bound by aiogram's `Message.reply_game` shortcut."]
pub fn reply_game(
&self,
game_short_name: impl Into<String>,
) -> crate::Result<crate::methods::SendGame> {
let mut method = crate::methods::SendGame::new(self.chat.id, game_short_name);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method
.extra
.insert("receiver_user_id".to_owned(), serde_json::to_value(value)?);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendInvoice` and fills fields bound by aiogram's `Message.reply_invoice` shortcut."]
pub fn reply_invoice(
&self,
title: impl Into<String>,
description: impl Into<String>,
payload: impl Into<String>,
currency: impl Into<String>,
prices: Vec<crate::types::LabeledPrice>,
) -> crate::Result<crate::methods::SendInvoice> {
let mut method = crate::methods::SendInvoice::new(
self.chat.id,
title,
description,
payload,
currency,
prices,
);
if let Some(value) = self.business_connection_id.clone() {
method.extra.insert(
"business_connection_id".to_owned(),
serde_json::to_value(value)?,
);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method
.extra
.insert("receiver_user_id".to_owned(), serde_json::to_value(value)?);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendLocation` and fills fields bound by aiogram's `Message.reply_location` shortcut."]
pub fn reply_location(
&self,
latitude: f64,
longitude: f64,
) -> crate::Result<crate::methods::SendLocation> {
let mut method = crate::methods::SendLocation::new(self.chat.id, latitude, longitude);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendMediaGroup` and fills fields bound by aiogram's `Message.reply_media_group` shortcut."]
pub fn reply_media_group(
&self,
media: Vec<crate::types::MediaUnion>,
) -> crate::Result<crate::methods::SendMediaGroup> {
let mut method = crate::methods::SendMediaGroup::new(self.chat.id, media);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method
.extra
.insert("receiver_user_id".to_owned(), serde_json::to_value(value)?);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendPaidMedia` and fills fields bound by aiogram's `Message.reply_paid_media` shortcut."]
pub fn reply_paid_media(
&self,
star_count: i64,
media: Vec<crate::types::InputPaidMediaUnion>,
) -> crate::Result<crate::methods::SendPaidMedia> {
let mut method = crate::methods::SendPaidMedia::new(self.chat.id, star_count, media);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method
.extra
.insert("receiver_user_id".to_owned(), serde_json::to_value(value)?);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendPhoto` and fills fields bound by aiogram's `Message.reply_photo` shortcut."]
pub fn reply_photo(
&self,
photo: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendPhoto> {
let mut method = crate::methods::SendPhoto::new(self.chat.id, photo);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendPoll` and fills fields bound by aiogram's `Message.reply_poll` shortcut."]
pub fn reply_poll(
&self,
question: impl Into<String>,
options: Vec<crate::types::InputPollOptionUnion>,
) -> crate::Result<crate::methods::SendPoll> {
let mut method = crate::methods::SendPoll::new(self.chat.id, question, options);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method
.extra
.insert("receiver_user_id".to_owned(), serde_json::to_value(value)?);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendRichMessage` and fills fields bound by aiogram's `Message.reply_rich` shortcut."]
pub fn reply_rich(
&self,
rich_message: crate::types::InputRichMessage,
) -> crate::Result<crate::methods::SendRichMessage> {
let mut method = crate::methods::SendRichMessage::new(self.chat.id, rich_message);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method
.extra
.insert("receiver_user_id".to_owned(), serde_json::to_value(value)?);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendSticker` and fills fields bound by aiogram's `Message.reply_sticker` shortcut."]
pub fn reply_sticker(
&self,
sticker: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendSticker> {
let mut method = crate::methods::SendSticker::new(self.chat.id, sticker);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendVenue` and fills fields bound by aiogram's `Message.reply_venue` shortcut."]
pub fn reply_venue(
&self,
latitude: f64,
longitude: f64,
title: impl Into<String>,
address: impl Into<String>,
) -> crate::Result<crate::methods::SendVenue> {
let mut method =
crate::methods::SendVenue::new(self.chat.id, latitude, longitude, title, address);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendVideo` and fills fields bound by aiogram's `Message.reply_video` shortcut."]
pub fn reply_video(
&self,
video: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideo> {
let mut method = crate::methods::SendVideo::new(self.chat.id, video);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendVideoNote` and fills fields bound by aiogram's `Message.reply_video_note` shortcut."]
pub fn reply_video_note(
&self,
video_note: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVideoNote> {
let mut method = crate::methods::SendVideoNote::new(self.chat.id, video_note);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `SendVoice` and fills fields bound by aiogram's `Message.reply_voice` shortcut."]
pub fn reply_voice(
&self,
voice: impl Into<crate::types::InputFile>,
) -> crate::Result<crate::methods::SendVoice> {
let mut method = crate::methods::SendVoice::new(self.chat.id, voice);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
if let Some(value) = if self.is_topic_message == Some(true) {
self.message_thread_id
} else {
None
} {
method = method.message_thread_id(value);
}
if let Some(value) = self
.from_user
.as_ref()
.filter(|_| self.ephemeral_message_id.is_some())
.map(|user| user.id)
{
method = method.receiver_user_id(value);
}
method = method.reply_parameters(self.as_reply_parameters());
Ok(method)
}
#[doc = "Builds `StopMessageLiveLocation` and fills fields bound by aiogram's `Message.stop_live_location` shortcut."]
pub fn stop_live_location(&self) -> crate::Result<crate::methods::StopMessageLiveLocation> {
let mut method = crate::methods::StopMessageLiveLocation::new();
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
method = method.chat_id(self.chat.id);
method = method.message_id(self.message_id);
Ok(method)
}
#[doc = "Builds `UnpinChatMessage` and fills fields bound by aiogram's `Message.unpin` shortcut."]
pub fn unpin(&self) -> crate::Result<crate::methods::UnpinChatMessage> {
let mut method = crate::methods::UnpinChatMessage::new(self.chat.id);
if let Some(value) = self.business_connection_id.clone() {
method = method.business_connection_id(value);
}
method = method.message_id(self.message_id);
Ok(method)
}
}
impl super::PreCheckoutQuery {
#[doc = "Builds `AnswerPreCheckoutQuery` and fills fields bound by aiogram's `PreCheckoutQuery.answer` shortcut."]
pub fn answer(&self, ok: bool) -> crate::Result<crate::methods::AnswerPreCheckoutQuery> {
let mut method = crate::methods::AnswerPreCheckoutQuery::new(self.id.clone(), ok);
Ok(method)
}
}
impl super::ShippingQuery {
#[doc = "Builds `AnswerShippingQuery` and fills fields bound by aiogram's `ShippingQuery.answer` shortcut."]
pub fn answer(&self, ok: bool) -> crate::Result<crate::methods::AnswerShippingQuery> {
let mut method = crate::methods::AnswerShippingQuery::new(self.id.clone(), ok);
Ok(method)
}
}
impl super::Sticker {
#[doc = "Builds `DeleteStickerFromSet` and fills fields bound by aiogram's `Sticker.delete_from_set` shortcut."]
pub fn delete_from_set(&self) -> crate::Result<crate::methods::DeleteStickerFromSet> {
let mut method = crate::methods::DeleteStickerFromSet::new(self.file_id.clone());
Ok(method)
}
#[doc = "Builds `SetStickerPositionInSet` and fills fields bound by aiogram's `Sticker.set_position_in_set` shortcut."]
pub fn set_position_in_set(
&self,
position: i64,
) -> crate::Result<crate::methods::SetStickerPositionInSet> {
let mut method =
crate::methods::SetStickerPositionInSet::new(self.file_id.clone(), position);
Ok(method)
}
}
impl super::User {
#[doc = "Builds `GetUserProfileAudios` and fills fields bound by aiogram's `User.get_profile_audios` shortcut."]
pub fn get_profile_audios(&self) -> crate::Result<crate::methods::GetUserProfileAudios> {
let mut method = crate::methods::GetUserProfileAudios::new(self.id);
Ok(method)
}
#[doc = "Builds `GetUserProfilePhotos` and fills fields bound by aiogram's `User.get_profile_photos` shortcut."]
pub fn get_profile_photos(&self) -> crate::Result<crate::methods::GetUserProfilePhotos> {
let mut method = crate::methods::GetUserProfilePhotos::new(self.id);
Ok(method)
}
}