use crate::bot::Part;
use crate::{
bot::{ApiError, Bot, BotResult, Response},
gen_types::*,
};
use anyhow::Result;
use reqwest::multipart::Form;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Debug)]
struct GetMyShortDescriptionOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SendVoiceOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
voice: String,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
duration: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct GetChatGiftsOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_unsaved: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_saved: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_unlimited: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_limited_upgradable: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_limited_non_upgradable: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_from_blockchain: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_unique: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
sort_by_price: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
offset: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
}
#[derive(Serialize, Debug)]
struct BanChatMemberOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
until_date: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
revoke_messages: Option<bool>,
}
#[derive(Serialize, Debug)]
struct SetBusinessAccountUsernameOpts<'a> {
business_connection_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
username: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct GetMyCommandsOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
scope: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct DeleteStoryOpts<'a> {
business_connection_id: &'a str,
story_id: i64,
}
#[derive(Serialize, Debug)]
struct EditMessageReplyMarkupOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<V>,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_message_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct ReplaceStickerInSetOpts<'a> {
user_id: i64,
name: &'a str,
old_sticker: &'a str,
sticker: String,
}
#[derive(Serialize, Debug)]
struct UnpinAllGeneralForumTopicMessagesOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct DeleteStickerSetOpts<'a> {
name: &'a str,
}
#[derive(Serialize, Debug)]
struct SetChatMemberTagOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
tag: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SetStickerEmojiListOpts<'a> {
sticker: &'a str,
emoji_list: String,
}
#[derive(Serialize, Debug)]
struct AnswerCallbackQueryOpts<'a> {
callback_query_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
text: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
show_alert: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
url: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
cache_time: Option<i64>,
}
#[derive(Serialize, Debug)]
struct AddStickerToSetOpts<'a> {
user_id: i64,
name: &'a str,
sticker: String,
}
#[derive(Serialize, Debug)]
struct EditUserStarSubscriptionOpts<'a> {
user_id: i64,
telegram_payment_charge_id: &'a str,
is_canceled: bool,
}
#[derive(Serialize, Debug)]
struct SetChatTitleOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
title: &'a str,
}
#[derive(Serialize, Debug)]
struct SendPaidMediaOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
star_count: i64,
media: String,
#[serde(skip_serializing_if = "Option::is_none")]
payload: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
show_caption_above_media: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct UnbanChatMemberOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
only_if_banned: Option<bool>,
}
#[derive(Serialize, Debug)]
struct RemoveMyProfilePhotoOpts();
#[derive(Serialize, Debug)]
struct CreateForumTopicOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
name: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
icon_color: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
icon_custom_emoji_id: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SendDocumentOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
document: String,
#[serde(skip_serializing_if = "Option::is_none")]
thumbnail: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_content_type_detection: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct RevokeChatInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
invite_link: &'a str,
}
#[derive(Serialize, Debug)]
struct HideGeneralForumTopicOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct StopMessageLiveLocationOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<V>,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_message_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct SetStickerMaskPositionOpts<'a> {
sticker: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
mask_position: Option<String>,
}
#[derive(Serialize, Debug)]
struct DeleteWebhookOpts {
#[serde(skip_serializing_if = "Option::is_none")]
drop_pending_updates: Option<bool>,
}
#[derive(Serialize, Debug)]
struct SendInvoiceOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
title: &'a str,
description: &'a str,
payload: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
provider_token: Option<&'a str>,
currency: &'a str,
prices: String,
#[serde(skip_serializing_if = "Option::is_none")]
max_tip_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_tip_amounts: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
start_parameter: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
provider_data: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
photo_url: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
photo_size: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
photo_width: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
photo_height: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
need_name: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
need_phone_number: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
need_email: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
need_shipping_address: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
send_phone_number_to_provider: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
send_email_to_provider: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
is_flexible: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct SendChatActionOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
action: &'a str,
}
#[derive(Serialize, Debug)]
struct AnswerPreCheckoutQueryOpts<'a> {
pre_checkout_query_id: &'a str,
ok: bool,
#[serde(skip_serializing_if = "Option::is_none")]
error_message: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SetStickerPositionInSetOpts<'a> {
sticker: &'a str,
position: i64,
}
#[derive(Serialize, Debug)]
struct SendGameOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
game_short_name: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct ExportChatInviteLinkOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct SetChatPhotoOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
photo: String,
}
#[derive(Serialize, Debug)]
struct DeleteChatPhotoOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct GetChatMemberOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
}
#[derive(Serialize, Debug)]
struct EditMessageCaptionOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<V>,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_message_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
show_caption_above_media: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct DeleteMessageOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
message_id: i64,
}
#[derive(Serialize, Debug)]
struct EditChatInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
invite_link: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
expire_date: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
member_limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
creates_join_request: Option<bool>,
}
#[derive(Serialize, Debug)]
struct SetPassportDataErrorsOpts {
user_id: i64,
errors: String,
}
#[derive(Serialize, Debug)]
struct SetChatPermissionsOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
permissions: String,
#[serde(skip_serializing_if = "Option::is_none")]
use_independent_chat_permissions: Option<bool>,
}
#[derive(Serialize, Debug)]
struct PostStoryOpts<'a> {
business_connection_id: &'a str,
content: String,
active_period: i64,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
areas: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
post_to_chat_page: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
}
#[derive(Serialize, Debug)]
struct GetUpdatesOpts {
#[serde(skip_serializing_if = "Option::is_none")]
offset: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
timeout: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
allowed_updates: Option<String>,
}
#[derive(Serialize, Debug)]
struct CopyMessagesOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_ids: String,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
remove_caption: Option<bool>,
}
#[derive(Serialize, Debug)]
struct GiftPremiumSubscriptionOpts<'a> {
user_id: i64,
month_count: i64,
star_count: i64,
#[serde(skip_serializing_if = "Option::is_none")]
text: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
text_parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
text_entities: Option<String>,
}
#[derive(Serialize, Debug)]
struct GetWebhookInfoOpts();
#[derive(Serialize, Debug)]
struct ApproveChatJoinRequestOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
}
#[derive(Serialize, Debug)]
struct TransferBusinessAccountStarsOpts<'a> {
business_connection_id: &'a str,
star_count: i64,
}
#[derive(Serialize, Debug)]
struct GetStarTransactionsOpts {
#[serde(skip_serializing_if = "Option::is_none")]
offset: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
}
#[derive(Serialize, Debug)]
struct SetGameScoreOpts<'a> {
user_id: i64,
score: i64,
#[serde(skip_serializing_if = "Option::is_none")]
force: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_edit_message: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_message_id: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct GetBusinessAccountStarBalanceOpts<'a> {
business_connection_id: &'a str,
}
#[derive(Serialize, Debug)]
struct GetMyDescriptionOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct ForwardMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
video_start_timestamp: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
message_id: i64,
}
#[derive(Serialize, Debug)]
struct SetMyDescriptionOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SetBusinessAccountGiftSettingsOpts<'a> {
business_connection_id: &'a str,
show_gift_button: bool,
accepted_gift_types: String,
}
#[derive(Serialize, Debug)]
struct DeleteMessagesOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
message_ids: String,
}
#[derive(Serialize, Debug)]
struct CreateInvoiceLinkOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
title: &'a str,
description: &'a str,
payload: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
provider_token: Option<&'a str>,
currency: &'a str,
prices: String,
#[serde(skip_serializing_if = "Option::is_none")]
subscription_period: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
max_tip_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_tip_amounts: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
provider_data: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
photo_url: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
photo_size: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
photo_width: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
photo_height: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
need_name: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
need_phone_number: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
need_email: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
need_shipping_address: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
send_phone_number_to_provider: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
send_email_to_provider: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
is_flexible: Option<bool>,
}
#[derive(Serialize, Debug)]
struct RepostStoryOpts<'a> {
business_connection_id: &'a str,
from_chat_id: i64,
from_story_id: i64,
active_period: i64,
#[serde(skip_serializing_if = "Option::is_none")]
post_to_chat_page: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
}
#[derive(Serialize, Debug)]
struct DeclineChatJoinRequestOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
}
#[derive(Serialize, Debug)]
struct RefundStarPaymentOpts<'a> {
user_id: i64,
telegram_payment_charge_id: &'a str,
}
#[derive(Serialize, Debug)]
struct SendMediaGroupOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
media: String,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
}
#[derive(Serialize, Debug)]
struct VerifyChatOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
custom_description: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SendMessageDraftOpts<'a> {
chat_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
draft_id: i64,
text: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
entities: Option<String>,
}
#[derive(Serialize, Debug)]
struct RestrictChatMemberOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
permissions: String,
#[serde(skip_serializing_if = "Option::is_none")]
use_independent_chat_permissions: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
until_date: Option<i64>,
}
#[derive(Serialize, Debug)]
struct RemoveUserVerificationOpts {
user_id: i64,
}
#[derive(Serialize, Debug)]
struct SendVideoOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
video: String,
#[serde(skip_serializing_if = "Option::is_none")]
duration: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
width: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
height: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
thumbnail: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
cover: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
start_timestamp: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
show_caption_above_media: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
has_spoiler: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
supports_streaming: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct UpgradeGiftOpts<'a> {
business_connection_id: &'a str,
owned_gift_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
keep_original_details: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
star_count: Option<i64>,
}
#[derive(Serialize, Debug)]
struct CreateChatInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
expire_date: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
member_limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
creates_join_request: Option<bool>,
}
#[derive(Serialize, Debug)]
struct GetChatOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct SendVideoNoteOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
video_note: String,
#[serde(skip_serializing_if = "Option::is_none")]
duration: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
length: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
thumbnail: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct SendPollOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
question: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
question_parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
question_entities: Option<String>,
options: String,
#[serde(skip_serializing_if = "Option::is_none")]
is_anonymous: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
tg_type: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
allows_multiple_answers: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allows_revoting: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
shuffle_options: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_adding_options: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
hide_results_until_closes: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
correct_option_ids: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
explanation: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
explanation_parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
explanation_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
open_period: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
close_date: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
is_closed: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
description_parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
description_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct EditMessageChecklistOpts<'a> {
business_connection_id: &'a str,
chat_id: i64,
message_id: i64,
checklist: String,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct SendChecklistOpts<'a> {
business_connection_id: &'a str,
chat_id: i64,
checklist: String,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct GetUserProfileAudiosOpts {
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
offset: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
}
#[derive(Serialize, Debug)]
struct GetAvailableGiftsOpts();
#[derive(Serialize, Debug)]
struct PromoteChatMemberOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
is_anonymous: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_manage_chat: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_delete_messages: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_manage_video_chats: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_restrict_members: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_promote_members: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_change_info: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_invite_users: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_post_stories: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_edit_stories: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_delete_stories: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_post_messages: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_edit_messages: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_pin_messages: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_manage_topics: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_manage_direct_messages: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
can_manage_tags: Option<bool>,
}
#[derive(Serialize, Debug)]
struct PinChatMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
message_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
}
#[derive(Serialize, Debug)]
struct SetStickerKeywordsOpts<'a> {
sticker: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
keywords: Option<String>,
}
#[derive(Serialize, Debug)]
struct DeleteForumTopicOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
message_thread_id: i64,
}
#[derive(Serialize, Debug)]
struct GetChatMenuButtonOpts {
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<i64>,
}
#[derive(Serialize, Debug)]
struct GetForumTopicIconStickersOpts();
#[derive(Serialize, Debug)]
struct UnpinChatMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
}
#[derive(Serialize, Debug)]
struct ReplaceManagedBotTokenOpts {
user_id: i64,
}
#[derive(Serialize, Debug)]
struct SetChatDescriptionOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct CloseGeneralForumTopicOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct EditMessageTextOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<V>,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_message_id: Option<&'a str>,
text: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
link_preview_options: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct RemoveBusinessAccountProfilePhotoOpts<'a> {
business_connection_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
is_public: Option<bool>,
}
#[derive(Serialize, Debug)]
struct ReopenGeneralForumTopicOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct DeleteChatStickerSetOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct SendMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
text: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
link_preview_options: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct SavePreparedKeyboardButtonOpts {
user_id: i64,
button: String,
}
#[derive(Serialize, Debug)]
struct DeclineSuggestedPostOpts<'a> {
chat_id: i64,
message_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
comment: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SavePreparedInlineMessageOpts {
user_id: i64,
result: String,
#[serde(skip_serializing_if = "Option::is_none")]
allow_user_chats: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_bot_chats: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_group_chats: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_channel_chats: Option<bool>,
}
#[derive(Serialize, Debug)]
struct EditForumTopicOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
message_thread_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
icon_custom_emoji_id: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SetWebhookOpts<'a> {
url: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
certificate: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
ip_address: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
max_connections: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
allowed_updates: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
drop_pending_updates: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
secret_token: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SetUserEmojiStatusOpts<'a> {
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
emoji_status_custom_emoji_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
emoji_status_expiration_date: Option<i64>,
}
#[derive(Serialize, Debug)]
struct GetBusinessAccountGiftsOpts<'a> {
business_connection_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_unsaved: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_saved: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_unlimited: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_limited_upgradable: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_limited_non_upgradable: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_unique: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_from_blockchain: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
sort_by_price: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
offset: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
}
#[derive(Serialize, Debug)]
struct SetChatAdministratorCustomTitleOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
custom_title: &'a str,
}
#[derive(Serialize, Debug)]
struct EditGeneralForumTopicOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
name: &'a str,
}
#[derive(Serialize, Debug)]
struct GetMyDefaultAdministratorRightsOpts {
#[serde(skip_serializing_if = "Option::is_none")]
for_channels: Option<bool>,
}
#[derive(Serialize, Debug)]
struct SetMyProfilePhotoOpts {
photo: String,
}
#[derive(Serialize, Debug)]
struct UnpinAllChatMessagesOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct SendAnimationOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
animation: String,
#[serde(skip_serializing_if = "Option::is_none")]
duration: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
width: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
height: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
thumbnail: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
show_caption_above_media: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
has_spoiler: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct SetMyDefaultAdministratorRightsOpts {
#[serde(skip_serializing_if = "Option::is_none")]
rights: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
for_channels: Option<bool>,
}
#[derive(Serialize, Debug)]
struct EditStoryOpts<'a> {
business_connection_id: &'a str,
story_id: i64,
content: String,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
areas: Option<String>,
}
#[derive(Serialize, Debug)]
struct SendPhotoOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
photo: String,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
show_caption_above_media: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
has_spoiler: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct CreateNewStickerSetOpts<'a> {
user_id: i64,
name: &'a str,
title: &'a str,
stickers: String,
#[serde(skip_serializing_if = "Option::is_none")]
sticker_type: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
needs_repainting: Option<bool>,
}
#[derive(Serialize, Debug)]
struct SendLocationOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
#[serde(skip_serializing_if = "Option::is_none")]
live_period: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
heading: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
proximity_alert_radius: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct GetStickerSetOpts<'a> {
name: &'a str,
}
#[derive(Serialize, Debug)]
struct GetUserChatBoostsOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
user_id: i64,
}
#[derive(Serialize, Debug)]
struct GetMyNameOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SetChatMenuButtonOpts {
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
menu_button: Option<String>,
}
#[derive(Serialize, Debug)]
struct EditMessageLiveLocationOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<V>,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_message_id: Option<&'a str>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
live_period: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
#[serde(skip_serializing_if = "Option::is_none")]
heading: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
proximity_alert_radius: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct SetBusinessAccountBioOpts<'a> {
business_connection_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
bio: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct ConvertGiftToStarsOpts<'a> {
business_connection_id: &'a str,
owned_gift_id: &'a str,
}
#[derive(Serialize, Debug)]
struct SendContactOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
phone_number: &'a str,
first_name: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
last_name: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
vcard: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct DeleteStickerFromSetOpts<'a> {
sticker: &'a str,
}
#[derive(Serialize, Debug)]
struct SetStickerSetThumbnailOpts<'a> {
name: &'a str,
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
thumbnail: Option<String>,
format: &'a str,
}
#[derive(Serialize, Debug)]
struct SetCustomEmojiStickerSetThumbnailOpts<'a> {
name: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
custom_emoji_id: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SetStickerSetTitleOpts<'a> {
name: &'a str,
title: &'a str,
}
#[derive(Serialize, Debug)]
struct AnswerInlineQueryOpts<'a> {
inline_query_id: &'a str,
results: String,
#[serde(skip_serializing_if = "Option::is_none")]
cache_time: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
is_personal: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
next_offset: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
button: Option<String>,
}
#[derive(Serialize, Debug)]
struct GetBusinessConnectionOpts<'a> {
business_connection_id: &'a str,
}
#[derive(Serialize, Debug)]
struct SetBusinessAccountNameOpts<'a> {
business_connection_id: &'a str,
first_name: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
last_name: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct EditMessageMediaOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<V>,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_message_id: Option<&'a str>,
media: String,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct UnhideGeneralForumTopicOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct SetMyShortDescriptionOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
short_description: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct StopPollOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
message_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct CloseOpts();
#[derive(Serialize, Debug)]
struct SetMessageReactionOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
message_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
reaction: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
is_big: Option<bool>,
}
#[derive(Serialize, Debug)]
struct GetMeOpts();
#[derive(Serialize, Debug)]
struct EditChatSubscriptionInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
invite_link: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SendDiceOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
emoji: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct SendAudioOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
audio: String,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
duration: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
performer: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
title: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
thumbnail: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct TransferGiftOpts<'a> {
business_connection_id: &'a str,
owned_gift_id: &'a str,
new_owner_chat_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
star_count: Option<i64>,
}
#[derive(Serialize, Debug)]
struct RemoveChatVerificationOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct CopyMessageOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
video_start_timestamp: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
caption: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
caption_entities: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
show_caption_above_media: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct GetGameHighScoresOpts<'a> {
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
message_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
inline_message_id: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct SendVenueOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
title: &'a str,
address: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
foursquare_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
foursquare_type: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
google_place_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
google_place_type: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct UnpinAllForumTopicMessagesOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
message_thread_id: i64,
}
#[derive(Serialize, Debug)]
struct AnswerWebAppQueryOpts<'a> {
web_app_query_id: &'a str,
result: String,
}
#[derive(Serialize, Debug)]
struct UnbanChatSenderChatOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
sender_chat_id: i64,
}
#[derive(Serialize, Debug)]
struct AnswerShippingQueryOpts<'a> {
shipping_query_id: &'a str,
ok: bool,
#[serde(skip_serializing_if = "Option::is_none")]
shipping_options: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
error_message: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct GetMyStarBalanceOpts();
#[derive(Serialize, Debug)]
struct SendGiftOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
user_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
chat_id: Option<V>,
gift_id: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
pay_for_upgrade: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
text: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
text_parse_mode: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
text_entities: Option<String>,
}
#[derive(Serialize, Debug)]
struct GetFileOpts<'a> {
file_id: &'a str,
}
#[derive(Serialize, Debug)]
struct CreateChatSubscriptionInviteLinkOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<&'a str>,
subscription_period: i64,
subscription_price: i64,
}
#[derive(Serialize, Debug)]
struct SetChatStickerSetOpts<'a, V: Into<ChatHandle> + Serialize> {
chat_id: V,
sticker_set_name: &'a str,
}
#[derive(Serialize, Debug)]
struct ReopenForumTopicOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
message_thread_id: i64,
}
#[derive(Serialize, Debug)]
struct VerifyUserOpts<'a> {
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
custom_description: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct ForwardMessagesOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_ids: String,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
}
#[derive(Serialize, Debug)]
struct GetUserProfilePhotosOpts {
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
offset: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
}
#[derive(Serialize, Debug)]
struct SetMyCommandsOpts<'a> {
commands: String,
#[serde(skip_serializing_if = "Option::is_none")]
scope: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct DeleteMyCommandsOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
scope: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct DeleteBusinessMessagesOpts<'a> {
business_connection_id: &'a str,
message_ids: String,
}
#[derive(Serialize, Debug)]
struct SetBusinessAccountProfilePhotoOpts<'a> {
business_connection_id: &'a str,
photo: String,
#[serde(skip_serializing_if = "Option::is_none")]
is_public: Option<bool>,
}
#[derive(Serialize, Debug)]
struct BanChatSenderChatOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
sender_chat_id: i64,
}
#[derive(Serialize, Debug)]
struct GetChatMemberCountOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct GetManagedBotTokenOpts {
user_id: i64,
}
#[derive(Serialize, Debug)]
struct CloseForumTopicOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
message_thread_id: i64,
}
#[derive(Serialize, Debug)]
struct LeaveChatOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct GetChatAdministratorsOpts<V: Into<ChatHandle> + Serialize> {
chat_id: V,
}
#[derive(Serialize, Debug)]
struct LogOutOpts();
#[derive(Serialize, Debug)]
struct SetMyNameOpts<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
language_code: Option<&'a str>,
}
#[derive(Serialize, Debug)]
struct ApproveSuggestedPostOpts {
chat_id: i64,
message_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
send_date: Option<i64>,
}
#[derive(Serialize, Debug)]
struct SendStickerOpts<'a, V: Into<ChatHandle> + Serialize> {
#[serde(skip_serializing_if = "Option::is_none")]
business_connection_id: Option<&'a str>,
chat_id: V,
#[serde(skip_serializing_if = "Option::is_none")]
message_thread_id: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
direct_messages_topic_id: Option<i64>,
sticker: String,
#[serde(skip_serializing_if = "Option::is_none")]
emoji: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_notification: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
protect_content: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
allow_paid_broadcast: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
message_effect_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
suggested_post_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_parameters: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
reply_markup: Option<String>,
}
#[derive(Serialize, Debug)]
struct ReadBusinessMessageOpts<'a> {
business_connection_id: &'a str,
chat_id: i64,
message_id: i64,
}
#[derive(Serialize, Debug)]
struct GetCustomEmojiStickersOpts {
custom_emoji_ids: String,
}
#[derive(Serialize, Debug)]
struct UploadStickerFileOpts<'a> {
user_id: i64,
sticker: String,
sticker_format: &'a str,
}
#[derive(Serialize, Debug)]
struct GetUserGiftsOpts<'a> {
user_id: i64,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_unlimited: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_limited_upgradable: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_limited_non_upgradable: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_from_blockchain: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
exclude_unique: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
sort_by_price: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
offset: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
}
pub struct CallGetMyShortDescription<'a> {
bot: &'a Bot,
language_code: Option<&'a str>,
}
impl<'a> CallGetMyShortDescription<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code or an empty string"]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<BotShortDescription> {
self.bot.get_my_short_description(self.language_code).await
}
}
pub struct CallSendVoice<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
voice: FileData,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
duration: Option<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendVoice<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn voice(mut self, voice: FileData) -> Self {
self.voice = voice;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_voice(&'a self) -> &'a FileData {
&self.voice
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Voice message caption, 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the voice message caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Duration of the voice message in seconds"]
#[allow(clippy::needless_lifetimes)]
pub fn duration(mut self, duration: i64) -> Self {
self.duration = Some(duration);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_duration(&'a self) -> &'a Option<i64> {
&self.duration
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_voice(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.voice,
self.caption,
self.parse_mode,
self.caption_entities,
self.duration,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallGetChatGifts<'a, V> {
bot: &'a Bot,
chat_id: V,
exclude_unsaved: Option<bool>,
exclude_saved: Option<bool>,
exclude_unlimited: Option<bool>,
exclude_limited_upgradable: Option<bool>,
exclude_limited_non_upgradable: Option<bool>,
exclude_from_blockchain: Option<bool>,
exclude_unique: Option<bool>,
sort_by_price: Option<bool>,
offset: Option<&'a str>,
limit: Option<i64>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallGetChatGifts<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that aren't saved to the chat's profile page. Always True, unless the bot has the can_post_messages administrator right in the channel."]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_unsaved(mut self, exclude_unsaved: bool) -> Self {
self.exclude_unsaved = Some(exclude_unsaved);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_unsaved(&'a self) -> &'a Option<bool> {
&self.exclude_unsaved
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that are saved to the chat's profile page. Always False, unless the bot has the can_post_messages administrator right in the channel."]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_saved(mut self, exclude_saved: bool) -> Self {
self.exclude_saved = Some(exclude_saved);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_saved(&'a self) -> &'a Option<bool> {
&self.exclude_saved
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased an unlimited number of times"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_unlimited(mut self, exclude_unlimited: bool) -> Self {
self.exclude_unlimited = Some(exclude_unlimited);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_unlimited(&'a self) -> &'a Option<bool> {
&self.exclude_unlimited
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_limited_upgradable(mut self, exclude_limited_upgradable: bool) -> Self {
self.exclude_limited_upgradable = Some(exclude_limited_upgradable);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_limited_upgradable(&'a self) -> &'a Option<bool> {
&self.exclude_limited_upgradable
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_limited_non_upgradable(mut self, exclude_limited_non_upgradable: bool) -> Self {
self.exclude_limited_non_upgradable = Some(exclude_limited_non_upgradable);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_limited_non_upgradable(&'a self) -> &'a Option<bool> {
&self.exclude_limited_non_upgradable
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_from_blockchain(mut self, exclude_from_blockchain: bool) -> Self {
self.exclude_from_blockchain = Some(exclude_from_blockchain);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_from_blockchain(&'a self) -> &'a Option<bool> {
&self.exclude_from_blockchain
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude unique gifts"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_unique(mut self, exclude_unique: bool) -> Self {
self.exclude_unique = Some(exclude_unique);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_unique(&'a self) -> &'a Option<bool> {
&self.exclude_unique
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to sort results by gift price instead of send date. Sorting is applied before pagination."]
#[allow(clippy::needless_lifetimes)]
pub fn sort_by_price(mut self, sort_by_price: bool) -> Self {
self.sort_by_price = Some(sort_by_price);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sort_by_price(&'a self) -> &'a Option<bool> {
&self.sort_by_price
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results"]
#[allow(clippy::needless_lifetimes)]
pub fn offset(mut self, offset: &'a str) -> Self {
self.offset = Some(offset);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_offset(&'a self) -> &'a Option<&'a str> {
&self.offset
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum number of gifts to be returned; 1-100. Defaults to 100"]
#[allow(clippy::needless_lifetimes)]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_limit(&'a self) -> &'a Option<i64> {
&self.limit
}
pub async fn build(self) -> BotResult<OwnedGifts> {
self.bot
.get_chat_gifts(
self.chat_id,
self.exclude_unsaved,
self.exclude_saved,
self.exclude_unlimited,
self.exclude_limited_upgradable,
self.exclude_limited_non_upgradable,
self.exclude_from_blockchain,
self.exclude_unique,
self.sort_by_price,
self.offset,
self.limit,
)
.await
}
}
pub struct CallBanChatMember<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
until_date: Option<i64>,
revoke_messages: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallBanChatMember<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only."]
#[allow(clippy::needless_lifetimes)]
pub fn until_date(mut self, until_date: i64) -> Self {
self.until_date = Some(until_date);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_until_date(&'a self) -> &'a Option<i64> {
&self.until_date
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels."]
#[allow(clippy::needless_lifetimes)]
pub fn revoke_messages(mut self, revoke_messages: bool) -> Self {
self.revoke_messages = Some(revoke_messages);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_revoke_messages(&'a self) -> &'a Option<bool> {
&self.revoke_messages
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.ban_chat_member(
self.chat_id,
self.user_id,
self.until_date,
self.revoke_messages,
)
.await
}
}
pub struct CallSetBusinessAccountUsername<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
username: Option<&'a str>,
}
impl<'a> CallSetBusinessAccountUsername<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The new value of the username for the business account; 0-32 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn username(mut self, username: &'a str) -> Self {
self.username = Some(username);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_username(&'a self) -> &'a Option<&'a str> {
&self.username
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_business_account_username(self.business_connection_id, self.username)
.await
}
}
pub struct CallGetMyCommands<'a> {
bot: &'a Bot,
scope: Option<&'a BotCommandScope>,
language_code: Option<&'a str>,
}
impl<'a> CallGetMyCommands<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault."]
#[allow(clippy::needless_lifetimes)]
pub fn scope<T>(mut self, scope: T) -> Self
where
T: Into<&'a BotCommandScope>,
{
self.scope = Some(scope.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_scope(&'a self) -> &'a Option<&'a BotCommandScope> {
&self.scope
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code or an empty string"]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<Vec<BotCommand>> {
self.bot
.get_my_commands(self.scope, self.language_code)
.await
}
}
pub struct CallDeleteStory<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
story_id: i64,
}
impl<'a> CallDeleteStory<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the story to delete"]
#[allow(clippy::needless_lifetimes)]
pub fn story_id(mut self, story_id: i64) -> Self {
self.story_id = story_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_story_id(&'a self) -> &'a i64 {
&self.story_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.delete_story(self.business_connection_id, self.story_id)
.await
}
}
pub struct CallEditMessageReplyMarkup<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageReplyMarkup<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<V> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
self.inline_message_id = Some(inline_message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
&self.inline_message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for an inline keyboard."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<MessageBool> {
self.bot
.edit_message_reply_markup(
self.business_connection_id,
self.chat_id,
self.message_id,
self.inline_message_id,
self.reply_markup,
)
.await
}
}
pub struct CallReplaceStickerInSet<'a> {
bot: &'a Bot,
user_id: i64,
name: &'a str,
old_sticker: &'a str,
sticker: &'a InputSticker,
}
impl<'a> CallReplaceStickerInSet<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier of the sticker set owner"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker set name"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "File identifier of the replaced sticker"]
#[allow(clippy::needless_lifetimes)]
pub fn old_sticker(mut self, old_sticker: &'a str) -> Self {
self.old_sticker = old_sticker;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_old_sticker(&'a self) -> &'a &'a str {
&self.old_sticker
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged."]
#[allow(clippy::needless_lifetimes)]
pub fn sticker<T>(mut self, sticker: T) -> Self
where
T: Into<&'a InputSticker>,
{
self.sticker = sticker.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a &'a InputSticker {
&self.sticker
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.replace_sticker_in_set(self.user_id, self.name, self.old_sticker, self.sticker)
.await
}
}
pub struct CallUnpinAllGeneralForumTopicMessages<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallUnpinAllGeneralForumTopicMessages<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.unpin_all_general_forum_topic_messages(self.chat_id)
.await
}
}
pub struct CallDeleteStickerSet<'a> {
bot: &'a Bot,
name: &'a str,
}
impl<'a> CallDeleteStickerSet<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker set name"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
pub async fn build(self) -> BotResult<bool> {
self.bot.delete_sticker_set(self.name).await
}
}
pub struct CallSetChatMemberTag<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
tag: Option<&'a str>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatMemberTag<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New tag for the member; 0-16 characters, emoji are not allowed"]
#[allow(clippy::needless_lifetimes)]
pub fn tag(mut self, tag: &'a str) -> Self {
self.tag = Some(tag);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_tag(&'a self) -> &'a Option<&'a str> {
&self.tag
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_chat_member_tag(self.chat_id, self.user_id, self.tag)
.await
}
}
pub struct CallSetStickerEmojiList<'a> {
bot: &'a Bot,
sticker: &'a str,
emoji_list: &'a Vec<String>,
}
impl<'a> CallSetStickerEmojiList<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "File identifier of the sticker"]
#[allow(clippy::needless_lifetimes)]
pub fn sticker(mut self, sticker: &'a str) -> Self {
self.sticker = sticker;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a &'a str {
&self.sticker
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of 1-20 emoji associated with the sticker"]
#[allow(clippy::needless_lifetimes)]
pub fn emoji_list(mut self, emoji_list: &'a Vec<String>) -> Self {
self.emoji_list = emoji_list;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_emoji_list(&'a self) -> &'a &'a Vec<String> {
&self.emoji_list
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_sticker_emoji_list(self.sticker, self.emoji_list)
.await
}
}
pub struct CallAnswerCallbackQuery<'a> {
bot: &'a Bot,
callback_query_id: &'a str,
text: Option<&'a str>,
show_alert: Option<bool>,
url: Option<&'a str>,
cache_time: Option<i64>,
}
impl<'a> CallAnswerCallbackQuery<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the query to be answered"]
#[allow(clippy::needless_lifetimes)]
pub fn callback_query_id(mut self, callback_query_id: &'a str) -> Self {
self.callback_query_id = callback_query_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_callback_query_id(&'a self) -> &'a &'a str {
&self.callback_query_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn text(mut self, text: &'a str) -> Self {
self.text = Some(text);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text(&'a self) -> &'a Option<&'a str> {
&self.text
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false."]
#[allow(clippy::needless_lifetimes)]
pub fn show_alert(mut self, show_alert: bool) -> Self {
self.show_alert = Some(show_alert);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_show_alert(&'a self) -> &'a Option<bool> {
&self.show_alert
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter."]
#[allow(clippy::needless_lifetimes)]
pub fn url(mut self, url: &'a str) -> Self {
self.url = Some(url);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_url(&'a self) -> &'a Option<&'a str> {
&self.url
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0."]
#[allow(clippy::needless_lifetimes)]
pub fn cache_time(mut self, cache_time: i64) -> Self {
self.cache_time = Some(cache_time);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_cache_time(&'a self) -> &'a Option<i64> {
&self.cache_time
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.answer_callback_query(
self.callback_query_id,
self.text,
self.show_alert,
self.url,
self.cache_time,
)
.await
}
}
pub struct CallAddStickerToSet<'a> {
bot: &'a Bot,
user_id: i64,
name: &'a str,
sticker: &'a InputSticker,
}
impl<'a> CallAddStickerToSet<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier of sticker set owner"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker set name"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed."]
#[allow(clippy::needless_lifetimes)]
pub fn sticker<T>(mut self, sticker: T) -> Self
where
T: Into<&'a InputSticker>,
{
self.sticker = sticker.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a &'a InputSticker {
&self.sticker
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.add_sticker_to_set(self.user_id, self.name, self.sticker)
.await
}
}
pub struct CallEditUserStarSubscription<'a> {
bot: &'a Bot,
user_id: i64,
telegram_payment_charge_id: &'a str,
is_canceled: bool,
}
impl<'a> CallEditUserStarSubscription<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the user whose subscription will be edited"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Telegram payment identifier for the subscription"]
#[allow(clippy::needless_lifetimes)]
pub fn telegram_payment_charge_id(mut self, telegram_payment_charge_id: &'a str) -> Self {
self.telegram_payment_charge_id = telegram_payment_charge_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_telegram_payment_charge_id(&'a self) -> &'a &'a str {
&self.telegram_payment_charge_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot."]
#[allow(clippy::needless_lifetimes)]
pub fn is_canceled(mut self, is_canceled: bool) -> Self {
self.is_canceled = is_canceled;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_canceled(&'a self) -> &'a bool {
&self.is_canceled
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.edit_user_star_subscription(
self.user_id,
self.telegram_payment_charge_id,
self.is_canceled,
)
.await
}
}
pub struct CallSetChatTitle<'a, V> {
bot: &'a Bot,
chat_id: V,
title: &'a str,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatTitle<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New chat title, 1-128 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn title(mut self, title: &'a str) -> Self {
self.title = title;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_title(&'a self) -> &'a &'a str {
&self.title
}
pub async fn build(self) -> BotResult<bool> {
self.bot.set_chat_title(self.chat_id, self.title).await
}
}
pub struct CallSendPaidMedia<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
star_count: i64,
media: &'a Vec<InputPaidMedia>,
payload: Option<&'a str>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendPaidMedia<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance."]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The number of Telegram Stars that must be paid to buy access to the media; 1-25000"]
#[allow(clippy::needless_lifetimes)]
pub fn star_count(mut self, star_count: i64) -> Self {
self.star_count = star_count;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_star_count(&'a self) -> &'a i64 {
&self.star_count
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized array describing the media to be sent; up to 10 items"]
#[allow(clippy::needless_lifetimes)]
pub fn media(mut self, media: &'a Vec<InputPaidMedia>) -> Self {
self.media = media;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_media(&'a self) -> &'a &'a Vec<InputPaidMedia> {
&self.media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes."]
#[allow(clippy::needless_lifetimes)]
pub fn payload(mut self, payload: &'a str) -> Self {
self.payload = Some(payload);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_payload(&'a self) -> &'a Option<&'a str> {
&self.payload
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Media caption, 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the media caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the caption must be shown above the message media"]
#[allow(clippy::needless_lifetimes)]
pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
self.show_caption_above_media = Some(show_caption_above_media);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
&self.show_caption_above_media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_paid_media(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.star_count,
self.media,
self.payload,
self.caption,
self.parse_mode,
self.caption_entities,
self.show_caption_above_media,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallUnbanChatMember<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
only_if_banned: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallUnbanChatMember<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Do nothing if the user is not banned"]
#[allow(clippy::needless_lifetimes)]
pub fn only_if_banned(mut self, only_if_banned: bool) -> Self {
self.only_if_banned = Some(only_if_banned);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_only_if_banned(&'a self) -> &'a Option<bool> {
&self.only_if_banned
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.unban_chat_member(self.chat_id, self.user_id, self.only_if_banned)
.await
}
}
pub struct CallRemoveMyProfilePhoto<'a> {
bot: &'a Bot,
}
impl<'a> CallRemoveMyProfilePhoto<'a> {
pub async fn build(self) -> BotResult<bool> {
self.bot.remove_my_profile_photo().await
}
}
pub struct CallCreateForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
name: &'a str,
icon_color: Option<i64>,
icon_custom_emoji_id: Option<&'a str>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallCreateForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Topic name, 1-128 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)"]
#[allow(clippy::needless_lifetimes)]
pub fn icon_color(mut self, icon_color: i64) -> Self {
self.icon_color = Some(icon_color);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_icon_color(&'a self) -> &'a Option<i64> {
&self.icon_color
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers."]
#[allow(clippy::needless_lifetimes)]
pub fn icon_custom_emoji_id(mut self, icon_custom_emoji_id: &'a str) -> Self {
self.icon_custom_emoji_id = Some(icon_custom_emoji_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_icon_custom_emoji_id(&'a self) -> &'a Option<&'a str> {
&self.icon_custom_emoji_id
}
pub async fn build(self) -> BotResult<ForumTopic> {
self.bot
.create_forum_topic(
self.chat_id,
self.name,
self.icon_color,
self.icon_custom_emoji_id,
)
.await
}
}
pub struct CallSendDocument<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
document: FileData,
thumbnail: Option<FileData>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
disable_content_type_detection: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendDocument<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn document(mut self, document: FileData) -> Self {
self.document = document;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_document(&'a self) -> &'a FileData {
&self.document
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
self.thumbnail = Some(thumbnail);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
&self.thumbnail
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the document caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Disables automatic server-side content type detection for files uploaded using multipart/form-data"]
#[allow(clippy::needless_lifetimes)]
pub fn disable_content_type_detection(mut self, disable_content_type_detection: bool) -> Self {
self.disable_content_type_detection = Some(disable_content_type_detection);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_content_type_detection(&'a self) -> &'a Option<bool> {
&self.disable_content_type_detection
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_document(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.document,
self.thumbnail,
self.caption,
self.parse_mode,
self.caption_entities,
self.disable_content_type_detection,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallRevokeChatInviteLink<'a, V> {
bot: &'a Bot,
chat_id: V,
invite_link: &'a str,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallRevokeChatInviteLink<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The invite link to revoke"]
#[allow(clippy::needless_lifetimes)]
pub fn invite_link(mut self, invite_link: &'a str) -> Self {
self.invite_link = invite_link;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_invite_link(&'a self) -> &'a &'a str {
&self.invite_link
}
pub async fn build(self) -> BotResult<ChatInviteLink> {
self.bot
.revoke_chat_invite_link(self.chat_id, self.invite_link)
.await
}
}
pub struct CallHideGeneralForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallHideGeneralForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.hide_general_forum_topic(self.chat_id).await
}
}
pub struct CallStopMessageLiveLocation<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallStopMessageLiveLocation<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<V> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Identifier of the message with live location to stop"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
self.inline_message_id = Some(inline_message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
&self.inline_message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for a new inline keyboard."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<MessageBool> {
self.bot
.stop_message_live_location(
self.business_connection_id,
self.chat_id,
self.message_id,
self.inline_message_id,
self.reply_markup,
)
.await
}
}
pub struct CallSetStickerMaskPosition<'a> {
bot: &'a Bot,
sticker: &'a str,
mask_position: Option<&'a MaskPosition>,
}
impl<'a> CallSetStickerMaskPosition<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "File identifier of the sticker"]
#[allow(clippy::needless_lifetimes)]
pub fn sticker(mut self, sticker: &'a str) -> Self {
self.sticker = sticker;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a &'a str {
&self.sticker
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position."]
#[allow(clippy::needless_lifetimes)]
pub fn mask_position<T>(mut self, mask_position: T) -> Self
where
T: Into<&'a MaskPosition>,
{
self.mask_position = Some(mask_position.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_mask_position(&'a self) -> &'a Option<&'a MaskPosition> {
&self.mask_position
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_sticker_mask_position(self.sticker, self.mask_position)
.await
}
}
pub struct CallDeleteWebhook<'a> {
bot: &'a Bot,
drop_pending_updates: Option<bool>,
}
impl<'a> CallDeleteWebhook<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to drop all pending updates"]
#[allow(clippy::needless_lifetimes)]
pub fn drop_pending_updates(mut self, drop_pending_updates: bool) -> Self {
self.drop_pending_updates = Some(drop_pending_updates);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_drop_pending_updates(&'a self) -> &'a Option<bool> {
&self.drop_pending_updates
}
pub async fn build(self) -> BotResult<bool> {
self.bot.delete_webhook(self.drop_pending_updates).await
}
}
pub struct CallSendInvoice<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
title: &'a str,
description: &'a str,
payload: &'a str,
provider_token: Option<&'a str>,
currency: &'a str,
prices: &'a Vec<LabeledPrice>,
max_tip_amount: Option<i64>,
suggested_tip_amounts: Option<&'a Vec<i64>>,
start_parameter: Option<&'a str>,
provider_data: Option<&'a str>,
photo_url: Option<&'a str>,
photo_size: Option<i64>,
photo_width: Option<i64>,
photo_height: Option<i64>,
need_name: Option<bool>,
need_phone_number: Option<bool>,
need_email: Option<bool>,
need_shipping_address: Option<bool>,
send_phone_number_to_provider: Option<bool>,
send_email_to_provider: Option<bool>,
is_flexible: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendInvoice<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Product name, 1-32 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn title(mut self, title: &'a str) -> Self {
self.title = title;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_title(&'a self) -> &'a &'a str {
&self.title
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Product description, 1-255 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn description(mut self, description: &'a str) -> Self {
self.description = description;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_description(&'a self) -> &'a &'a str {
&self.description
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."]
#[allow(clippy::needless_lifetimes)]
pub fn payload(mut self, payload: &'a str) -> Self {
self.payload = payload;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_payload(&'a self) -> &'a &'a str {
&self.payload
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn provider_token(mut self, provider_token: &'a str) -> Self {
self.provider_token = Some(provider_token);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_provider_token(&'a self) -> &'a Option<&'a str> {
&self.provider_token
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Three-letter ISO 4217 currency code, see more on currencies. Pass \"XTR\" for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn currency(mut self, currency: &'a str) -> Self {
self.currency = currency;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_currency(&'a self) -> &'a &'a str {
&self.currency
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn prices(mut self, prices: &'a Vec<LabeledPrice>) -> Self {
self.prices = prices;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_prices(&'a self) -> &'a &'a Vec<LabeledPrice> {
&self.prices
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn max_tip_amount(mut self, max_tip_amount: i64) -> Self {
self.max_tip_amount = Some(max_tip_amount);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_max_tip_amount(&'a self) -> &'a Option<i64> {
&self.max_tip_amount
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_tip_amounts(mut self, suggested_tip_amounts: &'a Vec<i64>) -> Self {
self.suggested_tip_amounts = Some(suggested_tip_amounts);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_tip_amounts(&'a self) -> &'a Option<&'a Vec<i64>> {
&self.suggested_tip_amounts
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter"]
#[allow(clippy::needless_lifetimes)]
pub fn start_parameter(mut self, start_parameter: &'a str) -> Self {
self.start_parameter = Some(start_parameter);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_start_parameter(&'a self) -> &'a Option<&'a str> {
&self.start_parameter
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider."]
#[allow(clippy::needless_lifetimes)]
pub fn provider_data(mut self, provider_data: &'a str) -> Self {
self.provider_data = Some(provider_data);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_provider_data(&'a self) -> &'a Option<&'a str> {
&self.provider_data
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for."]
#[allow(clippy::needless_lifetimes)]
pub fn photo_url(mut self, photo_url: &'a str) -> Self {
self.photo_url = Some(photo_url);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo_url(&'a self) -> &'a Option<&'a str> {
&self.photo_url
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Photo size in bytes"]
#[allow(clippy::needless_lifetimes)]
pub fn photo_size(mut self, photo_size: i64) -> Self {
self.photo_size = Some(photo_size);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo_size(&'a self) -> &'a Option<i64> {
&self.photo_size
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Photo width"]
#[allow(clippy::needless_lifetimes)]
pub fn photo_width(mut self, photo_width: i64) -> Self {
self.photo_width = Some(photo_width);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo_width(&'a self) -> &'a Option<i64> {
&self.photo_width
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Photo height"]
#[allow(clippy::needless_lifetimes)]
pub fn photo_height(mut self, photo_height: i64) -> Self {
self.photo_height = Some(photo_height);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo_height(&'a self) -> &'a Option<i64> {
&self.photo_height
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn need_name(mut self, need_name: bool) -> Self {
self.need_name = Some(need_name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_need_name(&'a self) -> &'a Option<bool> {
&self.need_name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn need_phone_number(mut self, need_phone_number: bool) -> Self {
self.need_phone_number = Some(need_phone_number);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_need_phone_number(&'a self) -> &'a Option<bool> {
&self.need_phone_number
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn need_email(mut self, need_email: bool) -> Self {
self.need_email = Some(need_email);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_need_email(&'a self) -> &'a Option<bool> {
&self.need_email
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn need_shipping_address(mut self, need_shipping_address: bool) -> Self {
self.need_shipping_address = Some(need_shipping_address);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_need_shipping_address(&'a self) -> &'a Option<bool> {
&self.need_shipping_address
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn send_phone_number_to_provider(mut self, send_phone_number_to_provider: bool) -> Self {
self.send_phone_number_to_provider = Some(send_phone_number_to_provider);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_send_phone_number_to_provider(&'a self) -> &'a Option<bool> {
&self.send_phone_number_to_provider
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn send_email_to_provider(mut self, send_email_to_provider: bool) -> Self {
self.send_email_to_provider = Some(send_email_to_provider);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_send_email_to_provider(&'a self) -> &'a Option<bool> {
&self.send_email_to_provider
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn is_flexible(mut self, is_flexible: bool) -> Self {
self.is_flexible = Some(is_flexible);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_flexible(&'a self) -> &'a Option<bool> {
&self.is_flexible
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_invoice(
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.title,
self.description,
self.payload,
self.provider_token,
self.currency,
self.prices,
self.max_tip_amount,
self.suggested_tip_amounts,
self.start_parameter,
self.provider_data,
self.photo_url,
self.photo_size,
self.photo_width,
self.photo_height,
self.need_name,
self.need_phone_number,
self.need_email,
self.need_shipping_address,
self.send_phone_number_to_provider,
self.send_email_to_provider,
self.is_flexible,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallSendChatAction<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
action: &'a str,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendChatAction<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the action will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel chats and channel direct messages chats aren't supported."]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes."]
#[allow(clippy::needless_lifetimes)]
pub fn action(mut self, action: &'a str) -> Self {
self.action = action;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_action(&'a self) -> &'a &'a str {
&self.action
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.send_chat_action(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.action,
)
.await
}
}
pub struct CallAnswerPreCheckoutQuery<'a> {
bot: &'a Bot,
pre_checkout_query_id: &'a str,
ok: bool,
error_message: Option<&'a str>,
}
impl<'a> CallAnswerPreCheckoutQuery<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the query to be answered"]
#[allow(clippy::needless_lifetimes)]
pub fn pre_checkout_query_id(mut self, pre_checkout_query_id: &'a str) -> Self {
self.pre_checkout_query_id = pre_checkout_query_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_pre_checkout_query_id(&'a self) -> &'a &'a str {
&self.pre_checkout_query_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems."]
#[allow(clippy::needless_lifetimes)]
pub fn ok(mut self, ok: bool) -> Self {
self.ok = ok;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_ok(&'a self) -> &'a bool {
&self.ok
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. \"Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!\"). Telegram will display this message to the user."]
#[allow(clippy::needless_lifetimes)]
pub fn error_message(mut self, error_message: &'a str) -> Self {
self.error_message = Some(error_message);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_error_message(&'a self) -> &'a Option<&'a str> {
&self.error_message
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.answer_pre_checkout_query(self.pre_checkout_query_id, self.ok, self.error_message)
.await
}
}
pub struct CallSetStickerPositionInSet<'a> {
bot: &'a Bot,
sticker: &'a str,
position: i64,
}
impl<'a> CallSetStickerPositionInSet<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "File identifier of the sticker"]
#[allow(clippy::needless_lifetimes)]
pub fn sticker(mut self, sticker: &'a str) -> Self {
self.sticker = sticker;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a &'a str {
&self.sticker
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New sticker position in the set, zero-based"]
#[allow(clippy::needless_lifetimes)]
pub fn position(mut self, position: i64) -> Self {
self.position = position;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_position(&'a self) -> &'a i64 {
&self.position
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_sticker_position_in_set(self.sticker, self.position)
.await
}
}
pub struct CallSendGame<'a> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: i64,
message_thread_id: Option<i64>,
game_short_name: &'a str,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a> CallSendGame<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats."]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a i64 {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather."]
#[allow(clippy::needless_lifetimes)]
pub fn game_short_name(mut self, game_short_name: &'a str) -> Self {
self.game_short_name = game_short_name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_game_short_name(&'a self) -> &'a &'a str {
&self.game_short_name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_game(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.game_short_name,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallExportChatInviteLink<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallExportChatInviteLink<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<String> {
self.bot.export_chat_invite_link(self.chat_id).await
}
}
pub struct CallSetChatPhoto<'a, V> {
bot: &'a Bot,
chat_id: V,
photo: FileData,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatPhoto<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New chat photo, uploaded using multipart/form-data"]
#[allow(clippy::needless_lifetimes)]
pub fn photo(mut self, photo: FileData) -> Self {
self.photo = photo;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo(&'a self) -> &'a FileData {
&self.photo
}
pub async fn build(self) -> BotResult<bool> {
self.bot.set_chat_photo(self.chat_id, self.photo).await
}
}
pub struct CallDeleteChatPhoto<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteChatPhoto<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.delete_chat_photo(self.chat_id).await
}
}
pub struct CallGetChatMember<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallGetChatMember<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
pub async fn build(self) -> BotResult<ChatMember> {
self.bot.get_chat_member(self.chat_id, self.user_id).await
}
}
pub struct CallEditMessageCaption<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageCaption<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<V> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
self.inline_message_id = Some(inline_message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
&self.inline_message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New caption of the message, 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the message caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages."]
#[allow(clippy::needless_lifetimes)]
pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
self.show_caption_above_media = Some(show_caption_above_media);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
&self.show_caption_above_media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for an inline keyboard."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<MessageBool> {
self.bot
.edit_message_caption(
self.business_connection_id,
self.chat_id,
self.message_id,
self.inline_message_id,
self.caption,
self.parse_mode,
self.caption_entities,
self.show_caption_above_media,
self.reply_markup,
)
.await
}
}
pub struct CallDeleteMessage<'a, V> {
bot: &'a Bot,
chat_id: V,
message_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteMessage<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the message to delete"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.delete_message(self.chat_id, self.message_id).await
}
}
pub struct CallEditChatInviteLink<'a, V> {
bot: &'a Bot,
chat_id: V,
invite_link: &'a str,
name: Option<&'a str>,
expire_date: Option<i64>,
member_limit: Option<i64>,
creates_join_request: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditChatInviteLink<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The invite link to edit"]
#[allow(clippy::needless_lifetimes)]
pub fn invite_link(mut self, invite_link: &'a str) -> Self {
self.invite_link = invite_link;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_invite_link(&'a self) -> &'a &'a str {
&self.invite_link
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Invite link name; 0-32 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = Some(name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a Option<&'a str> {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Point in time (Unix timestamp) when the link will expire"]
#[allow(clippy::needless_lifetimes)]
pub fn expire_date(mut self, expire_date: i64) -> Self {
self.expire_date = Some(expire_date);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_expire_date(&'a self) -> &'a Option<i64> {
&self.expire_date
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"]
#[allow(clippy::needless_lifetimes)]
pub fn member_limit(mut self, member_limit: i64) -> Self {
self.member_limit = Some(member_limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_member_limit(&'a self) -> &'a Option<i64> {
&self.member_limit
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified"]
#[allow(clippy::needless_lifetimes)]
pub fn creates_join_request(mut self, creates_join_request: bool) -> Self {
self.creates_join_request = Some(creates_join_request);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_creates_join_request(&'a self) -> &'a Option<bool> {
&self.creates_join_request
}
pub async fn build(self) -> BotResult<ChatInviteLink> {
self.bot
.edit_chat_invite_link(
self.chat_id,
self.invite_link,
self.name,
self.expire_date,
self.member_limit,
self.creates_join_request,
)
.await
}
}
pub struct CallSetPassportDataErrors<'a> {
bot: &'a Bot,
user_id: i64,
errors: &'a Vec<PassportElementError>,
}
impl<'a> CallSetPassportDataErrors<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized array describing the errors"]
#[allow(clippy::needless_lifetimes)]
pub fn errors(mut self, errors: &'a Vec<PassportElementError>) -> Self {
self.errors = errors;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_errors(&'a self) -> &'a &'a Vec<PassportElementError> {
&self.errors
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_passport_data_errors(self.user_id, self.errors)
.await
}
}
pub struct CallSetChatPermissions<'a, V> {
bot: &'a Bot,
chat_id: V,
permissions: &'a ChatPermissions,
use_independent_chat_permissions: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatPermissions<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for new default chat permissions"]
#[allow(clippy::needless_lifetimes)]
pub fn permissions<T>(mut self, permissions: T) -> Self
where
T: Into<&'a ChatPermissions>,
{
self.permissions = permissions.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_permissions(&'a self) -> &'a &'a ChatPermissions {
&self.permissions
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission."]
#[allow(clippy::needless_lifetimes)]
pub fn use_independent_chat_permissions(
mut self,
use_independent_chat_permissions: bool,
) -> Self {
self.use_independent_chat_permissions = Some(use_independent_chat_permissions);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_use_independent_chat_permissions(&'a self) -> &'a Option<bool> {
&self.use_independent_chat_permissions
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_chat_permissions(
self.chat_id,
self.permissions,
self.use_independent_chat_permissions,
)
.await
}
}
pub struct CallPostStory<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
content: &'a InputStoryContent,
active_period: i64,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
areas: Option<&'a Vec<StoryArea>>,
post_to_chat_page: Option<bool>,
protect_content: Option<bool>,
}
impl<'a> CallPostStory<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Content of the story"]
#[allow(clippy::needless_lifetimes)]
pub fn content<T>(mut self, content: T) -> Self
where
T: Into<&'a InputStoryContent>,
{
self.content = content.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_content(&'a self) -> &'a &'a InputStoryContent {
&self.content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400"]
#[allow(clippy::needless_lifetimes)]
pub fn active_period(mut self, active_period: i64) -> Self {
self.active_period = active_period;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_active_period(&'a self) -> &'a i64 {
&self.active_period
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Caption of the story, 0-2048 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the story caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of clickable areas to be shown on the story"]
#[allow(clippy::needless_lifetimes)]
pub fn areas(mut self, areas: &'a Vec<StoryArea>) -> Self {
self.areas = Some(areas);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_areas(&'a self) -> &'a Option<&'a Vec<StoryArea>> {
&self.areas
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to keep the story accessible after it expires"]
#[allow(clippy::needless_lifetimes)]
pub fn post_to_chat_page(mut self, post_to_chat_page: bool) -> Self {
self.post_to_chat_page = Some(post_to_chat_page);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_post_to_chat_page(&'a self) -> &'a Option<bool> {
&self.post_to_chat_page
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the content of the story must be protected from forwarding and screenshotting"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
pub async fn build(self) -> BotResult<Story> {
self.bot
.post_story(
self.business_connection_id,
self.content,
self.active_period,
self.caption,
self.parse_mode,
self.caption_entities,
self.areas,
self.post_to_chat_page,
self.protect_content,
)
.await
}
}
pub struct CallGetUpdates<'a> {
bot: &'a Bot,
offset: Option<i64>,
limit: Option<i64>,
timeout: Option<i64>,
allowed_updates: Option<&'a Vec<String>>,
}
impl<'a> CallGetUpdates<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten."]
#[allow(clippy::needless_lifetimes)]
pub fn offset(mut self, offset: i64) -> Self {
self.offset = Some(offset);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_offset(&'a self) -> &'a Option<i64> {
&self.offset
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100."]
#[allow(clippy::needless_lifetimes)]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_limit(&'a self) -> &'a Option<i64> {
&self.limit
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only."]
#[allow(clippy::needless_lifetimes)]
pub fn timeout(mut self, timeout: i64) -> Self {
self.timeout = Some(timeout);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_timeout(&'a self) -> &'a Option<i64> {
&self.timeout
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time."]
#[allow(clippy::needless_lifetimes)]
pub fn allowed_updates(mut self, allowed_updates: &'a Vec<String>) -> Self {
self.allowed_updates = Some(allowed_updates);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allowed_updates(&'a self) -> &'a Option<&'a Vec<String>> {
&self.allowed_updates
}
pub async fn build(self) -> BotResult<Vec<Update>> {
self.bot
.get_updates(self.offset, self.limit, self.timeout, self.allowed_updates)
.await
}
}
pub struct CallCopyMessages<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_ids: &'a Vec<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
remove_caption: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallCopyMessages<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn from_chat_id(mut self, from_chat_id: V) -> Self {
self.from_chat_id = from_chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_from_chat_id(&'a self) -> &'a V {
&self.from_chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order."]
#[allow(clippy::needless_lifetimes)]
pub fn message_ids(mut self, message_ids: &'a Vec<i64>) -> Self {
self.message_ids = message_ids;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_ids(&'a self) -> &'a &'a Vec<i64> {
&self.message_ids
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the messages silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent messages from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to copy the messages without their captions"]
#[allow(clippy::needless_lifetimes)]
pub fn remove_caption(mut self, remove_caption: bool) -> Self {
self.remove_caption = Some(remove_caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_remove_caption(&'a self) -> &'a Option<bool> {
&self.remove_caption
}
pub async fn build(self) -> BotResult<Vec<MessageId>> {
self.bot
.copy_messages(
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.from_chat_id,
self.message_ids,
self.disable_notification,
self.protect_content,
self.remove_caption,
)
.await
}
}
pub struct CallGiftPremiumSubscription<'a> {
bot: &'a Bot,
user_id: i64,
month_count: i64,
star_count: i64,
text: Option<&'a str>,
text_parse_mode: Option<&'a str>,
text_entities: Option<&'a Vec<MessageEntity>>,
}
impl<'a> CallGiftPremiumSubscription<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user who will receive a Telegram Premium subscription"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12"]
#[allow(clippy::needless_lifetimes)]
pub fn month_count(mut self, month_count: i64) -> Self {
self.month_count = month_count;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_month_count(&'a self) -> &'a i64 {
&self.month_count
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months"]
#[allow(clippy::needless_lifetimes)]
pub fn star_count(mut self, star_count: i64) -> Self {
self.star_count = star_count;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_star_count(&'a self) -> &'a i64 {
&self.star_count
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Text that will be shown along with the service message about the subscription; 0-128 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn text(mut self, text: &'a str) -> Self {
self.text = Some(text);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text(&'a self) -> &'a Option<&'a str> {
&self.text
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the text. See formatting options for more details. Entities other than \"bold\", \"italic\", \"underline\", \"strikethrough\", \"spoiler\", \"custom_emoji\", and \"date_time\" are ignored."]
#[allow(clippy::needless_lifetimes)]
pub fn text_parse_mode(mut self, text_parse_mode: &'a str) -> Self {
self.text_parse_mode = Some(text_parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.text_parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than \"bold\", \"italic\", \"underline\", \"strikethrough\", \"spoiler\", \"custom_emoji\", and \"date_time\" are ignored."]
#[allow(clippy::needless_lifetimes)]
pub fn text_entities(mut self, text_entities: &'a Vec<MessageEntity>) -> Self {
self.text_entities = Some(text_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.text_entities
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.gift_premium_subscription(
self.user_id,
self.month_count,
self.star_count,
self.text,
self.text_parse_mode,
self.text_entities,
)
.await
}
}
pub struct CallGetWebhookInfo<'a> {
bot: &'a Bot,
}
impl<'a> CallGetWebhookInfo<'a> {
pub async fn build(self) -> BotResult<WebhookInfo> {
self.bot.get_webhook_info().await
}
}
pub struct CallApproveChatJoinRequest<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallApproveChatJoinRequest<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.approve_chat_join_request(self.chat_id, self.user_id)
.await
}
}
pub struct CallTransferBusinessAccountStars<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
star_count: i64,
}
impl<'a> CallTransferBusinessAccountStars<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Number of Telegram Stars to transfer; 1-10000"]
#[allow(clippy::needless_lifetimes)]
pub fn star_count(mut self, star_count: i64) -> Self {
self.star_count = star_count;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_star_count(&'a self) -> &'a i64 {
&self.star_count
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.transfer_business_account_stars(self.business_connection_id, self.star_count)
.await
}
}
pub struct CallGetStarTransactions<'a> {
bot: &'a Bot,
offset: Option<i64>,
limit: Option<i64>,
}
impl<'a> CallGetStarTransactions<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Number of transactions to skip in the response"]
#[allow(clippy::needless_lifetimes)]
pub fn offset(mut self, offset: i64) -> Self {
self.offset = Some(offset);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_offset(&'a self) -> &'a Option<i64> {
&self.offset
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100."]
#[allow(clippy::needless_lifetimes)]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_limit(&'a self) -> &'a Option<i64> {
&self.limit
}
pub async fn build(self) -> BotResult<StarTransactions> {
self.bot
.get_star_transactions(self.offset, self.limit)
.await
}
}
pub struct CallSetGameScore<'a> {
bot: &'a Bot,
user_id: i64,
score: i64,
force: Option<bool>,
disable_edit_message: Option<bool>,
chat_id: Option<i64>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
}
impl<'a> CallSetGameScore<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New score, must be non-negative"]
#[allow(clippy::needless_lifetimes)]
pub fn score(mut self, score: i64) -> Self {
self.score = score;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_score(&'a self) -> &'a i64 {
&self.score
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters"]
#[allow(clippy::needless_lifetimes)]
pub fn force(mut self, force: bool) -> Self {
self.force = Some(force);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_force(&'a self) -> &'a Option<bool> {
&self.force
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the game message should not be automatically edited to include the current scoreboard"]
#[allow(clippy::needless_lifetimes)]
pub fn disable_edit_message(mut self, disable_edit_message: bool) -> Self {
self.disable_edit_message = Some(disable_edit_message);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_edit_message(&'a self) -> &'a Option<bool> {
&self.disable_edit_message
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<i64> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Identifier of the sent message"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
self.inline_message_id = Some(inline_message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
&self.inline_message_id
}
pub async fn build(self) -> BotResult<MessageBool> {
self.bot
.set_game_score(
self.user_id,
self.score,
self.force,
self.disable_edit_message,
self.chat_id,
self.message_id,
self.inline_message_id,
)
.await
}
}
pub struct CallGetBusinessAccountStarBalance<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
}
impl<'a> CallGetBusinessAccountStarBalance<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
pub async fn build(self) -> BotResult<StarAmount> {
self.bot
.get_business_account_star_balance(self.business_connection_id)
.await
}
}
pub struct CallGetMyDescription<'a> {
bot: &'a Bot,
language_code: Option<&'a str>,
}
impl<'a> CallGetMyDescription<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code or an empty string"]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<BotDescription> {
self.bot.get_my_description(self.language_code).await
}
}
pub struct CallForwardMessage<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
video_start_timestamp: Option<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
message_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallForwardMessage<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn from_chat_id(mut self, from_chat_id: V) -> Self {
self.from_chat_id = from_chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_from_chat_id(&'a self) -> &'a V {
&self.from_chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New start timestamp for the forwarded video in the message"]
#[allow(clippy::needless_lifetimes)]
pub fn video_start_timestamp(mut self, video_start_timestamp: i64) -> Self {
self.video_start_timestamp = Some(video_start_timestamp);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_video_start_timestamp(&'a self) -> &'a Option<i64> {
&self.video_start_timestamp
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the forwarded message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; only available when forwarding to private chats"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Message identifier in the chat specified in from_chat_id"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.forward_message(
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.from_chat_id,
self.video_start_timestamp,
self.disable_notification,
self.protect_content,
self.message_effect_id,
self.suggested_post_parameters,
self.message_id,
)
.await
}
}
pub struct CallSetMyDescription<'a> {
bot: &'a Bot,
description: Option<&'a str>,
language_code: Option<&'a str>,
}
impl<'a> CallSetMyDescription<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language."]
#[allow(clippy::needless_lifetimes)]
pub fn description(mut self, description: &'a str) -> Self {
self.description = Some(description);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_description(&'a self) -> &'a Option<&'a str> {
&self.description
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description."]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_my_description(self.description, self.language_code)
.await
}
}
pub struct CallSetBusinessAccountGiftSettings<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
show_gift_button: bool,
accepted_gift_types: &'a AcceptedGiftTypes,
}
impl<'a> CallSetBusinessAccountGiftSettings<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field"]
#[allow(clippy::needless_lifetimes)]
pub fn show_gift_button(mut self, show_gift_button: bool) -> Self {
self.show_gift_button = show_gift_button;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_show_gift_button(&'a self) -> &'a bool {
&self.show_gift_button
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Types of gifts accepted by the business account"]
#[allow(clippy::needless_lifetimes)]
pub fn accepted_gift_types<T>(mut self, accepted_gift_types: T) -> Self
where
T: Into<&'a AcceptedGiftTypes>,
{
self.accepted_gift_types = accepted_gift_types.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_accepted_gift_types(&'a self) -> &'a &'a AcceptedGiftTypes {
&self.accepted_gift_types
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_business_account_gift_settings(
self.business_connection_id,
self.show_gift_button,
self.accepted_gift_types,
)
.await
}
}
pub struct CallDeleteMessages<'a, V> {
bot: &'a Bot,
chat_id: V,
message_ids: &'a Vec<i64>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteMessages<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of 1-100 identifiers of messages to delete. See deleteMessage for limitations on which messages can be deleted"]
#[allow(clippy::needless_lifetimes)]
pub fn message_ids(mut self, message_ids: &'a Vec<i64>) -> Self {
self.message_ids = message_ids;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_ids(&'a self) -> &'a &'a Vec<i64> {
&self.message_ids
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.delete_messages(self.chat_id, self.message_ids)
.await
}
}
pub struct CallCreateInvoiceLink<'a> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
title: &'a str,
description: &'a str,
payload: &'a str,
provider_token: Option<&'a str>,
currency: &'a str,
prices: &'a Vec<LabeledPrice>,
subscription_period: Option<i64>,
max_tip_amount: Option<i64>,
suggested_tip_amounts: Option<&'a Vec<i64>>,
provider_data: Option<&'a str>,
photo_url: Option<&'a str>,
photo_size: Option<i64>,
photo_width: Option<i64>,
photo_height: Option<i64>,
need_name: Option<bool>,
need_phone_number: Option<bool>,
need_email: Option<bool>,
need_shipping_address: Option<bool>,
send_phone_number_to_provider: Option<bool>,
send_email_to_provider: Option<bool>,
is_flexible: Option<bool>,
}
impl<'a> CallCreateInvoiceLink<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only."]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Product name, 1-32 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn title(mut self, title: &'a str) -> Self {
self.title = title;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_title(&'a self) -> &'a &'a str {
&self.title
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Product description, 1-255 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn description(mut self, description: &'a str) -> Self {
self.description = description;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_description(&'a self) -> &'a &'a str {
&self.description
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes."]
#[allow(clippy::needless_lifetimes)]
pub fn payload(mut self, payload: &'a str) -> Self {
self.payload = payload;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_payload(&'a self) -> &'a &'a str {
&self.payload
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn provider_token(mut self, provider_token: &'a str) -> Self {
self.provider_token = Some(provider_token);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_provider_token(&'a self) -> &'a Option<&'a str> {
&self.provider_token
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Three-letter ISO 4217 currency code, see more on currencies. Pass \"XTR\" for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn currency(mut self, currency: &'a str) -> Self {
self.currency = currency;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_currency(&'a self) -> &'a &'a str {
&self.currency
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn prices(mut self, prices: &'a Vec<LabeledPrice>) -> Self {
self.prices = prices;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_prices(&'a self) -> &'a &'a Vec<LabeledPrice> {
&self.prices
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The number of seconds the subscription will be active for before the next payment. The currency must be set to \"XTR\" (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn subscription_period(mut self, subscription_period: i64) -> Self {
self.subscription_period = Some(subscription_period);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_subscription_period(&'a self) -> &'a Option<i64> {
&self.subscription_period
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn max_tip_amount(mut self, max_tip_amount: i64) -> Self {
self.max_tip_amount = Some(max_tip_amount);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_max_tip_amount(&'a self) -> &'a Option<i64> {
&self.max_tip_amount
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_tip_amounts(mut self, suggested_tip_amounts: &'a Vec<i64>) -> Self {
self.suggested_tip_amounts = Some(suggested_tip_amounts);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_tip_amounts(&'a self) -> &'a Option<&'a Vec<i64>> {
&self.suggested_tip_amounts
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider."]
#[allow(clippy::needless_lifetimes)]
pub fn provider_data(mut self, provider_data: &'a str) -> Self {
self.provider_data = Some(provider_data);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_provider_data(&'a self) -> &'a Option<&'a str> {
&self.provider_data
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service."]
#[allow(clippy::needless_lifetimes)]
pub fn photo_url(mut self, photo_url: &'a str) -> Self {
self.photo_url = Some(photo_url);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo_url(&'a self) -> &'a Option<&'a str> {
&self.photo_url
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Photo size in bytes"]
#[allow(clippy::needless_lifetimes)]
pub fn photo_size(mut self, photo_size: i64) -> Self {
self.photo_size = Some(photo_size);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo_size(&'a self) -> &'a Option<i64> {
&self.photo_size
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Photo width"]
#[allow(clippy::needless_lifetimes)]
pub fn photo_width(mut self, photo_width: i64) -> Self {
self.photo_width = Some(photo_width);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo_width(&'a self) -> &'a Option<i64> {
&self.photo_width
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Photo height"]
#[allow(clippy::needless_lifetimes)]
pub fn photo_height(mut self, photo_height: i64) -> Self {
self.photo_height = Some(photo_height);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo_height(&'a self) -> &'a Option<i64> {
&self.photo_height
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn need_name(mut self, need_name: bool) -> Self {
self.need_name = Some(need_name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_need_name(&'a self) -> &'a Option<bool> {
&self.need_name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn need_phone_number(mut self, need_phone_number: bool) -> Self {
self.need_phone_number = Some(need_phone_number);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_need_phone_number(&'a self) -> &'a Option<bool> {
&self.need_phone_number
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn need_email(mut self, need_email: bool) -> Self {
self.need_email = Some(need_email);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_need_email(&'a self) -> &'a Option<bool> {
&self.need_email
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn need_shipping_address(mut self, need_shipping_address: bool) -> Self {
self.need_shipping_address = Some(need_shipping_address);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_need_shipping_address(&'a self) -> &'a Option<bool> {
&self.need_shipping_address
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn send_phone_number_to_provider(mut self, send_phone_number_to_provider: bool) -> Self {
self.send_phone_number_to_provider = Some(send_phone_number_to_provider);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_send_phone_number_to_provider(&'a self) -> &'a Option<bool> {
&self.send_phone_number_to_provider
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn send_email_to_provider(mut self, send_email_to_provider: bool) -> Self {
self.send_email_to_provider = Some(send_email_to_provider);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_send_email_to_provider(&'a self) -> &'a Option<bool> {
&self.send_email_to_provider
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars."]
#[allow(clippy::needless_lifetimes)]
pub fn is_flexible(mut self, is_flexible: bool) -> Self {
self.is_flexible = Some(is_flexible);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_flexible(&'a self) -> &'a Option<bool> {
&self.is_flexible
}
pub async fn build(self) -> BotResult<String> {
self.bot
.create_invoice_link(
self.business_connection_id,
self.title,
self.description,
self.payload,
self.provider_token,
self.currency,
self.prices,
self.subscription_period,
self.max_tip_amount,
self.suggested_tip_amounts,
self.provider_data,
self.photo_url,
self.photo_size,
self.photo_width,
self.photo_height,
self.need_name,
self.need_phone_number,
self.need_email,
self.need_shipping_address,
self.send_phone_number_to_provider,
self.send_email_to_provider,
self.is_flexible,
)
.await
}
}
pub struct CallRepostStory<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
from_chat_id: i64,
from_story_id: i64,
active_period: i64,
post_to_chat_page: Option<bool>,
protect_content: Option<bool>,
}
impl<'a> CallRepostStory<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the chat which posted the story that should be reposted"]
#[allow(clippy::needless_lifetimes)]
pub fn from_chat_id(mut self, from_chat_id: i64) -> Self {
self.from_chat_id = from_chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_from_chat_id(&'a self) -> &'a i64 {
&self.from_chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the story that should be reposted"]
#[allow(clippy::needless_lifetimes)]
pub fn from_story_id(mut self, from_story_id: i64) -> Self {
self.from_story_id = from_story_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_from_story_id(&'a self) -> &'a i64 {
&self.from_story_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400"]
#[allow(clippy::needless_lifetimes)]
pub fn active_period(mut self, active_period: i64) -> Self {
self.active_period = active_period;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_active_period(&'a self) -> &'a i64 {
&self.active_period
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to keep the story accessible after it expires"]
#[allow(clippy::needless_lifetimes)]
pub fn post_to_chat_page(mut self, post_to_chat_page: bool) -> Self {
self.post_to_chat_page = Some(post_to_chat_page);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_post_to_chat_page(&'a self) -> &'a Option<bool> {
&self.post_to_chat_page
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the content of the story must be protected from forwarding and screenshotting"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
pub async fn build(self) -> BotResult<Story> {
self.bot
.repost_story(
self.business_connection_id,
self.from_chat_id,
self.from_story_id,
self.active_period,
self.post_to_chat_page,
self.protect_content,
)
.await
}
}
pub struct CallDeclineChatJoinRequest<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallDeclineChatJoinRequest<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.decline_chat_join_request(self.chat_id, self.user_id)
.await
}
}
pub struct CallRefundStarPayment<'a> {
bot: &'a Bot,
user_id: i64,
telegram_payment_charge_id: &'a str,
}
impl<'a> CallRefundStarPayment<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the user whose payment will be refunded"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Telegram payment identifier"]
#[allow(clippy::needless_lifetimes)]
pub fn telegram_payment_charge_id(mut self, telegram_payment_charge_id: &'a str) -> Self {
self.telegram_payment_charge_id = telegram_payment_charge_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_telegram_payment_charge_id(&'a self) -> &'a &'a str {
&self.telegram_payment_charge_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.refund_star_payment(self.user_id, self.telegram_payment_charge_id)
.await
}
}
pub struct CallSendMediaGroup<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
media: &'a Vec<EMedia>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
reply_parameters: Option<&'a ReplyParameters>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendMediaGroup<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized array describing messages to be sent, must include 2-10 items"]
#[allow(clippy::needless_lifetimes)]
pub fn media(mut self, media: &'a Vec<EMedia>) -> Self {
self.media = media;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_media(&'a self) -> &'a &'a Vec<EMedia> {
&self.media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends messages silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent messages from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
pub async fn build(self) -> BotResult<Vec<Message>> {
self.bot
.send_media_group(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.media,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.reply_parameters,
)
.await
}
}
pub struct CallVerifyChat<'a, V> {
bot: &'a Bot,
chat_id: V,
custom_description: Option<&'a str>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallVerifyChat<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername). Channel direct messages chats can't be verified."]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description."]
#[allow(clippy::needless_lifetimes)]
pub fn custom_description(mut self, custom_description: &'a str) -> Self {
self.custom_description = Some(custom_description);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_custom_description(&'a self) -> &'a Option<&'a str> {
&self.custom_description
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.verify_chat(self.chat_id, self.custom_description)
.await
}
}
pub struct CallSendMessageDraft<'a> {
bot: &'a Bot,
chat_id: i64,
message_thread_id: Option<i64>,
draft_id: i64,
text: &'a str,
parse_mode: Option<&'a str>,
entities: Option<&'a Vec<MessageEntity>>,
}
impl<'a> CallSendMessageDraft<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target private chat"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a i64 {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated"]
#[allow(clippy::needless_lifetimes)]
pub fn draft_id(mut self, draft_id: i64) -> Self {
self.draft_id = draft_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_draft_id(&'a self) -> &'a i64 {
&self.draft_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Text of the message to be sent, 1-4096 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn text(mut self, text: &'a str) -> Self {
self.text = text;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text(&'a self) -> &'a &'a str {
&self.text
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the message text. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn entities(mut self, entities: &'a Vec<MessageEntity>) -> Self {
self.entities = Some(entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.entities
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.send_message_draft(
self.chat_id,
self.message_thread_id,
self.draft_id,
self.text,
self.parse_mode,
self.entities,
)
.await
}
}
pub struct CallRestrictChatMember<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
permissions: &'a ChatPermissions,
use_independent_chat_permissions: Option<bool>,
until_date: Option<i64>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallRestrictChatMember<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for new user permissions"]
#[allow(clippy::needless_lifetimes)]
pub fn permissions<T>(mut self, permissions: T) -> Self
where
T: Into<&'a ChatPermissions>,
{
self.permissions = permissions.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_permissions(&'a self) -> &'a &'a ChatPermissions {
&self.permissions
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission."]
#[allow(clippy::needless_lifetimes)]
pub fn use_independent_chat_permissions(
mut self,
use_independent_chat_permissions: bool,
) -> Self {
self.use_independent_chat_permissions = Some(use_independent_chat_permissions);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_use_independent_chat_permissions(&'a self) -> &'a Option<bool> {
&self.use_independent_chat_permissions
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever"]
#[allow(clippy::needless_lifetimes)]
pub fn until_date(mut self, until_date: i64) -> Self {
self.until_date = Some(until_date);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_until_date(&'a self) -> &'a Option<i64> {
&self.until_date
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.restrict_chat_member(
self.chat_id,
self.user_id,
self.permissions,
self.use_independent_chat_permissions,
self.until_date,
)
.await
}
}
pub struct CallRemoveUserVerification<'a> {
bot: &'a Bot,
user_id: i64,
}
impl<'a> CallRemoveUserVerification<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.remove_user_verification(self.user_id).await
}
}
pub struct CallSendVideo<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
video: FileData,
duration: Option<i64>,
width: Option<i64>,
height: Option<i64>,
thumbnail: Option<FileData>,
cover: Option<FileData>,
start_timestamp: Option<i64>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
has_spoiler: Option<bool>,
supports_streaming: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendVideo<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn video(mut self, video: FileData) -> Self {
self.video = video;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_video(&'a self) -> &'a FileData {
&self.video
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Duration of sent video in seconds"]
#[allow(clippy::needless_lifetimes)]
pub fn duration(mut self, duration: i64) -> Self {
self.duration = Some(duration);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_duration(&'a self) -> &'a Option<i64> {
&self.duration
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Video width"]
#[allow(clippy::needless_lifetimes)]
pub fn width(mut self, width: i64) -> Self {
self.width = Some(width);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_width(&'a self) -> &'a Option<i64> {
&self.width
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Video height"]
#[allow(clippy::needless_lifetimes)]
pub fn height(mut self, height: i64) -> Self {
self.height = Some(height);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_height(&'a self) -> &'a Option<i64> {
&self.height
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
self.thumbnail = Some(thumbnail);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
&self.thumbnail
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass \"attach://<file_attach_name>\" to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn cover(mut self, cover: FileData) -> Self {
self.cover = Some(cover);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_cover(&'a self) -> &'a Option<FileData> {
&self.cover
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Start timestamp for the video in the message"]
#[allow(clippy::needless_lifetimes)]
pub fn start_timestamp(mut self, start_timestamp: i64) -> Self {
self.start_timestamp = Some(start_timestamp);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_start_timestamp(&'a self) -> &'a Option<i64> {
&self.start_timestamp
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the video caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the caption must be shown above the message media"]
#[allow(clippy::needless_lifetimes)]
pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
self.show_caption_above_media = Some(show_caption_above_media);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
&self.show_caption_above_media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the video needs to be covered with a spoiler animation"]
#[allow(clippy::needless_lifetimes)]
pub fn has_spoiler(mut self, has_spoiler: bool) -> Self {
self.has_spoiler = Some(has_spoiler);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_has_spoiler(&'a self) -> &'a Option<bool> {
&self.has_spoiler
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the uploaded video is suitable for streaming"]
#[allow(clippy::needless_lifetimes)]
pub fn supports_streaming(mut self, supports_streaming: bool) -> Self {
self.supports_streaming = Some(supports_streaming);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_supports_streaming(&'a self) -> &'a Option<bool> {
&self.supports_streaming
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_video(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.video,
self.duration,
self.width,
self.height,
self.thumbnail,
self.cover,
self.start_timestamp,
self.caption,
self.parse_mode,
self.caption_entities,
self.show_caption_above_media,
self.has_spoiler,
self.supports_streaming,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallUpgradeGift<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
owned_gift_id: &'a str,
keep_original_details: Option<bool>,
star_count: Option<i64>,
}
impl<'a> CallUpgradeGift<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the regular gift that should be upgraded to a unique one"]
#[allow(clippy::needless_lifetimes)]
pub fn owned_gift_id(mut self, owned_gift_id: &'a str) -> Self {
self.owned_gift_id = owned_gift_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_owned_gift_id(&'a self) -> &'a &'a str {
&self.owned_gift_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to keep the original gift text, sender and receiver in the upgraded gift"]
#[allow(clippy::needless_lifetimes)]
pub fn keep_original_details(mut self, keep_original_details: bool) -> Self {
self.keep_original_details = Some(keep_original_details);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_keep_original_details(&'a self) -> &'a Option<bool> {
&self.keep_original_details
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If gift.prepaid_upgrade_star_count > 0, then pass 0, otherwise, the can_transfer_stars business bot right is required and gift.upgrade_star_count must be passed."]
#[allow(clippy::needless_lifetimes)]
pub fn star_count(mut self, star_count: i64) -> Self {
self.star_count = Some(star_count);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_star_count(&'a self) -> &'a Option<i64> {
&self.star_count
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.upgrade_gift(
self.business_connection_id,
self.owned_gift_id,
self.keep_original_details,
self.star_count,
)
.await
}
}
pub struct CallCreateChatInviteLink<'a, V> {
bot: &'a Bot,
chat_id: V,
name: Option<&'a str>,
expire_date: Option<i64>,
member_limit: Option<i64>,
creates_join_request: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallCreateChatInviteLink<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Invite link name; 0-32 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = Some(name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a Option<&'a str> {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Point in time (Unix timestamp) when the link will expire"]
#[allow(clippy::needless_lifetimes)]
pub fn expire_date(mut self, expire_date: i64) -> Self {
self.expire_date = Some(expire_date);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_expire_date(&'a self) -> &'a Option<i64> {
&self.expire_date
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"]
#[allow(clippy::needless_lifetimes)]
pub fn member_limit(mut self, member_limit: i64) -> Self {
self.member_limit = Some(member_limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_member_limit(&'a self) -> &'a Option<i64> {
&self.member_limit
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified"]
#[allow(clippy::needless_lifetimes)]
pub fn creates_join_request(mut self, creates_join_request: bool) -> Self {
self.creates_join_request = Some(creates_join_request);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_creates_join_request(&'a self) -> &'a Option<bool> {
&self.creates_join_request
}
pub async fn build(self) -> BotResult<ChatInviteLink> {
self.bot
.create_chat_invite_link(
self.chat_id,
self.name,
self.expire_date,
self.member_limit,
self.creates_join_request,
)
.await
}
}
pub struct CallGetChat<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallGetChat<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<ChatFullInfo> {
self.bot.get_chat(self.chat_id).await
}
}
pub struct CallSendVideoNote<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
video_note: FileData,
duration: Option<i64>,
length: Option<i64>,
thumbnail: Option<FileData>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendVideoNote<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Sending video notes by a URL is currently unsupported"]
#[allow(clippy::needless_lifetimes)]
pub fn video_note(mut self, video_note: FileData) -> Self {
self.video_note = video_note;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_video_note(&'a self) -> &'a FileData {
&self.video_note
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Duration of sent video in seconds"]
#[allow(clippy::needless_lifetimes)]
pub fn duration(mut self, duration: i64) -> Self {
self.duration = Some(duration);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_duration(&'a self) -> &'a Option<i64> {
&self.duration
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Video width and height, i.e. diameter of the video message"]
#[allow(clippy::needless_lifetimes)]
pub fn length(mut self, length: i64) -> Self {
self.length = Some(length);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_length(&'a self) -> &'a Option<i64> {
&self.length
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
self.thumbnail = Some(thumbnail);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
&self.thumbnail
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_video_note(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.video_note,
self.duration,
self.length,
self.thumbnail,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallSendPoll<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
question: &'a str,
question_parse_mode: Option<&'a str>,
question_entities: Option<&'a Vec<MessageEntity>>,
options: &'a Vec<InputPollOption>,
is_anonymous: Option<bool>,
tg_type: Option<&'a str>,
allows_multiple_answers: Option<bool>,
allows_revoting: Option<bool>,
shuffle_options: Option<bool>,
allow_adding_options: Option<bool>,
hide_results_until_closes: Option<bool>,
correct_option_ids: Option<&'a Vec<i64>>,
explanation: Option<&'a str>,
explanation_parse_mode: Option<&'a str>,
explanation_entities: Option<&'a Vec<MessageEntity>>,
open_period: Option<i64>,
close_date: Option<i64>,
is_closed: Option<bool>,
description: Option<&'a str>,
description_parse_mode: Option<&'a str>,
description_entities: Option<&'a Vec<MessageEntity>>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendPoll<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername). Polls can't be sent to channel direct messages chats."]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Poll question, 1-300 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn question(mut self, question: &'a str) -> Self {
self.question = question;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_question(&'a self) -> &'a &'a str {
&self.question
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed"]
#[allow(clippy::needless_lifetimes)]
pub fn question_parse_mode(mut self, question_parse_mode: &'a str) -> Self {
self.question_parse_mode = Some(question_parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_question_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.question_parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn question_entities(mut self, question_entities: &'a Vec<MessageEntity>) -> Self {
self.question_entities = Some(question_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_question_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.question_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of 2-12 answer options"]
#[allow(clippy::needless_lifetimes)]
pub fn options(mut self, options: &'a Vec<InputPollOption>) -> Self {
self.options = options;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_options(&'a self) -> &'a &'a Vec<InputPollOption> {
&self.options
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "True, if the poll needs to be anonymous, defaults to True"]
#[allow(clippy::needless_lifetimes)]
pub fn is_anonymous(mut self, is_anonymous: bool) -> Self {
self.is_anonymous = Some(is_anonymous);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_anonymous(&'a self) -> &'a Option<bool> {
&self.is_anonymous
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Poll type, \"quiz\" or \"regular\", defaults to \"regular\""]
#[allow(clippy::needless_lifetimes)]
pub fn tg_type(mut self, tg_type: &'a str) -> Self {
self.tg_type = Some(tg_type);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_tg_type(&'a self) -> &'a Option<&'a str> {
&self.tg_type
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the poll allows multiple answers, defaults to False"]
#[allow(clippy::needless_lifetimes)]
pub fn allows_multiple_answers(mut self, allows_multiple_answers: bool) -> Self {
self.allows_multiple_answers = Some(allows_multiple_answers);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allows_multiple_answers(&'a self) -> &'a Option<bool> {
&self.allows_multiple_answers
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the poll allows to change chosen answer options, defaults to False for quizzes and to True for regular polls"]
#[allow(clippy::needless_lifetimes)]
pub fn allows_revoting(mut self, allows_revoting: bool) -> Self {
self.allows_revoting = Some(allows_revoting);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allows_revoting(&'a self) -> &'a Option<bool> {
&self.allows_revoting
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the poll options must be shown in random order"]
#[allow(clippy::needless_lifetimes)]
pub fn shuffle_options(mut self, shuffle_options: bool) -> Self {
self.shuffle_options = Some(shuffle_options);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_shuffle_options(&'a self) -> &'a Option<bool> {
&self.shuffle_options
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if answer options can be added to the poll after creation; not supported for anonymous polls and quizzes"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_adding_options(mut self, allow_adding_options: bool) -> Self {
self.allow_adding_options = Some(allow_adding_options);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_adding_options(&'a self) -> &'a Option<bool> {
&self.allow_adding_options
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if poll results must be shown only after the poll closes"]
#[allow(clippy::needless_lifetimes)]
pub fn hide_results_until_closes(mut self, hide_results_until_closes: bool) -> Self {
self.hide_results_until_closes = Some(hide_results_until_closes);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_hide_results_until_closes(&'a self) -> &'a Option<bool> {
&self.hide_results_until_closes
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of monotonically increasing 0-based identifiers of the correct answer options, required for polls in quiz mode"]
#[allow(clippy::needless_lifetimes)]
pub fn correct_option_ids(mut self, correct_option_ids: &'a Vec<i64>) -> Self {
self.correct_option_ids = Some(correct_option_ids);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_correct_option_ids(&'a self) -> &'a Option<&'a Vec<i64>> {
&self.correct_option_ids
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn explanation(mut self, explanation: &'a str) -> Self {
self.explanation = Some(explanation);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_explanation(&'a self) -> &'a Option<&'a str> {
&self.explanation
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the explanation. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn explanation_parse_mode(mut self, explanation_parse_mode: &'a str) -> Self {
self.explanation_parse_mode = Some(explanation_parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_explanation_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.explanation_parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn explanation_entities(mut self, explanation_entities: &'a Vec<MessageEntity>) -> Self {
self.explanation_entities = Some(explanation_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_explanation_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.explanation_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Amount of time in seconds the poll will be active after creation, 5-2628000. Can't be used together with close_date."]
#[allow(clippy::needless_lifetimes)]
pub fn open_period(mut self, open_period: i64) -> Self {
self.open_period = Some(open_period);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_open_period(&'a self) -> &'a Option<i64> {
&self.open_period
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 2628000 seconds in the future. Can't be used together with open_period."]
#[allow(clippy::needless_lifetimes)]
pub fn close_date(mut self, close_date: i64) -> Self {
self.close_date = Some(close_date);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_close_date(&'a self) -> &'a Option<i64> {
&self.close_date
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the poll needs to be immediately closed. This can be useful for poll preview."]
#[allow(clippy::needless_lifetimes)]
pub fn is_closed(mut self, is_closed: bool) -> Self {
self.is_closed = Some(is_closed);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_closed(&'a self) -> &'a Option<bool> {
&self.is_closed
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the poll to be sent, 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn description(mut self, description: &'a str) -> Self {
self.description = Some(description);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_description(&'a self) -> &'a Option<&'a str> {
&self.description
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the poll description. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn description_parse_mode(mut self, description_parse_mode: &'a str) -> Self {
self.description_parse_mode = Some(description_parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_description_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.description_parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the poll description, which can be specified instead of description_parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn description_entities(mut self, description_entities: &'a Vec<MessageEntity>) -> Self {
self.description_entities = Some(description_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_description_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.description_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_poll(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.question,
self.question_parse_mode,
self.question_entities,
self.options,
self.is_anonymous,
self.tg_type,
self.allows_multiple_answers,
self.allows_revoting,
self.shuffle_options,
self.allow_adding_options,
self.hide_results_until_closes,
self.correct_option_ids,
self.explanation,
self.explanation_parse_mode,
self.explanation_entities,
self.open_period,
self.close_date,
self.is_closed,
self.description,
self.description_parse_mode,
self.description_entities,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallEditMessageChecklist<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
chat_id: i64,
message_id: i64,
checklist: &'a InputChecklist,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a> CallEditMessageChecklist<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a i64 {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for the new checklist"]
#[allow(clippy::needless_lifetimes)]
pub fn checklist<T>(mut self, checklist: T) -> Self
where
T: Into<&'a InputChecklist>,
{
self.checklist = checklist.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_checklist(&'a self) -> &'a &'a InputChecklist {
&self.checklist
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for the new inline keyboard for the message"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.edit_message_checklist(
self.business_connection_id,
self.chat_id,
self.message_id,
self.checklist,
self.reply_markup,
)
.await
}
}
pub struct CallSendChecklist<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
chat_id: i64,
checklist: &'a InputChecklist,
disable_notification: Option<bool>,
protect_content: Option<bool>,
message_effect_id: Option<&'a str>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a> CallSendChecklist<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a i64 {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for the checklist to send"]
#[allow(clippy::needless_lifetimes)]
pub fn checklist<T>(mut self, checklist: T) -> Self
where
T: Into<&'a InputChecklist>,
{
self.checklist = checklist.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_checklist(&'a self) -> &'a &'a InputChecklist {
&self.checklist
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for an inline keyboard"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_checklist(
self.business_connection_id,
self.chat_id,
self.checklist,
self.disable_notification,
self.protect_content,
self.message_effect_id,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallGetUserProfileAudios<'a> {
bot: &'a Bot,
user_id: i64,
offset: Option<i64>,
limit: Option<i64>,
}
impl<'a> CallGetUserProfileAudios<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sequential number of the first audio to be returned. By default, all audios are returned."]
#[allow(clippy::needless_lifetimes)]
pub fn offset(mut self, offset: i64) -> Self {
self.offset = Some(offset);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_offset(&'a self) -> &'a Option<i64> {
&self.offset
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100."]
#[allow(clippy::needless_lifetimes)]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_limit(&'a self) -> &'a Option<i64> {
&self.limit
}
pub async fn build(self) -> BotResult<UserProfileAudios> {
self.bot
.get_user_profile_audios(self.user_id, self.offset, self.limit)
.await
}
}
pub struct CallGetAvailableGifts<'a> {
bot: &'a Bot,
}
impl<'a> CallGetAvailableGifts<'a> {
pub async fn build(self) -> BotResult<Gifts> {
self.bot.get_available_gifts().await
}
}
pub struct CallPromoteChatMember<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
is_anonymous: Option<bool>,
can_manage_chat: Option<bool>,
can_delete_messages: Option<bool>,
can_manage_video_chats: Option<bool>,
can_restrict_members: Option<bool>,
can_promote_members: Option<bool>,
can_change_info: Option<bool>,
can_invite_users: Option<bool>,
can_post_stories: Option<bool>,
can_edit_stories: Option<bool>,
can_delete_stories: Option<bool>,
can_post_messages: Option<bool>,
can_edit_messages: Option<bool>,
can_pin_messages: Option<bool>,
can_manage_topics: Option<bool>,
can_manage_direct_messages: Option<bool>,
can_manage_tags: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallPromoteChatMember<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator's presence in the chat is hidden"]
#[allow(clippy::needless_lifetimes)]
pub fn is_anonymous(mut self, is_anonymous: bool) -> Self {
self.is_anonymous = Some(is_anonymous);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_anonymous(&'a self) -> &'a Option<bool> {
&self.is_anonymous
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege."]
#[allow(clippy::needless_lifetimes)]
pub fn can_manage_chat(mut self, can_manage_chat: bool) -> Self {
self.can_manage_chat = Some(can_manage_chat);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_manage_chat(&'a self) -> &'a Option<bool> {
&self.can_manage_chat
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can delete messages of other users"]
#[allow(clippy::needless_lifetimes)]
pub fn can_delete_messages(mut self, can_delete_messages: bool) -> Self {
self.can_delete_messages = Some(can_delete_messages);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_delete_messages(&'a self) -> &'a Option<bool> {
&self.can_delete_messages
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can manage video chats"]
#[allow(clippy::needless_lifetimes)]
pub fn can_manage_video_chats(mut self, can_manage_video_chats: bool) -> Self {
self.can_manage_video_chats = Some(can_manage_video_chats);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_manage_video_chats(&'a self) -> &'a Option<bool> {
&self.can_manage_video_chats
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to True for promotions of channel administrators"]
#[allow(clippy::needless_lifetimes)]
pub fn can_restrict_members(mut self, can_restrict_members: bool) -> Self {
self.can_restrict_members = Some(can_restrict_members);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_restrict_members(&'a self) -> &'a Option<bool> {
&self.can_restrict_members
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)"]
#[allow(clippy::needless_lifetimes)]
pub fn can_promote_members(mut self, can_promote_members: bool) -> Self {
self.can_promote_members = Some(can_promote_members);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_promote_members(&'a self) -> &'a Option<bool> {
&self.can_promote_members
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can change chat title, photo and other settings"]
#[allow(clippy::needless_lifetimes)]
pub fn can_change_info(mut self, can_change_info: bool) -> Self {
self.can_change_info = Some(can_change_info);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_change_info(&'a self) -> &'a Option<bool> {
&self.can_change_info
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can invite new users to the chat"]
#[allow(clippy::needless_lifetimes)]
pub fn can_invite_users(mut self, can_invite_users: bool) -> Self {
self.can_invite_users = Some(can_invite_users);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_invite_users(&'a self) -> &'a Option<bool> {
&self.can_invite_users
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can post stories to the chat"]
#[allow(clippy::needless_lifetimes)]
pub fn can_post_stories(mut self, can_post_stories: bool) -> Self {
self.can_post_stories = Some(can_post_stories);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_post_stories(&'a self) -> &'a Option<bool> {
&self.can_post_stories
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive"]
#[allow(clippy::needless_lifetimes)]
pub fn can_edit_stories(mut self, can_edit_stories: bool) -> Self {
self.can_edit_stories = Some(can_edit_stories);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_edit_stories(&'a self) -> &'a Option<bool> {
&self.can_edit_stories
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can delete stories posted by other users"]
#[allow(clippy::needless_lifetimes)]
pub fn can_delete_stories(mut self, can_delete_stories: bool) -> Self {
self.can_delete_stories = Some(can_delete_stories);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_delete_stories(&'a self) -> &'a Option<bool> {
&self.can_delete_stories
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only"]
#[allow(clippy::needless_lifetimes)]
pub fn can_post_messages(mut self, can_post_messages: bool) -> Self {
self.can_post_messages = Some(can_post_messages);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_post_messages(&'a self) -> &'a Option<bool> {
&self.can_post_messages
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can edit messages of other users and can pin messages; for channels only"]
#[allow(clippy::needless_lifetimes)]
pub fn can_edit_messages(mut self, can_edit_messages: bool) -> Self {
self.can_edit_messages = Some(can_edit_messages);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_edit_messages(&'a self) -> &'a Option<bool> {
&self.can_edit_messages
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can pin messages; for supergroups only"]
#[allow(clippy::needless_lifetimes)]
pub fn can_pin_messages(mut self, can_pin_messages: bool) -> Self {
self.can_pin_messages = Some(can_pin_messages);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_pin_messages(&'a self) -> &'a Option<bool> {
&self.can_pin_messages
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"]
#[allow(clippy::needless_lifetimes)]
pub fn can_manage_topics(mut self, can_manage_topics: bool) -> Self {
self.can_manage_topics = Some(can_manage_topics);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_manage_topics(&'a self) -> &'a Option<bool> {
&self.can_manage_topics
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can manage direct messages within the channel and decline suggested posts; for channels only"]
#[allow(clippy::needless_lifetimes)]
pub fn can_manage_direct_messages(mut self, can_manage_direct_messages: bool) -> Self {
self.can_manage_direct_messages = Some(can_manage_direct_messages);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_manage_direct_messages(&'a self) -> &'a Option<bool> {
&self.can_manage_direct_messages
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the administrator can edit the tags of regular members; for groups and supergroups only"]
#[allow(clippy::needless_lifetimes)]
pub fn can_manage_tags(mut self, can_manage_tags: bool) -> Self {
self.can_manage_tags = Some(can_manage_tags);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_can_manage_tags(&'a self) -> &'a Option<bool> {
&self.can_manage_tags
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.promote_chat_member(
self.chat_id,
self.user_id,
self.is_anonymous,
self.can_manage_chat,
self.can_delete_messages,
self.can_manage_video_chats,
self.can_restrict_members,
self.can_promote_members,
self.can_change_info,
self.can_invite_users,
self.can_post_stories,
self.can_edit_stories,
self.can_delete_stories,
self.can_post_messages,
self.can_edit_messages,
self.can_pin_messages,
self.can_manage_topics,
self.can_manage_direct_messages,
self.can_manage_tags,
)
.await
}
}
pub struct CallPinChatMessage<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_id: i64,
disable_notification: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallPinChatMessage<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be pinned"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of a message to pin"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.pin_chat_message(
self.business_connection_id,
self.chat_id,
self.message_id,
self.disable_notification,
)
.await
}
}
pub struct CallSetStickerKeywords<'a> {
bot: &'a Bot,
sticker: &'a str,
keywords: Option<&'a Vec<String>>,
}
impl<'a> CallSetStickerKeywords<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "File identifier of the sticker"]
#[allow(clippy::needless_lifetimes)]
pub fn sticker(mut self, sticker: &'a str) -> Self {
self.sticker = sticker;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a &'a str {
&self.sticker
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn keywords(mut self, keywords: &'a Vec<String>) -> Self {
self.keywords = Some(keywords);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_keywords(&'a self) -> &'a Option<&'a Vec<String>> {
&self.keywords
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_sticker_keywords(self.sticker, self.keywords)
.await
}
}
pub struct CallDeleteForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread of the forum topic"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = message_thread_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a i64 {
&self.message_thread_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.delete_forum_topic(self.chat_id, self.message_thread_id)
.await
}
}
pub struct CallGetChatMenuButton<'a> {
bot: &'a Bot,
chat_id: Option<i64>,
}
impl<'a> CallGetChatMenuButton<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target private chat. If not specified, default bot's menu button will be returned"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<i64> {
&self.chat_id
}
pub async fn build(self) -> BotResult<MenuButton> {
self.bot.get_chat_menu_button(self.chat_id).await
}
}
pub struct CallGetForumTopicIconStickers<'a> {
bot: &'a Bot,
}
impl<'a> CallGetForumTopicIconStickers<'a> {
pub async fn build(self) -> BotResult<Vec<Sticker>> {
self.bot.get_forum_topic_icon_stickers().await
}
}
pub struct CallUnpinChatMessage<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_id: Option<i64>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallUnpinChatMessage<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be unpinned"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be unpinned."]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.unpin_chat_message(self.business_connection_id, self.chat_id, self.message_id)
.await
}
}
pub struct CallReplaceManagedBotToken<'a> {
bot: &'a Bot,
user_id: i64,
}
impl<'a> CallReplaceManagedBotToken<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier of the managed bot whose token will be replaced"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
pub async fn build(self) -> BotResult<String> {
self.bot.replace_managed_bot_token(self.user_id).await
}
}
pub struct CallSetChatDescription<'a, V> {
bot: &'a Bot,
chat_id: V,
description: Option<&'a str>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatDescription<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New chat description, 0-255 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn description(mut self, description: &'a str) -> Self {
self.description = Some(description);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_description(&'a self) -> &'a Option<&'a str> {
&self.description
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_chat_description(self.chat_id, self.description)
.await
}
}
pub struct CallCloseGeneralForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallCloseGeneralForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.close_general_forum_topic(self.chat_id).await
}
}
pub struct CallEditMessageText<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
text: &'a str,
parse_mode: Option<&'a str>,
entities: Option<&'a Vec<MessageEntity>>,
link_preview_options: Option<&'a LinkPreviewOptions>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageText<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<V> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
self.inline_message_id = Some(inline_message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
&self.inline_message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New text of the message, 1-4096 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn text(mut self, text: &'a str) -> Self {
self.text = text;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text(&'a self) -> &'a &'a str {
&self.text
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the message text. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn entities(mut self, entities: &'a Vec<MessageEntity>) -> Self {
self.entities = Some(entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Link preview generation options for the message"]
#[allow(clippy::needless_lifetimes)]
pub fn link_preview_options<T>(mut self, link_preview_options: T) -> Self
where
T: Into<&'a LinkPreviewOptions>,
{
self.link_preview_options = Some(link_preview_options.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_link_preview_options(&'a self) -> &'a Option<&'a LinkPreviewOptions> {
&self.link_preview_options
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for an inline keyboard."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<MessageBool> {
self.bot
.edit_message_text(
self.business_connection_id,
self.chat_id,
self.message_id,
self.inline_message_id,
self.text,
self.parse_mode,
self.entities,
self.link_preview_options,
self.reply_markup,
)
.await
}
}
pub struct CallRemoveBusinessAccountProfilePhoto<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
is_public: Option<bool>,
}
impl<'a> CallRemoveBusinessAccountProfilePhoto<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo."]
#[allow(clippy::needless_lifetimes)]
pub fn is_public(mut self, is_public: bool) -> Self {
self.is_public = Some(is_public);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_public(&'a self) -> &'a Option<bool> {
&self.is_public
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.remove_business_account_profile_photo(self.business_connection_id, self.is_public)
.await
}
}
pub struct CallReopenGeneralForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallReopenGeneralForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.reopen_general_forum_topic(self.chat_id).await
}
}
pub struct CallDeleteChatStickerSet<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallDeleteChatStickerSet<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.delete_chat_sticker_set(self.chat_id).await
}
}
pub struct CallSendMessage<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
text: &'a str,
parse_mode: Option<&'a str>,
entities: Option<&'a Vec<MessageEntity>>,
link_preview_options: Option<&'a LinkPreviewOptions>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendMessage<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Text of the message to be sent, 1-4096 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn text(mut self, text: &'a str) -> Self {
self.text = text;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text(&'a self) -> &'a &'a str {
&self.text
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the message text. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn entities(mut self, entities: &'a Vec<MessageEntity>) -> Self {
self.entities = Some(entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Link preview generation options for the message"]
#[allow(clippy::needless_lifetimes)]
pub fn link_preview_options<T>(mut self, link_preview_options: T) -> Self
where
T: Into<&'a LinkPreviewOptions>,
{
self.link_preview_options = Some(link_preview_options.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_link_preview_options(&'a self) -> &'a Option<&'a LinkPreviewOptions> {
&self.link_preview_options
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_message(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.text,
self.parse_mode,
self.entities,
self.link_preview_options,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallSavePreparedKeyboardButton<'a> {
bot: &'a Bot,
user_id: i64,
button: &'a KeyboardButton,
}
impl<'a> CallSavePreparedKeyboardButton<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user that can use the button"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object describing the button to be saved. The button must be of the type request_users, request_chat, or request_managed_bot"]
#[allow(clippy::needless_lifetimes)]
pub fn button<T>(mut self, button: T) -> Self
where
T: Into<&'a KeyboardButton>,
{
self.button = button.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_button(&'a self) -> &'a &'a KeyboardButton {
&self.button
}
pub async fn build(self) -> BotResult<PreparedKeyboardButton> {
self.bot
.save_prepared_keyboard_button(self.user_id, self.button)
.await
}
}
pub struct CallDeclineSuggestedPost<'a> {
bot: &'a Bot,
chat_id: i64,
message_id: i64,
comment: Option<&'a str>,
}
impl<'a> CallDeclineSuggestedPost<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a i64 {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of a suggested post message to decline"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Comment for the creator of the suggested post; 0-128 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn comment(mut self, comment: &'a str) -> Self {
self.comment = Some(comment);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_comment(&'a self) -> &'a Option<&'a str> {
&self.comment
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.decline_suggested_post(self.chat_id, self.message_id, self.comment)
.await
}
}
pub struct CallSavePreparedInlineMessage<'a> {
bot: &'a Bot,
user_id: i64,
result: &'a InlineQueryResult,
allow_user_chats: Option<bool>,
allow_bot_chats: Option<bool>,
allow_group_chats: Option<bool>,
allow_channel_chats: Option<bool>,
}
impl<'a> CallSavePreparedInlineMessage<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user that can use the prepared message"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object describing the message to be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn result<T>(mut self, result: T) -> Self
where
T: Into<&'a InlineQueryResult>,
{
self.result = result.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_result(&'a self) -> &'a &'a InlineQueryResult {
&self.result
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the message can be sent to private chats with users"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_user_chats(mut self, allow_user_chats: bool) -> Self {
self.allow_user_chats = Some(allow_user_chats);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_user_chats(&'a self) -> &'a Option<bool> {
&self.allow_user_chats
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the message can be sent to private chats with bots"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_bot_chats(mut self, allow_bot_chats: bool) -> Self {
self.allow_bot_chats = Some(allow_bot_chats);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_bot_chats(&'a self) -> &'a Option<bool> {
&self.allow_bot_chats
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the message can be sent to group and supergroup chats"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_group_chats(mut self, allow_group_chats: bool) -> Self {
self.allow_group_chats = Some(allow_group_chats);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_group_chats(&'a self) -> &'a Option<bool> {
&self.allow_group_chats
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the message can be sent to channel chats"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_channel_chats(mut self, allow_channel_chats: bool) -> Self {
self.allow_channel_chats = Some(allow_channel_chats);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_channel_chats(&'a self) -> &'a Option<bool> {
&self.allow_channel_chats
}
pub async fn build(self) -> BotResult<PreparedInlineMessage> {
self.bot
.save_prepared_inline_message(
self.user_id,
self.result,
self.allow_user_chats,
self.allow_bot_chats,
self.allow_group_chats,
self.allow_channel_chats,
)
.await
}
}
pub struct CallEditForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: i64,
name: Option<&'a str>,
icon_custom_emoji_id: Option<&'a str>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread of the forum topic"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = message_thread_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a i64 {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = Some(name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a Option<&'a str> {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept"]
#[allow(clippy::needless_lifetimes)]
pub fn icon_custom_emoji_id(mut self, icon_custom_emoji_id: &'a str) -> Self {
self.icon_custom_emoji_id = Some(icon_custom_emoji_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_icon_custom_emoji_id(&'a self) -> &'a Option<&'a str> {
&self.icon_custom_emoji_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.edit_forum_topic(
self.chat_id,
self.message_thread_id,
self.name,
self.icon_custom_emoji_id,
)
.await
}
}
pub struct CallSetWebhook<'a> {
bot: &'a Bot,
url: &'a str,
certificate: Option<FileData>,
ip_address: Option<&'a str>,
max_connections: Option<i64>,
allowed_updates: Option<&'a Vec<String>>,
drop_pending_updates: Option<bool>,
secret_token: Option<&'a str>,
}
impl<'a> CallSetWebhook<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "HTTPS URL to send updates to. Use an empty string to remove webhook integration"]
#[allow(clippy::needless_lifetimes)]
pub fn url(mut self, url: &'a str) -> Self {
self.url = url;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_url(&'a self) -> &'a &'a str {
&self.url
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details."]
#[allow(clippy::needless_lifetimes)]
pub fn certificate(mut self, certificate: FileData) -> Self {
self.certificate = Some(certificate);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_certificate(&'a self) -> &'a Option<FileData> {
&self.certificate
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS"]
#[allow(clippy::needless_lifetimes)]
pub fn ip_address(mut self, ip_address: &'a str) -> Self {
self.ip_address = Some(ip_address);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_ip_address(&'a self) -> &'a Option<&'a str> {
&self.ip_address
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput."]
#[allow(clippy::needless_lifetimes)]
pub fn max_connections(mut self, max_connections: i64) -> Self {
self.max_connections = Some(max_connections);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_max_connections(&'a self) -> &'a Option<i64> {
&self.max_connections
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time."]
#[allow(clippy::needless_lifetimes)]
pub fn allowed_updates(mut self, allowed_updates: &'a Vec<String>) -> Self {
self.allowed_updates = Some(allowed_updates);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allowed_updates(&'a self) -> &'a Option<&'a Vec<String>> {
&self.allowed_updates
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to drop all pending updates"]
#[allow(clippy::needless_lifetimes)]
pub fn drop_pending_updates(mut self, drop_pending_updates: bool) -> Self {
self.drop_pending_updates = Some(drop_pending_updates);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_drop_pending_updates(&'a self) -> &'a Option<bool> {
&self.drop_pending_updates
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A secret token to be sent in a header \"X-Telegram-Bot-Api-Secret-Token\" in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you."]
#[allow(clippy::needless_lifetimes)]
pub fn secret_token(mut self, secret_token: &'a str) -> Self {
self.secret_token = Some(secret_token);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_secret_token(&'a self) -> &'a Option<&'a str> {
&self.secret_token
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_webhook(
self.url,
self.certificate,
self.ip_address,
self.max_connections,
self.allowed_updates,
self.drop_pending_updates,
self.secret_token,
)
.await
}
}
pub struct CallSetUserEmojiStatus<'a> {
bot: &'a Bot,
user_id: i64,
emoji_status_custom_emoji_id: Option<&'a str>,
emoji_status_expiration_date: Option<i64>,
}
impl<'a> CallSetUserEmojiStatus<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status."]
#[allow(clippy::needless_lifetimes)]
pub fn emoji_status_custom_emoji_id(mut self, emoji_status_custom_emoji_id: &'a str) -> Self {
self.emoji_status_custom_emoji_id = Some(emoji_status_custom_emoji_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_emoji_status_custom_emoji_id(&'a self) -> &'a Option<&'a str> {
&self.emoji_status_custom_emoji_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Expiration date of the emoji status, if any"]
#[allow(clippy::needless_lifetimes)]
pub fn emoji_status_expiration_date(mut self, emoji_status_expiration_date: i64) -> Self {
self.emoji_status_expiration_date = Some(emoji_status_expiration_date);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_emoji_status_expiration_date(&'a self) -> &'a Option<i64> {
&self.emoji_status_expiration_date
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_user_emoji_status(
self.user_id,
self.emoji_status_custom_emoji_id,
self.emoji_status_expiration_date,
)
.await
}
}
pub struct CallGetBusinessAccountGifts<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
exclude_unsaved: Option<bool>,
exclude_saved: Option<bool>,
exclude_unlimited: Option<bool>,
exclude_limited_upgradable: Option<bool>,
exclude_limited_non_upgradable: Option<bool>,
exclude_unique: Option<bool>,
exclude_from_blockchain: Option<bool>,
sort_by_price: Option<bool>,
offset: Option<&'a str>,
limit: Option<i64>,
}
impl<'a> CallGetBusinessAccountGifts<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that aren't saved to the account's profile page"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_unsaved(mut self, exclude_unsaved: bool) -> Self {
self.exclude_unsaved = Some(exclude_unsaved);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_unsaved(&'a self) -> &'a Option<bool> {
&self.exclude_unsaved
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that are saved to the account's profile page"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_saved(mut self, exclude_saved: bool) -> Self {
self.exclude_saved = Some(exclude_saved);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_saved(&'a self) -> &'a Option<bool> {
&self.exclude_saved
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased an unlimited number of times"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_unlimited(mut self, exclude_unlimited: bool) -> Self {
self.exclude_unlimited = Some(exclude_unlimited);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_unlimited(&'a self) -> &'a Option<bool> {
&self.exclude_unlimited
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_limited_upgradable(mut self, exclude_limited_upgradable: bool) -> Self {
self.exclude_limited_upgradable = Some(exclude_limited_upgradable);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_limited_upgradable(&'a self) -> &'a Option<bool> {
&self.exclude_limited_upgradable
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_limited_non_upgradable(mut self, exclude_limited_non_upgradable: bool) -> Self {
self.exclude_limited_non_upgradable = Some(exclude_limited_non_upgradable);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_limited_non_upgradable(&'a self) -> &'a Option<bool> {
&self.exclude_limited_non_upgradable
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude unique gifts"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_unique(mut self, exclude_unique: bool) -> Self {
self.exclude_unique = Some(exclude_unique);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_unique(&'a self) -> &'a Option<bool> {
&self.exclude_unique
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_from_blockchain(mut self, exclude_from_blockchain: bool) -> Self {
self.exclude_from_blockchain = Some(exclude_from_blockchain);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_from_blockchain(&'a self) -> &'a Option<bool> {
&self.exclude_from_blockchain
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to sort results by gift price instead of send date. Sorting is applied before pagination."]
#[allow(clippy::needless_lifetimes)]
pub fn sort_by_price(mut self, sort_by_price: bool) -> Self {
self.sort_by_price = Some(sort_by_price);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sort_by_price(&'a self) -> &'a Option<bool> {
&self.sort_by_price
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results"]
#[allow(clippy::needless_lifetimes)]
pub fn offset(mut self, offset: &'a str) -> Self {
self.offset = Some(offset);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_offset(&'a self) -> &'a Option<&'a str> {
&self.offset
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum number of gifts to be returned; 1-100. Defaults to 100"]
#[allow(clippy::needless_lifetimes)]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_limit(&'a self) -> &'a Option<i64> {
&self.limit
}
pub async fn build(self) -> BotResult<OwnedGifts> {
self.bot
.get_business_account_gifts(
self.business_connection_id,
self.exclude_unsaved,
self.exclude_saved,
self.exclude_unlimited,
self.exclude_limited_upgradable,
self.exclude_limited_non_upgradable,
self.exclude_unique,
self.exclude_from_blockchain,
self.sort_by_price,
self.offset,
self.limit,
)
.await
}
}
pub struct CallSetChatAdministratorCustomTitle<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
custom_title: &'a str,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatAdministratorCustomTitle<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New custom title for the administrator; 0-16 characters, emoji are not allowed"]
#[allow(clippy::needless_lifetimes)]
pub fn custom_title(mut self, custom_title: &'a str) -> Self {
self.custom_title = custom_title;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_custom_title(&'a self) -> &'a &'a str {
&self.custom_title
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_chat_administrator_custom_title(self.chat_id, self.user_id, self.custom_title)
.await
}
}
pub struct CallEditGeneralForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
name: &'a str,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditGeneralForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New topic name, 1-128 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.edit_general_forum_topic(self.chat_id, self.name)
.await
}
}
pub struct CallGetMyDefaultAdministratorRights<'a> {
bot: &'a Bot,
for_channels: Option<bool>,
}
impl<'a> CallGetMyDefaultAdministratorRights<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned."]
#[allow(clippy::needless_lifetimes)]
pub fn for_channels(mut self, for_channels: bool) -> Self {
self.for_channels = Some(for_channels);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_for_channels(&'a self) -> &'a Option<bool> {
&self.for_channels
}
pub async fn build(self) -> BotResult<ChatAdministratorRights> {
self.bot
.get_my_default_administrator_rights(self.for_channels)
.await
}
}
pub struct CallSetMyProfilePhoto<'a> {
bot: &'a Bot,
photo: &'a InputProfilePhoto,
}
impl<'a> CallSetMyProfilePhoto<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The new profile photo to set"]
#[allow(clippy::needless_lifetimes)]
pub fn photo<T>(mut self, photo: T) -> Self
where
T: Into<&'a InputProfilePhoto>,
{
self.photo = photo.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo(&'a self) -> &'a &'a InputProfilePhoto {
&self.photo
}
pub async fn build(self) -> BotResult<bool> {
self.bot.set_my_profile_photo(self.photo).await
}
}
pub struct CallUnpinAllChatMessages<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallUnpinAllChatMessages<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.unpin_all_chat_messages(self.chat_id).await
}
}
pub struct CallSendAnimation<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
animation: FileData,
duration: Option<i64>,
width: Option<i64>,
height: Option<i64>,
thumbnail: Option<FileData>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
has_spoiler: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendAnimation<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn animation(mut self, animation: FileData) -> Self {
self.animation = animation;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_animation(&'a self) -> &'a FileData {
&self.animation
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Duration of sent animation in seconds"]
#[allow(clippy::needless_lifetimes)]
pub fn duration(mut self, duration: i64) -> Self {
self.duration = Some(duration);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_duration(&'a self) -> &'a Option<i64> {
&self.duration
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Animation width"]
#[allow(clippy::needless_lifetimes)]
pub fn width(mut self, width: i64) -> Self {
self.width = Some(width);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_width(&'a self) -> &'a Option<i64> {
&self.width
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Animation height"]
#[allow(clippy::needless_lifetimes)]
pub fn height(mut self, height: i64) -> Self {
self.height = Some(height);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_height(&'a self) -> &'a Option<i64> {
&self.height
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
self.thumbnail = Some(thumbnail);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
&self.thumbnail
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the animation caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the caption must be shown above the message media"]
#[allow(clippy::needless_lifetimes)]
pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
self.show_caption_above_media = Some(show_caption_above_media);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
&self.show_caption_above_media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the animation needs to be covered with a spoiler animation"]
#[allow(clippy::needless_lifetimes)]
pub fn has_spoiler(mut self, has_spoiler: bool) -> Self {
self.has_spoiler = Some(has_spoiler);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_has_spoiler(&'a self) -> &'a Option<bool> {
&self.has_spoiler
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_animation(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.animation,
self.duration,
self.width,
self.height,
self.thumbnail,
self.caption,
self.parse_mode,
self.caption_entities,
self.show_caption_above_media,
self.has_spoiler,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallSetMyDefaultAdministratorRights<'a> {
bot: &'a Bot,
rights: Option<&'a ChatAdministratorRights>,
for_channels: Option<bool>,
}
impl<'a> CallSetMyDefaultAdministratorRights<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared."]
#[allow(clippy::needless_lifetimes)]
pub fn rights<T>(mut self, rights: T) -> Self
where
T: Into<&'a ChatAdministratorRights>,
{
self.rights = Some(rights.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_rights(&'a self) -> &'a Option<&'a ChatAdministratorRights> {
&self.rights
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed."]
#[allow(clippy::needless_lifetimes)]
pub fn for_channels(mut self, for_channels: bool) -> Self {
self.for_channels = Some(for_channels);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_for_channels(&'a self) -> &'a Option<bool> {
&self.for_channels
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_my_default_administrator_rights(self.rights, self.for_channels)
.await
}
}
pub struct CallEditStory<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
story_id: i64,
content: &'a InputStoryContent,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
areas: Option<&'a Vec<StoryArea>>,
}
impl<'a> CallEditStory<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the story to edit"]
#[allow(clippy::needless_lifetimes)]
pub fn story_id(mut self, story_id: i64) -> Self {
self.story_id = story_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_story_id(&'a self) -> &'a i64 {
&self.story_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Content of the story"]
#[allow(clippy::needless_lifetimes)]
pub fn content<T>(mut self, content: T) -> Self
where
T: Into<&'a InputStoryContent>,
{
self.content = content.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_content(&'a self) -> &'a &'a InputStoryContent {
&self.content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Caption of the story, 0-2048 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the story caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of clickable areas to be shown on the story"]
#[allow(clippy::needless_lifetimes)]
pub fn areas(mut self, areas: &'a Vec<StoryArea>) -> Self {
self.areas = Some(areas);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_areas(&'a self) -> &'a Option<&'a Vec<StoryArea>> {
&self.areas
}
pub async fn build(self) -> BotResult<Story> {
self.bot
.edit_story(
self.business_connection_id,
self.story_id,
self.content,
self.caption,
self.parse_mode,
self.caption_entities,
self.areas,
)
.await
}
}
pub struct CallSendPhoto<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
photo: FileData,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
has_spoiler: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendPhoto<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn photo(mut self, photo: FileData) -> Self {
self.photo = photo;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo(&'a self) -> &'a FileData {
&self.photo
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the photo caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the caption must be shown above the message media"]
#[allow(clippy::needless_lifetimes)]
pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
self.show_caption_above_media = Some(show_caption_above_media);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
&self.show_caption_above_media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if the photo needs to be covered with a spoiler animation"]
#[allow(clippy::needless_lifetimes)]
pub fn has_spoiler(mut self, has_spoiler: bool) -> Self {
self.has_spoiler = Some(has_spoiler);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_has_spoiler(&'a self) -> &'a Option<bool> {
&self.has_spoiler
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_photo(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.photo,
self.caption,
self.parse_mode,
self.caption_entities,
self.show_caption_above_media,
self.has_spoiler,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallCreateNewStickerSet<'a> {
bot: &'a Bot,
user_id: i64,
name: &'a str,
title: &'a str,
stickers: &'a Vec<InputSticker>,
sticker_type: Option<&'a str>,
needs_repainting: Option<bool>,
}
impl<'a> CallCreateNewStickerSet<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier of created sticker set owner"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in \"_by_<bot_username>\". <bot_username> is case insensitive. 1-64 characters."]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker set title, 1-64 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn title(mut self, title: &'a str) -> Self {
self.title = title;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_title(&'a self) -> &'a &'a str {
&self.title
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of 1-50 initial stickers to be added to the sticker set"]
#[allow(clippy::needless_lifetimes)]
pub fn stickers(mut self, stickers: &'a Vec<InputSticker>) -> Self {
self.stickers = stickers;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_stickers(&'a self) -> &'a &'a Vec<InputSticker> {
&self.stickers
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Type of stickers in the set, pass \"regular\", \"mask\", or \"custom_emoji\". By default, a regular sticker set is created."]
#[allow(clippy::needless_lifetimes)]
pub fn sticker_type(mut self, sticker_type: &'a str) -> Self {
self.sticker_type = Some(sticker_type);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker_type(&'a self) -> &'a Option<&'a str> {
&self.sticker_type
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only"]
#[allow(clippy::needless_lifetimes)]
pub fn needs_repainting(mut self, needs_repainting: bool) -> Self {
self.needs_repainting = Some(needs_repainting);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_needs_repainting(&'a self) -> &'a Option<bool> {
&self.needs_repainting
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.create_new_sticker_set(
self.user_id,
self.name,
self.title,
self.stickers,
self.sticker_type,
self.needs_repainting,
)
.await
}
}
pub struct CallSendLocation<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
live_period: Option<i64>,
heading: Option<i64>,
proximity_alert_radius: Option<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendLocation<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Latitude of the location"]
#[allow(clippy::needless_lifetimes)]
pub fn latitude(mut self, latitude: ::ordered_float::OrderedFloat<f64>) -> Self {
self.latitude = latitude;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_latitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
&self.latitude
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Longitude of the location"]
#[allow(clippy::needless_lifetimes)]
pub fn longitude(mut self, longitude: ::ordered_float::OrderedFloat<f64>) -> Self {
self.longitude = longitude;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_longitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
&self.longitude
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The radius of uncertainty for the location, measured in meters; 0-1500"]
#[allow(clippy::needless_lifetimes)]
pub fn horizontal_accuracy(
mut self,
horizontal_accuracy: ::ordered_float::OrderedFloat<f64>,
) -> Self {
self.horizontal_accuracy = Some(horizontal_accuracy);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_horizontal_accuracy(&'a self) -> &'a Option<::ordered_float::OrderedFloat<f64>> {
&self.horizontal_accuracy
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Period in seconds during which the location will be updated (see Live Locations, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely."]
#[allow(clippy::needless_lifetimes)]
pub fn live_period(mut self, live_period: i64) -> Self {
self.live_period = Some(live_period);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_live_period(&'a self) -> &'a Option<i64> {
&self.live_period
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."]
#[allow(clippy::needless_lifetimes)]
pub fn heading(mut self, heading: i64) -> Self {
self.heading = Some(heading);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_heading(&'a self) -> &'a Option<i64> {
&self.heading
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."]
#[allow(clippy::needless_lifetimes)]
pub fn proximity_alert_radius(mut self, proximity_alert_radius: i64) -> Self {
self.proximity_alert_radius = Some(proximity_alert_radius);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_proximity_alert_radius(&'a self) -> &'a Option<i64> {
&self.proximity_alert_radius
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_location(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.latitude,
self.longitude,
self.horizontal_accuracy,
self.live_period,
self.heading,
self.proximity_alert_radius,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallGetStickerSet<'a> {
bot: &'a Bot,
name: &'a str,
}
impl<'a> CallGetStickerSet<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Name of the sticker set"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
pub async fn build(self) -> BotResult<StickerSet> {
self.bot.get_sticker_set(self.name).await
}
}
pub struct CallGetUserChatBoosts<'a, V> {
bot: &'a Bot,
chat_id: V,
user_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallGetUserChatBoosts<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the chat or username of the channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
pub async fn build(self) -> BotResult<UserChatBoosts> {
self.bot
.get_user_chat_boosts(self.chat_id, self.user_id)
.await
}
}
pub struct CallGetMyName<'a> {
bot: &'a Bot,
language_code: Option<&'a str>,
}
impl<'a> CallGetMyName<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code or an empty string"]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<BotName> {
self.bot.get_my_name(self.language_code).await
}
}
pub struct CallSetChatMenuButton<'a> {
bot: &'a Bot,
chat_id: Option<i64>,
menu_button: Option<&'a MenuButton>,
}
impl<'a> CallSetChatMenuButton<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target private chat. If not specified, default bot's menu button will be changed"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<i64> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for the bot's new menu button. Defaults to MenuButtonDefault"]
#[allow(clippy::needless_lifetimes)]
pub fn menu_button<T>(mut self, menu_button: T) -> Self
where
T: Into<&'a MenuButton>,
{
self.menu_button = Some(menu_button.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_menu_button(&'a self) -> &'a Option<&'a MenuButton> {
&self.menu_button
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_chat_menu_button(self.chat_id, self.menu_button)
.await
}
}
pub struct CallEditMessageLiveLocation<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
live_period: Option<i64>,
horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
heading: Option<i64>,
proximity_alert_radius: Option<i64>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageLiveLocation<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<V> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
self.inline_message_id = Some(inline_message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
&self.inline_message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Latitude of new location"]
#[allow(clippy::needless_lifetimes)]
pub fn latitude(mut self, latitude: ::ordered_float::OrderedFloat<f64>) -> Self {
self.latitude = latitude;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_latitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
&self.latitude
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Longitude of new location"]
#[allow(clippy::needless_lifetimes)]
pub fn longitude(mut self, longitude: ::ordered_float::OrderedFloat<f64>) -> Self {
self.longitude = longitude;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_longitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
&self.longitude
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current live_period by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then live_period remains unchanged"]
#[allow(clippy::needless_lifetimes)]
pub fn live_period(mut self, live_period: i64) -> Self {
self.live_period = Some(live_period);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_live_period(&'a self) -> &'a Option<i64> {
&self.live_period
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The radius of uncertainty for the location, measured in meters; 0-1500"]
#[allow(clippy::needless_lifetimes)]
pub fn horizontal_accuracy(
mut self,
horizontal_accuracy: ::ordered_float::OrderedFloat<f64>,
) -> Self {
self.horizontal_accuracy = Some(horizontal_accuracy);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_horizontal_accuracy(&'a self) -> &'a Option<::ordered_float::OrderedFloat<f64>> {
&self.horizontal_accuracy
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."]
#[allow(clippy::needless_lifetimes)]
pub fn heading(mut self, heading: i64) -> Self {
self.heading = Some(heading);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_heading(&'a self) -> &'a Option<i64> {
&self.heading
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."]
#[allow(clippy::needless_lifetimes)]
pub fn proximity_alert_radius(mut self, proximity_alert_radius: i64) -> Self {
self.proximity_alert_radius = Some(proximity_alert_radius);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_proximity_alert_radius(&'a self) -> &'a Option<i64> {
&self.proximity_alert_radius
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for a new inline keyboard."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<MessageBool> {
self.bot
.edit_message_live_location(
self.business_connection_id,
self.chat_id,
self.message_id,
self.inline_message_id,
self.latitude,
self.longitude,
self.live_period,
self.horizontal_accuracy,
self.heading,
self.proximity_alert_radius,
self.reply_markup,
)
.await
}
}
pub struct CallSetBusinessAccountBio<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
bio: Option<&'a str>,
}
impl<'a> CallSetBusinessAccountBio<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The new value of the bio for the business account; 0-140 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn bio(mut self, bio: &'a str) -> Self {
self.bio = Some(bio);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_bio(&'a self) -> &'a Option<&'a str> {
&self.bio
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_business_account_bio(self.business_connection_id, self.bio)
.await
}
}
pub struct CallConvertGiftToStars<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
owned_gift_id: &'a str,
}
impl<'a> CallConvertGiftToStars<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the regular gift that should be converted to Telegram Stars"]
#[allow(clippy::needless_lifetimes)]
pub fn owned_gift_id(mut self, owned_gift_id: &'a str) -> Self {
self.owned_gift_id = owned_gift_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_owned_gift_id(&'a self) -> &'a &'a str {
&self.owned_gift_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.convert_gift_to_stars(self.business_connection_id, self.owned_gift_id)
.await
}
}
pub struct CallSendContact<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
phone_number: &'a str,
first_name: &'a str,
last_name: Option<&'a str>,
vcard: Option<&'a str>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendContact<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Contact's phone number"]
#[allow(clippy::needless_lifetimes)]
pub fn phone_number(mut self, phone_number: &'a str) -> Self {
self.phone_number = phone_number;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_phone_number(&'a self) -> &'a &'a str {
&self.phone_number
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Contact's first name"]
#[allow(clippy::needless_lifetimes)]
pub fn first_name(mut self, first_name: &'a str) -> Self {
self.first_name = first_name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_first_name(&'a self) -> &'a &'a str {
&self.first_name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Contact's last name"]
#[allow(clippy::needless_lifetimes)]
pub fn last_name(mut self, last_name: &'a str) -> Self {
self.last_name = Some(last_name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_last_name(&'a self) -> &'a Option<&'a str> {
&self.last_name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional data about the contact in the form of a vCard, 0-2048 bytes"]
#[allow(clippy::needless_lifetimes)]
pub fn vcard(mut self, vcard: &'a str) -> Self {
self.vcard = Some(vcard);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_vcard(&'a self) -> &'a Option<&'a str> {
&self.vcard
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_contact(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.phone_number,
self.first_name,
self.last_name,
self.vcard,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallDeleteStickerFromSet<'a> {
bot: &'a Bot,
sticker: &'a str,
}
impl<'a> CallDeleteStickerFromSet<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "File identifier of the sticker"]
#[allow(clippy::needless_lifetimes)]
pub fn sticker(mut self, sticker: &'a str) -> Self {
self.sticker = sticker;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a &'a str {
&self.sticker
}
pub async fn build(self) -> BotResult<bool> {
self.bot.delete_sticker_from_set(self.sticker).await
}
}
pub struct CallSetStickerSetThumbnail<'a> {
bot: &'a Bot,
name: &'a str,
user_id: i64,
thumbnail: Option<FileData>,
format: &'a str,
}
impl<'a> CallSetStickerSetThumbnail<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker set name"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier of the sticker set owner"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail."]
#[allow(clippy::needless_lifetimes)]
pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
self.thumbnail = Some(thumbnail);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
&self.thumbnail
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Format of the thumbnail, must be one of \"static\" for a .WEBP or .PNG image, \"animated\" for a .TGS animation, or \"video\" for a .WEBM video"]
#[allow(clippy::needless_lifetimes)]
pub fn format(mut self, format: &'a str) -> Self {
self.format = format;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_format(&'a self) -> &'a &'a str {
&self.format
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_sticker_set_thumbnail(self.name, self.user_id, self.thumbnail, self.format)
.await
}
}
pub struct CallSetCustomEmojiStickerSetThumbnail<'a> {
bot: &'a Bot,
name: &'a str,
custom_emoji_id: Option<&'a str>,
}
impl<'a> CallSetCustomEmojiStickerSetThumbnail<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker set name"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail."]
#[allow(clippy::needless_lifetimes)]
pub fn custom_emoji_id(mut self, custom_emoji_id: &'a str) -> Self {
self.custom_emoji_id = Some(custom_emoji_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_custom_emoji_id(&'a self) -> &'a Option<&'a str> {
&self.custom_emoji_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_custom_emoji_sticker_set_thumbnail(self.name, self.custom_emoji_id)
.await
}
}
pub struct CallSetStickerSetTitle<'a> {
bot: &'a Bot,
name: &'a str,
title: &'a str,
}
impl<'a> CallSetStickerSetTitle<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker set name"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a &'a str {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker set title, 1-64 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn title(mut self, title: &'a str) -> Self {
self.title = title;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_title(&'a self) -> &'a &'a str {
&self.title
}
pub async fn build(self) -> BotResult<bool> {
self.bot.set_sticker_set_title(self.name, self.title).await
}
}
pub struct CallAnswerInlineQuery<'a> {
bot: &'a Bot,
inline_query_id: &'a str,
results: &'a Vec<InlineQueryResult>,
cache_time: Option<i64>,
is_personal: Option<bool>,
next_offset: Option<&'a str>,
button: Option<&'a InlineQueryResultsButton>,
}
impl<'a> CallAnswerInlineQuery<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the answered query"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_query_id(mut self, inline_query_id: &'a str) -> Self {
self.inline_query_id = inline_query_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_query_id(&'a self) -> &'a &'a str {
&self.inline_query_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized array of results for the inline query"]
#[allow(clippy::needless_lifetimes)]
pub fn results(mut self, results: &'a Vec<InlineQueryResult>) -> Self {
self.results = results;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_results(&'a self) -> &'a &'a Vec<InlineQueryResult> {
&self.results
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300."]
#[allow(clippy::needless_lifetimes)]
pub fn cache_time(mut self, cache_time: i64) -> Self {
self.cache_time = Some(cache_time);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_cache_time(&'a self) -> &'a Option<i64> {
&self.cache_time
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query."]
#[allow(clippy::needless_lifetimes)]
pub fn is_personal(mut self, is_personal: bool) -> Self {
self.is_personal = Some(is_personal);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_personal(&'a self) -> &'a Option<bool> {
&self.is_personal
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes."]
#[allow(clippy::needless_lifetimes)]
pub fn next_offset(mut self, next_offset: &'a str) -> Self {
self.next_offset = Some(next_offset);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_next_offset(&'a self) -> &'a Option<&'a str> {
&self.next_offset
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object describing a button to be shown above inline query results"]
#[allow(clippy::needless_lifetimes)]
pub fn button<T>(mut self, button: T) -> Self
where
T: Into<&'a InlineQueryResultsButton>,
{
self.button = Some(button.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_button(&'a self) -> &'a Option<&'a InlineQueryResultsButton> {
&self.button
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.answer_inline_query(
self.inline_query_id,
self.results,
self.cache_time,
self.is_personal,
self.next_offset,
self.button,
)
.await
}
}
pub struct CallGetBusinessConnection<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
}
impl<'a> CallGetBusinessConnection<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
pub async fn build(self) -> BotResult<BusinessConnection> {
self.bot
.get_business_connection(self.business_connection_id)
.await
}
}
pub struct CallSetBusinessAccountName<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
first_name: &'a str,
last_name: Option<&'a str>,
}
impl<'a> CallSetBusinessAccountName<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The new value of the first name for the business account; 1-64 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn first_name(mut self, first_name: &'a str) -> Self {
self.first_name = first_name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_first_name(&'a self) -> &'a &'a str {
&self.first_name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The new value of the last name for the business account; 0-64 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn last_name(mut self, last_name: &'a str) -> Self {
self.last_name = Some(last_name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_last_name(&'a self) -> &'a Option<&'a str> {
&self.last_name
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_business_account_name(self.business_connection_id, self.first_name, self.last_name)
.await
}
}
pub struct CallEditMessageMedia<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
media: &'a InputMedia,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditMessageMedia<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<V> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Identifier of the message to edit"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
self.inline_message_id = Some(inline_message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
&self.inline_message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for a new media content of the message"]
#[allow(clippy::needless_lifetimes)]
pub fn media<T>(mut self, media: T) -> Self
where
T: Into<&'a InputMedia>,
{
self.media = media.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_media(&'a self) -> &'a &'a InputMedia {
&self.media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for a new inline keyboard."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<MessageBool> {
self.bot
.edit_message_media(
self.business_connection_id,
self.chat_id,
self.message_id,
self.inline_message_id,
self.media,
self.reply_markup,
)
.await
}
}
pub struct CallUnhideGeneralForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallUnhideGeneralForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.unhide_general_forum_topic(self.chat_id).await
}
}
pub struct CallSetMyShortDescription<'a> {
bot: &'a Bot,
short_description: Option<&'a str>,
language_code: Option<&'a str>,
}
impl<'a> CallSetMyShortDescription<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language."]
#[allow(clippy::needless_lifetimes)]
pub fn short_description(mut self, short_description: &'a str) -> Self {
self.short_description = Some(short_description);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_short_description(&'a self) -> &'a Option<&'a str> {
&self.short_description
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description."]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_my_short_description(self.short_description, self.language_code)
.await
}
}
pub struct CallStopPoll<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_id: i64,
reply_markup: Option<&'a InlineKeyboardMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallStopPoll<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message to be edited was sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the original message with the poll"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object for a new message inline keyboard."]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a InlineKeyboardMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a InlineKeyboardMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Poll> {
self.bot
.stop_poll(
self.business_connection_id,
self.chat_id,
self.message_id,
self.reply_markup,
)
.await
}
}
pub struct CallClose<'a> {
bot: &'a Bot,
}
impl<'a> CallClose<'a> {
pub async fn build(self) -> BotResult<bool> {
self.bot.close().await
}
}
pub struct CallSetMessageReaction<'a, V> {
bot: &'a Bot,
chat_id: V,
message_id: i64,
reaction: Option<&'a Vec<ReactionType>>,
is_big: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSetMessageReaction<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead."]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots."]
#[allow(clippy::needless_lifetimes)]
pub fn reaction(mut self, reaction: &'a Vec<ReactionType>) -> Self {
self.reaction = Some(reaction);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reaction(&'a self) -> &'a Option<&'a Vec<ReactionType>> {
&self.reaction
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to set the reaction with a big animation"]
#[allow(clippy::needless_lifetimes)]
pub fn is_big(mut self, is_big: bool) -> Self {
self.is_big = Some(is_big);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_big(&'a self) -> &'a Option<bool> {
&self.is_big
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_message_reaction(self.chat_id, self.message_id, self.reaction, self.is_big)
.await
}
}
pub struct CallGetMe<'a> {
bot: &'a Bot,
}
impl<'a> CallGetMe<'a> {
pub async fn build(self) -> BotResult<User> {
self.bot.get_me().await
}
}
pub struct CallEditChatSubscriptionInviteLink<'a, V> {
bot: &'a Bot,
chat_id: V,
invite_link: &'a str,
name: Option<&'a str>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallEditChatSubscriptionInviteLink<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The invite link to edit"]
#[allow(clippy::needless_lifetimes)]
pub fn invite_link(mut self, invite_link: &'a str) -> Self {
self.invite_link = invite_link;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_invite_link(&'a self) -> &'a &'a str {
&self.invite_link
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Invite link name; 0-32 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = Some(name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a Option<&'a str> {
&self.name
}
pub async fn build(self) -> BotResult<ChatInviteLink> {
self.bot
.edit_chat_subscription_invite_link(self.chat_id, self.invite_link, self.name)
.await
}
}
pub struct CallSendDice<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
emoji: Option<&'a str>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendDice<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Emoji on which the dice throw animation is based. Currently, must be one of \"🎲\", \"🎯\", \"🏀\", \"⚽\", \"🎳\", or \"🎰\". Dice can have values 1-6 for \"🎲\", \"🎯\" and \"🎳\", values 1-5 for \"🏀\" and \"⚽\", and values 1-64 for \"🎰\". Defaults to \"🎲\""]
#[allow(clippy::needless_lifetimes)]
pub fn emoji(mut self, emoji: &'a str) -> Self {
self.emoji = Some(emoji);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_emoji(&'a self) -> &'a Option<&'a str> {
&self.emoji
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_dice(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.emoji,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallSendAudio<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
audio: FileData,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
duration: Option<i64>,
performer: Option<&'a str>,
title: Option<&'a str>,
thumbnail: Option<FileData>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendAudio<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn audio(mut self, audio: FileData) -> Self {
self.audio = audio;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_audio(&'a self) -> &'a FileData {
&self.audio
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Audio caption, 0-1024 characters after entities parsing"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the audio caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Duration of the audio in seconds"]
#[allow(clippy::needless_lifetimes)]
pub fn duration(mut self, duration: i64) -> Self {
self.duration = Some(duration);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_duration(&'a self) -> &'a Option<i64> {
&self.duration
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Performer"]
#[allow(clippy::needless_lifetimes)]
pub fn performer(mut self, performer: &'a str) -> Self {
self.performer = Some(performer);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_performer(&'a self) -> &'a Option<&'a str> {
&self.performer
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Track name"]
#[allow(clippy::needless_lifetimes)]
pub fn title(mut self, title: &'a str) -> Self {
self.title = Some(title);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_title(&'a self) -> &'a Option<&'a str> {
&self.title
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass \"attach://<file_attach_name>\" if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn thumbnail(mut self, thumbnail: FileData) -> Self {
self.thumbnail = Some(thumbnail);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_thumbnail(&'a self) -> &'a Option<FileData> {
&self.thumbnail
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_audio(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.audio,
self.caption,
self.parse_mode,
self.caption_entities,
self.duration,
self.performer,
self.title,
self.thumbnail,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallTransferGift<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
owned_gift_id: &'a str,
new_owner_chat_id: i64,
star_count: Option<i64>,
}
impl<'a> CallTransferGift<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the regular gift that should be transferred"]
#[allow(clippy::needless_lifetimes)]
pub fn owned_gift_id(mut self, owned_gift_id: &'a str) -> Self {
self.owned_gift_id = owned_gift_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_owned_gift_id(&'a self) -> &'a &'a str {
&self.owned_gift_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours."]
#[allow(clippy::needless_lifetimes)]
pub fn new_owner_chat_id(mut self, new_owner_chat_id: i64) -> Self {
self.new_owner_chat_id = new_owner_chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_new_owner_chat_id(&'a self) -> &'a i64 {
&self.new_owner_chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the can_transfer_stars business bot right is required."]
#[allow(clippy::needless_lifetimes)]
pub fn star_count(mut self, star_count: i64) -> Self {
self.star_count = Some(star_count);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_star_count(&'a self) -> &'a Option<i64> {
&self.star_count
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.transfer_gift(
self.business_connection_id,
self.owned_gift_id,
self.new_owner_chat_id,
self.star_count,
)
.await
}
}
pub struct CallRemoveChatVerification<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallRemoveChatVerification<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.remove_chat_verification(self.chat_id).await
}
}
pub struct CallCopyMessage<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_id: i64,
video_start_timestamp: Option<i64>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallCopyMessage<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn from_chat_id(mut self, from_chat_id: V) -> Self {
self.from_chat_id = from_chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_from_chat_id(&'a self) -> &'a V {
&self.from_chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Message identifier in the chat specified in from_chat_id"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New start timestamp for the copied video in the message"]
#[allow(clippy::needless_lifetimes)]
pub fn video_start_timestamp(mut self, video_start_timestamp: i64) -> Self {
self.video_start_timestamp = Some(video_start_timestamp);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_video_start_timestamp(&'a self) -> &'a Option<i64> {
&self.video_start_timestamp
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept"]
#[allow(clippy::needless_lifetimes)]
pub fn caption(mut self, caption: &'a str) -> Self {
self.caption = Some(caption);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption(&'a self) -> &'a Option<&'a str> {
&self.caption
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the new caption. See formatting options for more details."]
#[allow(clippy::needless_lifetimes)]
pub fn parse_mode(mut self, parse_mode: &'a str) -> Self {
self.parse_mode = Some(parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode"]
#[allow(clippy::needless_lifetimes)]
pub fn caption_entities(mut self, caption_entities: &'a Vec<MessageEntity>) -> Self {
self.caption_entities = Some(caption_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_caption_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.caption_entities
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified."]
#[allow(clippy::needless_lifetimes)]
pub fn show_caption_above_media(mut self, show_caption_above_media: bool) -> Self {
self.show_caption_above_media = Some(show_caption_above_media);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_show_caption_above_media(&'a self) -> &'a Option<bool> {
&self.show_caption_above_media
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; only available when copying to private chats"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<MessageId> {
self.bot
.copy_message(
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.from_chat_id,
self.message_id,
self.video_start_timestamp,
self.caption,
self.parse_mode,
self.caption_entities,
self.show_caption_above_media,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallGetGameHighScores<'a> {
bot: &'a Bot,
user_id: i64,
chat_id: Option<i64>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
}
impl<'a> CallGetGameHighScores<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Target user id"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Unique identifier for the target chat"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<i64> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if inline_message_id is not specified. Identifier of the sent message"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = Some(message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a Option<i64> {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id and message_id are not specified. Identifier of the inline message"]
#[allow(clippy::needless_lifetimes)]
pub fn inline_message_id(mut self, inline_message_id: &'a str) -> Self {
self.inline_message_id = Some(inline_message_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_inline_message_id(&'a self) -> &'a Option<&'a str> {
&self.inline_message_id
}
pub async fn build(self) -> BotResult<Vec<GameHighScore>> {
self.bot
.get_game_high_scores(
self.user_id,
self.chat_id,
self.message_id,
self.inline_message_id,
)
.await
}
}
pub struct CallSendVenue<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
title: &'a str,
address: &'a str,
foursquare_id: Option<&'a str>,
foursquare_type: Option<&'a str>,
google_place_id: Option<&'a str>,
google_place_type: Option<&'a str>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendVenue<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Latitude of the venue"]
#[allow(clippy::needless_lifetimes)]
pub fn latitude(mut self, latitude: ::ordered_float::OrderedFloat<f64>) -> Self {
self.latitude = latitude;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_latitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
&self.latitude
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Longitude of the venue"]
#[allow(clippy::needless_lifetimes)]
pub fn longitude(mut self, longitude: ::ordered_float::OrderedFloat<f64>) -> Self {
self.longitude = longitude;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_longitude(&'a self) -> &'a ::ordered_float::OrderedFloat<f64> {
&self.longitude
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Name of the venue"]
#[allow(clippy::needless_lifetimes)]
pub fn title(mut self, title: &'a str) -> Self {
self.title = title;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_title(&'a self) -> &'a &'a str {
&self.title
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Address of the venue"]
#[allow(clippy::needless_lifetimes)]
pub fn address(mut self, address: &'a str) -> Self {
self.address = address;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_address(&'a self) -> &'a &'a str {
&self.address
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Foursquare identifier of the venue"]
#[allow(clippy::needless_lifetimes)]
pub fn foursquare_id(mut self, foursquare_id: &'a str) -> Self {
self.foursquare_id = Some(foursquare_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_foursquare_id(&'a self) -> &'a Option<&'a str> {
&self.foursquare_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Foursquare type of the venue, if known. (For example, \"arts_entertainment/default\", \"arts_entertainment/aquarium\" or \"food/icecream\".)"]
#[allow(clippy::needless_lifetimes)]
pub fn foursquare_type(mut self, foursquare_type: &'a str) -> Self {
self.foursquare_type = Some(foursquare_type);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_foursquare_type(&'a self) -> &'a Option<&'a str> {
&self.foursquare_type
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Google Places identifier of the venue"]
#[allow(clippy::needless_lifetimes)]
pub fn google_place_id(mut self, google_place_id: &'a str) -> Self {
self.google_place_id = Some(google_place_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_google_place_id(&'a self) -> &'a Option<&'a str> {
&self.google_place_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Google Places type of the venue. (See supported types.)"]
#[allow(clippy::needless_lifetimes)]
pub fn google_place_type(mut self, google_place_type: &'a str) -> Self {
self.google_place_type = Some(google_place_type);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_google_place_type(&'a self) -> &'a Option<&'a str> {
&self.google_place_type
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_venue(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.latitude,
self.longitude,
self.title,
self.address,
self.foursquare_id,
self.foursquare_type,
self.google_place_id,
self.google_place_type,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallUnpinAllForumTopicMessages<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallUnpinAllForumTopicMessages<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread of the forum topic"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = message_thread_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a i64 {
&self.message_thread_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.unpin_all_forum_topic_messages(self.chat_id, self.message_thread_id)
.await
}
}
pub struct CallAnswerWebAppQuery<'a> {
bot: &'a Bot,
web_app_query_id: &'a str,
result: &'a InlineQueryResult,
}
impl<'a> CallAnswerWebAppQuery<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the query to be answered"]
#[allow(clippy::needless_lifetimes)]
pub fn web_app_query_id(mut self, web_app_query_id: &'a str) -> Self {
self.web_app_query_id = web_app_query_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_web_app_query_id(&'a self) -> &'a &'a str {
&self.web_app_query_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object describing the message to be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn result<T>(mut self, result: T) -> Self
where
T: Into<&'a InlineQueryResult>,
{
self.result = result.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_result(&'a self) -> &'a &'a InlineQueryResult {
&self.result
}
pub async fn build(self) -> BotResult<SentWebAppMessage> {
self.bot
.answer_web_app_query(self.web_app_query_id, self.result)
.await
}
}
pub struct CallUnbanChatSenderChat<'a, V> {
bot: &'a Bot,
chat_id: V,
sender_chat_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallUnbanChatSenderChat<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target sender chat"]
#[allow(clippy::needless_lifetimes)]
pub fn sender_chat_id(mut self, sender_chat_id: i64) -> Self {
self.sender_chat_id = sender_chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sender_chat_id(&'a self) -> &'a i64 {
&self.sender_chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.unban_chat_sender_chat(self.chat_id, self.sender_chat_id)
.await
}
}
pub struct CallAnswerShippingQuery<'a> {
bot: &'a Bot,
shipping_query_id: &'a str,
ok: bool,
shipping_options: Option<&'a Vec<ShippingOption>>,
error_message: Option<&'a str>,
}
impl<'a> CallAnswerShippingQuery<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the query to be answered"]
#[allow(clippy::needless_lifetimes)]
pub fn shipping_query_id(mut self, shipping_query_id: &'a str) -> Self {
self.shipping_query_id = shipping_query_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_shipping_query_id(&'a self) -> &'a &'a str {
&self.shipping_query_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)"]
#[allow(clippy::needless_lifetimes)]
pub fn ok(mut self, ok: bool) -> Self {
self.ok = ok;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_ok(&'a self) -> &'a bool {
&self.ok
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if ok is True. A JSON-serialized array of available shipping options."]
#[allow(clippy::needless_lifetimes)]
pub fn shipping_options(mut self, shipping_options: &'a Vec<ShippingOption>) -> Self {
self.shipping_options = Some(shipping_options);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_shipping_options(&'a self) -> &'a Option<&'a Vec<ShippingOption>> {
&self.shipping_options
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. \"Sorry, delivery to your desired address is unavailable\"). Telegram will display this message to the user."]
#[allow(clippy::needless_lifetimes)]
pub fn error_message(mut self, error_message: &'a str) -> Self {
self.error_message = Some(error_message);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_error_message(&'a self) -> &'a Option<&'a str> {
&self.error_message
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.answer_shipping_query(
self.shipping_query_id,
self.ok,
self.shipping_options,
self.error_message,
)
.await
}
}
pub struct CallGetMyStarBalance<'a> {
bot: &'a Bot,
}
impl<'a> CallGetMyStarBalance<'a> {
pub async fn build(self) -> BotResult<StarAmount> {
self.bot.get_my_star_balance().await
}
}
pub struct CallSendGift<'a, V> {
bot: &'a Bot,
user_id: Option<i64>,
chat_id: Option<V>,
gift_id: &'a str,
pay_for_upgrade: Option<bool>,
text: Option<&'a str>,
text_parse_mode: Option<&'a str>,
text_entities: Option<&'a Vec<MessageEntity>>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendGift<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if chat_id is not specified. Unique identifier of the target user who will receive the gift."]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = Some(user_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a Option<i64> {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift."]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = Some(chat_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a Option<V> {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the gift; limited gifts can't be sent to channel chats"]
#[allow(clippy::needless_lifetimes)]
pub fn gift_id(mut self, gift_id: &'a str) -> Self {
self.gift_id = gift_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_gift_id(&'a self) -> &'a &'a str {
&self.gift_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver"]
#[allow(clippy::needless_lifetimes)]
pub fn pay_for_upgrade(mut self, pay_for_upgrade: bool) -> Self {
self.pay_for_upgrade = Some(pay_for_upgrade);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_pay_for_upgrade(&'a self) -> &'a Option<bool> {
&self.pay_for_upgrade
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Text that will be shown along with the gift; 0-128 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn text(mut self, text: &'a str) -> Self {
self.text = Some(text);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text(&'a self) -> &'a Option<&'a str> {
&self.text
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Mode for parsing entities in the text. See formatting options for more details. Entities other than \"bold\", \"italic\", \"underline\", \"strikethrough\", \"spoiler\", \"custom_emoji\", and \"date_time\" are ignored."]
#[allow(clippy::needless_lifetimes)]
pub fn text_parse_mode(mut self, text_parse_mode: &'a str) -> Self {
self.text_parse_mode = Some(text_parse_mode);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text_parse_mode(&'a self) -> &'a Option<&'a str> {
&self.text_parse_mode
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than \"bold\", \"italic\", \"underline\", \"strikethrough\", \"spoiler\", \"custom_emoji\", and \"date_time\" are ignored."]
#[allow(clippy::needless_lifetimes)]
pub fn text_entities(mut self, text_entities: &'a Vec<MessageEntity>) -> Self {
self.text_entities = Some(text_entities);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_text_entities(&'a self) -> &'a Option<&'a Vec<MessageEntity>> {
&self.text_entities
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.send_gift(
self.user_id,
self.chat_id,
self.gift_id,
self.pay_for_upgrade,
self.text,
self.text_parse_mode,
self.text_entities,
)
.await
}
}
pub struct CallGetFile<'a> {
bot: &'a Bot,
file_id: &'a str,
}
impl<'a> CallGetFile<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "File identifier to get information about"]
#[allow(clippy::needless_lifetimes)]
pub fn file_id(mut self, file_id: &'a str) -> Self {
self.file_id = file_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_file_id(&'a self) -> &'a &'a str {
&self.file_id
}
pub async fn build(self) -> BotResult<File> {
self.bot.get_file(self.file_id).await
}
}
pub struct CallCreateChatSubscriptionInviteLink<'a, V> {
bot: &'a Bot,
chat_id: V,
name: Option<&'a str>,
subscription_period: i64,
subscription_price: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallCreateChatSubscriptionInviteLink<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Invite link name; 0-32 characters"]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = Some(name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a Option<&'a str> {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days)."]
#[allow(clippy::needless_lifetimes)]
pub fn subscription_period(mut self, subscription_period: i64) -> Self {
self.subscription_period = subscription_period;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_subscription_period(&'a self) -> &'a i64 {
&self.subscription_period
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000"]
#[allow(clippy::needless_lifetimes)]
pub fn subscription_price(mut self, subscription_price: i64) -> Self {
self.subscription_price = subscription_price;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_subscription_price(&'a self) -> &'a i64 {
&self.subscription_price
}
pub async fn build(self) -> BotResult<ChatInviteLink> {
self.bot
.create_chat_subscription_invite_link(
self.chat_id,
self.name,
self.subscription_period,
self.subscription_price,
)
.await
}
}
pub struct CallSetChatStickerSet<'a, V> {
bot: &'a Bot,
chat_id: V,
sticker_set_name: &'a str,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSetChatStickerSet<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Name of the sticker set to be set as the group sticker set"]
#[allow(clippy::needless_lifetimes)]
pub fn sticker_set_name(mut self, sticker_set_name: &'a str) -> Self {
self.sticker_set_name = sticker_set_name;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker_set_name(&'a self) -> &'a &'a str {
&self.sticker_set_name
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_chat_sticker_set(self.chat_id, self.sticker_set_name)
.await
}
}
pub struct CallReopenForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallReopenForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread of the forum topic"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = message_thread_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a i64 {
&self.message_thread_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.reopen_forum_topic(self.chat_id, self.message_thread_id)
.await
}
}
pub struct CallVerifyUser<'a> {
bot: &'a Bot,
user_id: i64,
custom_description: Option<&'a str>,
}
impl<'a> CallVerifyUser<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description."]
#[allow(clippy::needless_lifetimes)]
pub fn custom_description(mut self, custom_description: &'a str) -> Self {
self.custom_description = Some(custom_description);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_custom_description(&'a self) -> &'a Option<&'a str> {
&self.custom_description
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.verify_user(self.user_id, self.custom_description)
.await
}
}
pub struct CallForwardMessages<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_ids: &'a Vec<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallForwardMessages<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn from_chat_id(mut self, from_chat_id: V) -> Self {
self.from_chat_id = from_chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_from_chat_id(&'a self) -> &'a V {
&self.from_chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order."]
#[allow(clippy::needless_lifetimes)]
pub fn message_ids(mut self, message_ids: &'a Vec<i64>) -> Self {
self.message_ids = message_ids;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_ids(&'a self) -> &'a &'a Vec<i64> {
&self.message_ids
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the messages silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the forwarded messages from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
pub async fn build(self) -> BotResult<Vec<MessageId>> {
self.bot
.forward_messages(
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.from_chat_id,
self.message_ids,
self.disable_notification,
self.protect_content,
)
.await
}
}
pub struct CallGetUserProfilePhotos<'a> {
bot: &'a Bot,
user_id: i64,
offset: Option<i64>,
limit: Option<i64>,
}
impl<'a> CallGetUserProfilePhotos<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sequential number of the first photo to be returned. By default, all photos are returned."]
#[allow(clippy::needless_lifetimes)]
pub fn offset(mut self, offset: i64) -> Self {
self.offset = Some(offset);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_offset(&'a self) -> &'a Option<i64> {
&self.offset
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100."]
#[allow(clippy::needless_lifetimes)]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_limit(&'a self) -> &'a Option<i64> {
&self.limit
}
pub async fn build(self) -> BotResult<UserProfilePhotos> {
self.bot
.get_user_profile_photos(self.user_id, self.offset, self.limit)
.await
}
}
pub struct CallSetMyCommands<'a> {
bot: &'a Bot,
commands: &'a Vec<BotCommand>,
scope: Option<&'a BotCommandScope>,
language_code: Option<&'a str>,
}
impl<'a> CallSetMyCommands<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified."]
#[allow(clippy::needless_lifetimes)]
pub fn commands(mut self, commands: &'a Vec<BotCommand>) -> Self {
self.commands = commands;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_commands(&'a self) -> &'a &'a Vec<BotCommand> {
&self.commands
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault."]
#[allow(clippy::needless_lifetimes)]
pub fn scope<T>(mut self, scope: T) -> Self
where
T: Into<&'a BotCommandScope>,
{
self.scope = Some(scope.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_scope(&'a self) -> &'a Option<&'a BotCommandScope> {
&self.scope
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_my_commands(self.commands, self.scope, self.language_code)
.await
}
}
pub struct CallDeleteMyCommands<'a> {
bot: &'a Bot,
scope: Option<&'a BotCommandScope>,
language_code: Option<&'a str>,
}
impl<'a> CallDeleteMyCommands<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault."]
#[allow(clippy::needless_lifetimes)]
pub fn scope<T>(mut self, scope: T) -> Self
where
T: Into<&'a BotCommandScope>,
{
self.scope = Some(scope.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_scope(&'a self) -> &'a Option<&'a BotCommandScope> {
&self.scope
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.delete_my_commands(self.scope, self.language_code)
.await
}
}
pub struct CallDeleteBusinessMessages<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
message_ids: &'a Vec<i64>,
}
impl<'a> CallDeleteBusinessMessages<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which to delete the messages"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See deleteMessage for limitations on which messages can be deleted"]
#[allow(clippy::needless_lifetimes)]
pub fn message_ids(mut self, message_ids: &'a Vec<i64>) -> Self {
self.message_ids = message_ids;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_ids(&'a self) -> &'a &'a Vec<i64> {
&self.message_ids
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.delete_business_messages(self.business_connection_id, self.message_ids)
.await
}
}
pub struct CallSetBusinessAccountProfilePhoto<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
photo: &'a InputProfilePhoto,
is_public: Option<bool>,
}
impl<'a> CallSetBusinessAccountProfilePhoto<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The new profile photo to set"]
#[allow(clippy::needless_lifetimes)]
pub fn photo<T>(mut self, photo: T) -> Self
where
T: Into<&'a InputProfilePhoto>,
{
self.photo = photo.into();
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_photo(&'a self) -> &'a &'a InputProfilePhoto {
&self.photo
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo."]
#[allow(clippy::needless_lifetimes)]
pub fn is_public(mut self, is_public: bool) -> Self {
self.is_public = Some(is_public);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_is_public(&'a self) -> &'a Option<bool> {
&self.is_public
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.set_business_account_profile_photo(
self.business_connection_id,
self.photo,
self.is_public,
)
.await
}
}
pub struct CallBanChatSenderChat<'a, V> {
bot: &'a Bot,
chat_id: V,
sender_chat_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallBanChatSenderChat<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the target sender chat"]
#[allow(clippy::needless_lifetimes)]
pub fn sender_chat_id(mut self, sender_chat_id: i64) -> Self {
self.sender_chat_id = sender_chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sender_chat_id(&'a self) -> &'a i64 {
&self.sender_chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.ban_chat_sender_chat(self.chat_id, self.sender_chat_id)
.await
}
}
pub struct CallGetChatMemberCount<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallGetChatMemberCount<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<i64> {
self.bot.get_chat_member_count(self.chat_id).await
}
}
pub struct CallGetManagedBotToken<'a> {
bot: &'a Bot,
user_id: i64,
}
impl<'a> CallGetManagedBotToken<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier of the managed bot whose token will be returned"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
pub async fn build(self) -> BotResult<String> {
self.bot.get_managed_bot_token(self.user_id).await
}
}
pub struct CallCloseForumTopic<'a, V> {
bot: &'a Bot,
chat_id: V,
message_thread_id: i64,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallCloseForumTopic<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread of the forum topic"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = message_thread_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a i64 {
&self.message_thread_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.close_forum_topic(self.chat_id, self.message_thread_id)
.await
}
}
pub struct CallLeaveChat<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallLeaveChat<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername). Channel direct messages chats aren't supported; leave the corresponding channel instead."]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot.leave_chat(self.chat_id).await
}
}
pub struct CallGetChatAdministrators<'a, V> {
bot: &'a Bot,
chat_id: V,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallGetChatAdministrators<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
pub async fn build(self) -> BotResult<Vec<ChatMember>> {
self.bot.get_chat_administrators(self.chat_id).await
}
}
pub struct CallLogOut<'a> {
bot: &'a Bot,
}
impl<'a> CallLogOut<'a> {
pub async fn build(self) -> BotResult<bool> {
self.bot.log_out().await
}
}
pub struct CallSetMyName<'a> {
bot: &'a Bot,
name: Option<&'a str>,
language_code: Option<&'a str>,
}
impl<'a> CallSetMyName<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language."]
#[allow(clippy::needless_lifetimes)]
pub fn name(mut self, name: &'a str) -> Self {
self.name = Some(name);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_name(&'a self) -> &'a Option<&'a str> {
&self.name
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name."]
#[allow(clippy::needless_lifetimes)]
pub fn language_code(mut self, language_code: &'a str) -> Self {
self.language_code = Some(language_code);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_language_code(&'a self) -> &'a Option<&'a str> {
&self.language_code
}
pub async fn build(self) -> BotResult<bool> {
self.bot.set_my_name(self.name, self.language_code).await
}
}
pub struct CallApproveSuggestedPost<'a> {
bot: &'a Bot,
chat_id: i64,
message_id: i64,
send_date: Option<i64>,
}
impl<'a> CallApproveSuggestedPost<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a i64 {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of a suggested post message to approve"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future"]
#[allow(clippy::needless_lifetimes)]
pub fn send_date(mut self, send_date: i64) -> Self {
self.send_date = Some(send_date);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_send_date(&'a self) -> &'a Option<i64> {
&self.send_date
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.approve_suggested_post(self.chat_id, self.message_id, self.send_date)
.await
}
}
pub struct CallSendSticker<'a, V> {
bot: &'a Bot,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
sticker: FileData,
emoji: Option<&'a str>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
}
impl<'a, V: Into<ChatHandle> + Serialize> CallSendSticker<'a, V> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which the message will be sent"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = Some(business_connection_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a Option<&'a str> {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target chat or username of the target channel (in the format @channelusername)"]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: V) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a V {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = Some(message_thread_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_thread_id(&'a self) -> &'a Option<i64> {
&self.message_thread_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"]
#[allow(clippy::needless_lifetimes)]
pub fn direct_messages_topic_id(mut self, direct_messages_topic_id: i64) -> Self {
self.direct_messages_topic_id = Some(direct_messages_topic_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_direct_messages_topic_id(&'a self) -> &'a Option<i64> {
&self.direct_messages_topic_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files: https://core.telegram.org/bots/api#sending-files. Video and animated stickers can't be sent via an HTTP URL."]
#[allow(clippy::needless_lifetimes)]
pub fn sticker(mut self, sticker: FileData) -> Self {
self.sticker = sticker;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a FileData {
&self.sticker
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Emoji associated with the sticker; only for just uploaded stickers"]
#[allow(clippy::needless_lifetimes)]
pub fn emoji(mut self, emoji: &'a str) -> Self {
self.emoji = Some(emoji);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_emoji(&'a self) -> &'a Option<&'a str> {
&self.emoji
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends the message silently. Users will receive a notification with no sound."]
#[allow(clippy::needless_lifetimes)]
pub fn disable_notification(mut self, disable_notification: bool) -> Self {
self.disable_notification = Some(disable_notification);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_disable_notification(&'a self) -> &'a Option<bool> {
&self.disable_notification
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Protects the contents of the sent message from forwarding and saving"]
#[allow(clippy::needless_lifetimes)]
pub fn protect_content(mut self, protect_content: bool) -> Self {
self.protect_content = Some(protect_content);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_protect_content(&'a self) -> &'a Option<bool> {
&self.protect_content
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"]
#[allow(clippy::needless_lifetimes)]
pub fn allow_paid_broadcast(mut self, allow_paid_broadcast: bool) -> Self {
self.allow_paid_broadcast = Some(allow_paid_broadcast);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_allow_paid_broadcast(&'a self) -> &'a Option<bool> {
&self.allow_paid_broadcast
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message effect to be added to the message; for private chats only"]
#[allow(clippy::needless_lifetimes)]
pub fn message_effect_id(mut self, message_effect_id: &'a str) -> Self {
self.message_effect_id = Some(message_effect_id);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_effect_id(&'a self) -> &'a Option<&'a str> {
&self.message_effect_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."]
#[allow(clippy::needless_lifetimes)]
pub fn suggested_post_parameters<T>(mut self, suggested_post_parameters: T) -> Self
where
T: Into<&'a SuggestedPostParameters>,
{
self.suggested_post_parameters = Some(suggested_post_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_suggested_post_parameters(&'a self) -> &'a Option<&'a SuggestedPostParameters> {
&self.suggested_post_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Description of the message to reply to"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_parameters<T>(mut self, reply_parameters: T) -> Self
where
T: Into<&'a ReplyParameters>,
{
self.reply_parameters = Some(reply_parameters.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_parameters(&'a self) -> &'a Option<&'a ReplyParameters> {
&self.reply_parameters
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user"]
#[allow(clippy::needless_lifetimes)]
pub fn reply_markup<T>(mut self, reply_markup: T) -> Self
where
T: Into<&'a EReplyMarkup>,
{
self.reply_markup = Some(reply_markup.into());
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_reply_markup(&'a self) -> &'a Option<&'a EReplyMarkup> {
&self.reply_markup
}
pub async fn build(self) -> BotResult<Message> {
self.bot
.send_sticker(
self.business_connection_id,
self.chat_id,
self.message_thread_id,
self.direct_messages_topic_id,
self.sticker,
self.emoji,
self.disable_notification,
self.protect_content,
self.allow_paid_broadcast,
self.message_effect_id,
self.suggested_post_parameters,
self.reply_parameters,
self.reply_markup,
)
.await
}
}
pub struct CallReadBusinessMessage<'a> {
bot: &'a Bot,
business_connection_id: &'a str,
chat_id: i64,
message_id: i64,
}
impl<'a> CallReadBusinessMessage<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the business connection on behalf of which to read the message"]
#[allow(clippy::needless_lifetimes)]
pub fn business_connection_id(mut self, business_connection_id: &'a str) -> Self {
self.business_connection_id = business_connection_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_business_connection_id(&'a self) -> &'a &'a str {
&self.business_connection_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours."]
#[allow(clippy::needless_lifetimes)]
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_chat_id(&'a self) -> &'a i64 {
&self.chat_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the message to mark as read"]
#[allow(clippy::needless_lifetimes)]
pub fn message_id(mut self, message_id: i64) -> Self {
self.message_id = message_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_message_id(&'a self) -> &'a i64 {
&self.message_id
}
pub async fn build(self) -> BotResult<bool> {
self.bot
.read_business_message(self.business_connection_id, self.chat_id, self.message_id)
.await
}
}
pub struct CallGetCustomEmojiStickers<'a> {
bot: &'a Bot,
custom_emoji_ids: &'a Vec<String>,
}
impl<'a> CallGetCustomEmojiStickers<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified."]
#[allow(clippy::needless_lifetimes)]
pub fn custom_emoji_ids(mut self, custom_emoji_ids: &'a Vec<String>) -> Self {
self.custom_emoji_ids = custom_emoji_ids;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_custom_emoji_ids(&'a self) -> &'a &'a Vec<String> {
&self.custom_emoji_ids
}
pub async fn build(self) -> BotResult<Vec<Sticker>> {
self.bot
.get_custom_emoji_stickers(self.custom_emoji_ids)
.await
}
}
pub struct CallUploadStickerFile<'a> {
bot: &'a Bot,
user_id: i64,
sticker: FileData,
sticker_format: &'a str,
}
impl<'a> CallUploadStickerFile<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "User identifier of sticker file owner"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. More information on Sending Files: https://core.telegram.org/bots/api#sending-files"]
#[allow(clippy::needless_lifetimes)]
pub fn sticker(mut self, sticker: FileData) -> Self {
self.sticker = sticker;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker(&'a self) -> &'a FileData {
&self.sticker
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Format of the sticker, must be one of \"static\", \"animated\", \"video\""]
#[allow(clippy::needless_lifetimes)]
pub fn sticker_format(mut self, sticker_format: &'a str) -> Self {
self.sticker_format = sticker_format;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sticker_format(&'a self) -> &'a &'a str {
&self.sticker_format
}
pub async fn build(self) -> BotResult<File> {
self.bot
.upload_sticker_file(self.user_id, self.sticker, self.sticker_format)
.await
}
}
pub struct CallGetUserGifts<'a> {
bot: &'a Bot,
user_id: i64,
exclude_unlimited: Option<bool>,
exclude_limited_upgradable: Option<bool>,
exclude_limited_non_upgradable: Option<bool>,
exclude_from_blockchain: Option<bool>,
exclude_unique: Option<bool>,
sort_by_price: Option<bool>,
offset: Option<&'a str>,
limit: Option<i64>,
}
impl<'a> CallGetUserGifts<'a> {
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Unique identifier of the user"]
#[allow(clippy::needless_lifetimes)]
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_user_id(&'a self) -> &'a i64 {
&self.user_id
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased an unlimited number of times"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_unlimited(mut self, exclude_unlimited: bool) -> Self {
self.exclude_unlimited = Some(exclude_unlimited);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_unlimited(&'a self) -> &'a Option<bool> {
&self.exclude_unlimited
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_limited_upgradable(mut self, exclude_limited_upgradable: bool) -> Self {
self.exclude_limited_upgradable = Some(exclude_limited_upgradable);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_limited_upgradable(&'a self) -> &'a Option<bool> {
&self.exclude_limited_upgradable
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_limited_non_upgradable(mut self, exclude_limited_non_upgradable: bool) -> Self {
self.exclude_limited_non_upgradable = Some(exclude_limited_non_upgradable);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_limited_non_upgradable(&'a self) -> &'a Option<bool> {
&self.exclude_limited_non_upgradable
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_from_blockchain(mut self, exclude_from_blockchain: bool) -> Self {
self.exclude_from_blockchain = Some(exclude_from_blockchain);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_from_blockchain(&'a self) -> &'a Option<bool> {
&self.exclude_from_blockchain
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to exclude unique gifts"]
#[allow(clippy::needless_lifetimes)]
pub fn exclude_unique(mut self, exclude_unique: bool) -> Self {
self.exclude_unique = Some(exclude_unique);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_exclude_unique(&'a self) -> &'a Option<bool> {
&self.exclude_unique
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Pass True to sort results by gift price instead of send date. Sorting is applied before pagination."]
#[allow(clippy::needless_lifetimes)]
pub fn sort_by_price(mut self, sort_by_price: bool) -> Self {
self.sort_by_price = Some(sort_by_price);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_sort_by_price(&'a self) -> &'a Option<bool> {
&self.sort_by_price
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results"]
#[allow(clippy::needless_lifetimes)]
pub fn offset(mut self, offset: &'a str) -> Self {
self.offset = Some(offset);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_offset(&'a self) -> &'a Option<&'a str> {
&self.offset
}
#[allow(rustdoc::invalid_html_tags)]
#[doc = "The maximum number of gifts to be returned; 1-100. Defaults to 100"]
#[allow(clippy::needless_lifetimes)]
pub fn limit(mut self, limit: i64) -> Self {
self.limit = Some(limit);
self
}
#[allow(clippy::needless_lifetimes)]
pub fn get_limit(&'a self) -> &'a Option<i64> {
&self.limit
}
pub async fn build(self) -> BotResult<OwnedGifts> {
self.bot
.get_user_gifts(
self.user_id,
self.exclude_unlimited,
self.exclude_limited_upgradable,
self.exclude_limited_non_upgradable,
self.exclude_from_blockchain,
self.exclude_unique,
self.sort_by_price,
self.offset,
self.limit,
)
.await
}
}
impl<'a> GetMyShortDescriptionOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendVoiceOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("voice", self.voice.to_string());
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(duration) = self.duration {
form.text("duration", duration.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> GetChatGiftsOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(exclude_unsaved) = self.exclude_unsaved {
form.text("exclude_unsaved", exclude_unsaved.to_string())
} else {
form
};
let form = if let Some(exclude_saved) = self.exclude_saved {
form.text("exclude_saved", exclude_saved.to_string())
} else {
form
};
let form = if let Some(exclude_unlimited) = self.exclude_unlimited {
form.text("exclude_unlimited", exclude_unlimited.to_string())
} else {
form
};
let form = if let Some(exclude_limited_upgradable) = self.exclude_limited_upgradable {
form.text(
"exclude_limited_upgradable",
exclude_limited_upgradable.to_string(),
)
} else {
form
};
let form = if let Some(exclude_limited_non_upgradable) = self.exclude_limited_non_upgradable
{
form.text(
"exclude_limited_non_upgradable",
exclude_limited_non_upgradable.to_string(),
)
} else {
form
};
let form = if let Some(exclude_from_blockchain) = self.exclude_from_blockchain {
form.text(
"exclude_from_blockchain",
exclude_from_blockchain.to_string(),
)
} else {
form
};
let form = if let Some(exclude_unique) = self.exclude_unique {
form.text("exclude_unique", exclude_unique.to_string())
} else {
form
};
let form = if let Some(sort_by_price) = self.sort_by_price {
form.text("sort_by_price", sort_by_price.to_string())
} else {
form
};
let form = if let Some(offset) = self.offset {
form.text("offset", offset.to_string())
} else {
form
};
let form = if let Some(limit) = self.limit {
form.text("limit", limit.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> BanChatMemberOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(until_date) = self.until_date {
form.text("until_date", until_date.to_string())
} else {
form
};
let form = if let Some(revoke_messages) = self.revoke_messages {
form.text("revoke_messages", revoke_messages.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> SetBusinessAccountUsernameOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = if let Some(username) = self.username {
form.text("username", username.to_string())
} else {
form
};
form
}
}
impl<'a> GetMyCommandsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(scope) = self.scope {
form.text("scope", scope)
} else {
form
};
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl<'a> DeleteStoryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("story_id", self.story_id.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditMessageReplyMarkupOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let form = if let Some(inline_message_id) = self.inline_message_id {
form.text("inline_message_id", inline_message_id.to_string())
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
let v: ChatHandle = chat_id.into();
form.text("chat_id", v.to_string())
} else {
form
};
form
}
}
impl<'a> ReplaceStickerInSetOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("sticker", self.sticker);
let form = form.text("user_id", self.user_id.to_string());
let form = form.text("name", self.name.to_string());
let form = form.text("old_sticker", self.old_sticker.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> UnpinAllGeneralForumTopicMessagesOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> DeleteStickerSetOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("name", self.name.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SetChatMemberTagOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(tag) = self.tag {
form.text("tag", tag.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> SetStickerEmojiListOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("emoji_list", self.emoji_list);
let form = form.text("sticker", self.sticker.to_string());
form
}
}
impl<'a> AnswerCallbackQueryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("callback_query_id", self.callback_query_id.to_string());
let form = if let Some(text) = self.text {
form.text("text", text.to_string())
} else {
form
};
let form = if let Some(show_alert) = self.show_alert {
form.text("show_alert", show_alert.to_string())
} else {
form
};
let form = if let Some(url) = self.url {
form.text("url", url.to_string())
} else {
form
};
let form = if let Some(cache_time) = self.cache_time {
form.text("cache_time", cache_time.to_string())
} else {
form
};
form
}
}
impl<'a> AddStickerToSetOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("sticker", self.sticker);
let form = form.text("user_id", self.user_id.to_string());
let form = form.text("name", self.name.to_string());
form
}
}
impl<'a> EditUserStarSubscriptionOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = form.text(
"telegram_payment_charge_id",
self.telegram_payment_charge_id.to_string(),
);
let form = form.text("is_canceled", self.is_canceled.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SetChatTitleOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("title", self.title.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendPaidMediaOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("media", self.media);
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("star_count", self.star_count.to_string());
let form = if let Some(payload) = self.payload {
form.text("payload", payload.to_string())
} else {
form
};
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
form.text(
"show_caption_above_media",
show_caption_above_media.to_string(),
)
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> UnbanChatMemberOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(only_if_banned) = self.only_if_banned {
form.text("only_if_banned", only_if_banned.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl RemoveMyProfilePhotoOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> CreateForumTopicOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("name", self.name.to_string());
let form = if let Some(icon_color) = self.icon_color {
form.text("icon_color", icon_color.to_string())
} else {
form
};
let form = if let Some(icon_custom_emoji_id) = self.icon_custom_emoji_id {
form.text("icon_custom_emoji_id", icon_custom_emoji_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendDocumentOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("document", self.document.to_string());
let form = if let Some(thumbnail) = self.thumbnail {
form.text("thumbnail", thumbnail.to_string())
} else {
form
};
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(disable_content_type_detection) = self.disable_content_type_detection
{
form.text(
"disable_content_type_detection",
disable_content_type_detection.to_string(),
)
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> RevokeChatInviteLinkOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("invite_link", self.invite_link.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> HideGeneralForumTopicOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> StopMessageLiveLocationOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let form = if let Some(inline_message_id) = self.inline_message_id {
form.text("inline_message_id", inline_message_id.to_string())
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
let v: ChatHandle = chat_id.into();
form.text("chat_id", v.to_string())
} else {
form
};
form
}
}
impl<'a> SetStickerMaskPositionOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(mask_position) = self.mask_position {
form.text("mask_position", mask_position)
} else {
form
};
let form = form.text("sticker", self.sticker.to_string());
form
}
}
impl DeleteWebhookOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(drop_pending_updates) = self.drop_pending_updates {
form.text("drop_pending_updates", drop_pending_updates.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendInvoiceOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("prices", self.prices);
let form = if let Some(suggested_tip_amounts) = self.suggested_tip_amounts {
form.text("suggested_tip_amounts", suggested_tip_amounts)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("title", self.title.to_string());
let form = form.text("description", self.description.to_string());
let form = form.text("payload", self.payload.to_string());
let form = if let Some(provider_token) = self.provider_token {
form.text("provider_token", provider_token.to_string())
} else {
form
};
let form = form.text("currency", self.currency.to_string());
let form = if let Some(max_tip_amount) = self.max_tip_amount {
form.text("max_tip_amount", max_tip_amount.to_string())
} else {
form
};
let form = if let Some(start_parameter) = self.start_parameter {
form.text("start_parameter", start_parameter.to_string())
} else {
form
};
let form = if let Some(provider_data) = self.provider_data {
form.text("provider_data", provider_data.to_string())
} else {
form
};
let form = if let Some(photo_url) = self.photo_url {
form.text("photo_url", photo_url.to_string())
} else {
form
};
let form = if let Some(photo_size) = self.photo_size {
form.text("photo_size", photo_size.to_string())
} else {
form
};
let form = if let Some(photo_width) = self.photo_width {
form.text("photo_width", photo_width.to_string())
} else {
form
};
let form = if let Some(photo_height) = self.photo_height {
form.text("photo_height", photo_height.to_string())
} else {
form
};
let form = if let Some(need_name) = self.need_name {
form.text("need_name", need_name.to_string())
} else {
form
};
let form = if let Some(need_phone_number) = self.need_phone_number {
form.text("need_phone_number", need_phone_number.to_string())
} else {
form
};
let form = if let Some(need_email) = self.need_email {
form.text("need_email", need_email.to_string())
} else {
form
};
let form = if let Some(need_shipping_address) = self.need_shipping_address {
form.text("need_shipping_address", need_shipping_address.to_string())
} else {
form
};
let form = if let Some(send_phone_number_to_provider) = self.send_phone_number_to_provider {
form.text(
"send_phone_number_to_provider",
send_phone_number_to_provider.to_string(),
)
} else {
form
};
let form = if let Some(send_email_to_provider) = self.send_email_to_provider {
form.text("send_email_to_provider", send_email_to_provider.to_string())
} else {
form
};
let form = if let Some(is_flexible) = self.is_flexible {
form.text("is_flexible", is_flexible.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendChatActionOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = form.text("action", self.action.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> AnswerPreCheckoutQueryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"pre_checkout_query_id",
self.pre_checkout_query_id.to_string(),
);
let form = form.text("ok", self.ok.to_string());
let form = if let Some(error_message) = self.error_message {
form.text("error_message", error_message.to_string())
} else {
form
};
form
}
}
impl<'a> SetStickerPositionInSetOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("sticker", self.sticker.to_string());
let form = form.text("position", self.position.to_string());
form
}
}
impl<'a> SendGameOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = form.text("chat_id", self.chat_id.to_string());
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = form.text("game_short_name", self.game_short_name.to_string());
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> ExportChatInviteLinkOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> SetChatPhotoOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("photo", self.photo);
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> DeleteChatPhotoOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> GetChatMemberOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditMessageCaptionOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let form = if let Some(inline_message_id) = self.inline_message_id {
form.text("inline_message_id", inline_message_id.to_string())
} else {
form
};
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
form.text(
"show_caption_above_media",
show_caption_above_media.to_string(),
)
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
let v: ChatHandle = chat_id.into();
form.text("chat_id", v.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> DeleteMessageOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_id", self.message_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditChatInviteLinkOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("invite_link", self.invite_link.to_string());
let form = if let Some(name) = self.name {
form.text("name", name.to_string())
} else {
form
};
let form = if let Some(expire_date) = self.expire_date {
form.text("expire_date", expire_date.to_string())
} else {
form
};
let form = if let Some(member_limit) = self.member_limit {
form.text("member_limit", member_limit.to_string())
} else {
form
};
let form = if let Some(creates_join_request) = self.creates_join_request {
form.text("creates_join_request", creates_join_request.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl SetPassportDataErrorsOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("errors", self.errors);
let form = form.text("user_id", self.user_id.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> SetChatPermissionsOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("permissions", self.permissions);
let form =
if let Some(use_independent_chat_permissions) = self.use_independent_chat_permissions {
form.text(
"use_independent_chat_permissions",
use_independent_chat_permissions.to_string(),
)
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> PostStoryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("content", self.content);
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(areas) = self.areas {
form.text("areas", areas)
} else {
form
};
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("active_period", self.active_period.to_string());
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(post_to_chat_page) = self.post_to_chat_page {
form.text("post_to_chat_page", post_to_chat_page.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
form
}
}
impl GetUpdatesOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(allowed_updates) = self.allowed_updates {
form.text("allowed_updates", allowed_updates)
} else {
form
};
let form = if let Some(offset) = self.offset {
form.text("offset", offset.to_string())
} else {
form
};
let form = if let Some(limit) = self.limit {
form.text("limit", limit.to_string())
} else {
form
};
let form = if let Some(timeout) = self.timeout {
form.text("timeout", timeout.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> CopyMessagesOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_ids", self.message_ids);
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(remove_caption) = self.remove_caption {
form.text("remove_caption", remove_caption.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
let v: ChatHandle = self.from_chat_id.into();
let form = form.text("from_chat_id", v.to_string());
form
}
}
impl<'a> GiftPremiumSubscriptionOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(text_entities) = self.text_entities {
form.text("text_entities", text_entities)
} else {
form
};
let form = form.text("user_id", self.user_id.to_string());
let form = form.text("month_count", self.month_count.to_string());
let form = form.text("star_count", self.star_count.to_string());
let form = if let Some(text) = self.text {
form.text("text", text.to_string())
} else {
form
};
let form = if let Some(text_parse_mode) = self.text_parse_mode {
form.text("text_parse_mode", text_parse_mode.to_string())
} else {
form
};
form
}
}
impl GetWebhookInfoOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
form
}
}
impl<V: Into<ChatHandle> + Serialize> ApproveChatJoinRequestOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> TransferBusinessAccountStarsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("star_count", self.star_count.to_string());
form
}
}
impl GetStarTransactionsOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(offset) = self.offset {
form.text("offset", offset.to_string())
} else {
form
};
let form = if let Some(limit) = self.limit {
form.text("limit", limit.to_string())
} else {
form
};
form
}
}
impl<'a> SetGameScoreOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = form.text("score", self.score.to_string());
let form = if let Some(force) = self.force {
form.text("force", force.to_string())
} else {
form
};
let form = if let Some(disable_edit_message) = self.disable_edit_message {
form.text("disable_edit_message", disable_edit_message.to_string())
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
form.text("chat_id", chat_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let form = if let Some(inline_message_id) = self.inline_message_id {
form.text("inline_message_id", inline_message_id.to_string())
} else {
form
};
form
}
}
impl<'a> GetBusinessAccountStarBalanceOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
form
}
}
impl<'a> GetMyDescriptionOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> ForwardMessageOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = if let Some(video_start_timestamp) = self.video_start_timestamp {
form.text("video_start_timestamp", video_start_timestamp.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let form = form.text("message_id", self.message_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
let v: ChatHandle = self.from_chat_id.into();
let form = form.text("from_chat_id", v.to_string());
form
}
}
impl<'a> SetMyDescriptionOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(description) = self.description {
form.text("description", description.to_string())
} else {
form
};
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl<'a> SetBusinessAccountGiftSettingsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("accepted_gift_types", self.accepted_gift_types);
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("show_gift_button", self.show_gift_button.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> DeleteMessagesOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_ids", self.message_ids);
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> CreateInvoiceLinkOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("prices", self.prices);
let form = if let Some(suggested_tip_amounts) = self.suggested_tip_amounts {
form.text("suggested_tip_amounts", suggested_tip_amounts)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = form.text("title", self.title.to_string());
let form = form.text("description", self.description.to_string());
let form = form.text("payload", self.payload.to_string());
let form = if let Some(provider_token) = self.provider_token {
form.text("provider_token", provider_token.to_string())
} else {
form
};
let form = form.text("currency", self.currency.to_string());
let form = if let Some(subscription_period) = self.subscription_period {
form.text("subscription_period", subscription_period.to_string())
} else {
form
};
let form = if let Some(max_tip_amount) = self.max_tip_amount {
form.text("max_tip_amount", max_tip_amount.to_string())
} else {
form
};
let form = if let Some(provider_data) = self.provider_data {
form.text("provider_data", provider_data.to_string())
} else {
form
};
let form = if let Some(photo_url) = self.photo_url {
form.text("photo_url", photo_url.to_string())
} else {
form
};
let form = if let Some(photo_size) = self.photo_size {
form.text("photo_size", photo_size.to_string())
} else {
form
};
let form = if let Some(photo_width) = self.photo_width {
form.text("photo_width", photo_width.to_string())
} else {
form
};
let form = if let Some(photo_height) = self.photo_height {
form.text("photo_height", photo_height.to_string())
} else {
form
};
let form = if let Some(need_name) = self.need_name {
form.text("need_name", need_name.to_string())
} else {
form
};
let form = if let Some(need_phone_number) = self.need_phone_number {
form.text("need_phone_number", need_phone_number.to_string())
} else {
form
};
let form = if let Some(need_email) = self.need_email {
form.text("need_email", need_email.to_string())
} else {
form
};
let form = if let Some(need_shipping_address) = self.need_shipping_address {
form.text("need_shipping_address", need_shipping_address.to_string())
} else {
form
};
let form = if let Some(send_phone_number_to_provider) = self.send_phone_number_to_provider {
form.text(
"send_phone_number_to_provider",
send_phone_number_to_provider.to_string(),
)
} else {
form
};
let form = if let Some(send_email_to_provider) = self.send_email_to_provider {
form.text("send_email_to_provider", send_email_to_provider.to_string())
} else {
form
};
let form = if let Some(is_flexible) = self.is_flexible {
form.text("is_flexible", is_flexible.to_string())
} else {
form
};
form
}
}
impl<'a> RepostStoryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("from_chat_id", self.from_chat_id.to_string());
let form = form.text("from_story_id", self.from_story_id.to_string());
let form = form.text("active_period", self.active_period.to_string());
let form = if let Some(post_to_chat_page) = self.post_to_chat_page {
form.text("post_to_chat_page", post_to_chat_page.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> DeclineChatJoinRequestOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> RefundStarPaymentOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = form.text(
"telegram_payment_charge_id",
self.telegram_payment_charge_id.to_string(),
);
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendMediaGroupOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("media", self.media);
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> VerifyChatOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(custom_description) = self.custom_description {
form.text("custom_description", custom_description.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> SendMessageDraftOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(entities) = self.entities {
form.text("entities", entities)
} else {
form
};
let form = form.text("chat_id", self.chat_id.to_string());
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = form.text("draft_id", self.draft_id.to_string());
let form = form.text("text", self.text.to_string());
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> RestrictChatMemberOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("permissions", self.permissions);
let form = form.text("user_id", self.user_id.to_string());
let form =
if let Some(use_independent_chat_permissions) = self.use_independent_chat_permissions {
form.text(
"use_independent_chat_permissions",
use_independent_chat_permissions.to_string(),
)
} else {
form
};
let form = if let Some(until_date) = self.until_date {
form.text("until_date", until_date.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl RemoveUserVerificationOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendVideoOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("video", self.video.to_string());
let form = if let Some(duration) = self.duration {
form.text("duration", duration.to_string())
} else {
form
};
let form = if let Some(width) = self.width {
form.text("width", width.to_string())
} else {
form
};
let form = if let Some(height) = self.height {
form.text("height", height.to_string())
} else {
form
};
let form = if let Some(thumbnail) = self.thumbnail {
form.text("thumbnail", thumbnail.to_string())
} else {
form
};
let form = if let Some(cover) = self.cover {
form.text("cover", cover.to_string())
} else {
form
};
let form = if let Some(start_timestamp) = self.start_timestamp {
form.text("start_timestamp", start_timestamp.to_string())
} else {
form
};
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
form.text(
"show_caption_above_media",
show_caption_above_media.to_string(),
)
} else {
form
};
let form = if let Some(has_spoiler) = self.has_spoiler {
form.text("has_spoiler", has_spoiler.to_string())
} else {
form
};
let form = if let Some(supports_streaming) = self.supports_streaming {
form.text("supports_streaming", supports_streaming.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> UpgradeGiftOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("owned_gift_id", self.owned_gift_id.to_string());
let form = if let Some(keep_original_details) = self.keep_original_details {
form.text("keep_original_details", keep_original_details.to_string())
} else {
form
};
let form = if let Some(star_count) = self.star_count {
form.text("star_count", star_count.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> CreateChatInviteLinkOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(name) = self.name {
form.text("name", name.to_string())
} else {
form
};
let form = if let Some(expire_date) = self.expire_date {
form.text("expire_date", expire_date.to_string())
} else {
form
};
let form = if let Some(member_limit) = self.member_limit {
form.text("member_limit", member_limit.to_string())
} else {
form
};
let form = if let Some(creates_join_request) = self.creates_join_request {
form.text("creates_join_request", creates_join_request.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> GetChatOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendVideoNoteOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("video_note", self.video_note.to_string());
let form = if let Some(duration) = self.duration {
form.text("duration", duration.to_string())
} else {
form
};
let form = if let Some(length) = self.length {
form.text("length", length.to_string())
} else {
form
};
let form = if let Some(thumbnail) = self.thumbnail {
form.text("thumbnail", thumbnail.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendPollOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(question_entities) = self.question_entities {
form.text("question_entities", question_entities)
} else {
form
};
let form = form.text("options", self.options);
let form = if let Some(correct_option_ids) = self.correct_option_ids {
form.text("correct_option_ids", correct_option_ids)
} else {
form
};
let form = if let Some(explanation_entities) = self.explanation_entities {
form.text("explanation_entities", explanation_entities)
} else {
form
};
let form = if let Some(description_entities) = self.description_entities {
form.text("description_entities", description_entities)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = form.text("question", self.question.to_string());
let form = if let Some(question_parse_mode) = self.question_parse_mode {
form.text("question_parse_mode", question_parse_mode.to_string())
} else {
form
};
let form = if let Some(is_anonymous) = self.is_anonymous {
form.text("is_anonymous", is_anonymous.to_string())
} else {
form
};
let form = if let Some(tg_type) = self.tg_type {
form.text("tg_type", tg_type.to_string())
} else {
form
};
let form = if let Some(allows_multiple_answers) = self.allows_multiple_answers {
form.text(
"allows_multiple_answers",
allows_multiple_answers.to_string(),
)
} else {
form
};
let form = if let Some(allows_revoting) = self.allows_revoting {
form.text("allows_revoting", allows_revoting.to_string())
} else {
form
};
let form = if let Some(shuffle_options) = self.shuffle_options {
form.text("shuffle_options", shuffle_options.to_string())
} else {
form
};
let form = if let Some(allow_adding_options) = self.allow_adding_options {
form.text("allow_adding_options", allow_adding_options.to_string())
} else {
form
};
let form = if let Some(hide_results_until_closes) = self.hide_results_until_closes {
form.text(
"hide_results_until_closes",
hide_results_until_closes.to_string(),
)
} else {
form
};
let form = if let Some(explanation) = self.explanation {
form.text("explanation", explanation.to_string())
} else {
form
};
let form = if let Some(explanation_parse_mode) = self.explanation_parse_mode {
form.text("explanation_parse_mode", explanation_parse_mode.to_string())
} else {
form
};
let form = if let Some(open_period) = self.open_period {
form.text("open_period", open_period.to_string())
} else {
form
};
let form = if let Some(close_date) = self.close_date {
form.text("close_date", close_date.to_string())
} else {
form
};
let form = if let Some(is_closed) = self.is_closed {
form.text("is_closed", is_closed.to_string())
} else {
form
};
let form = if let Some(description) = self.description {
form.text("description", description.to_string())
} else {
form
};
let form = if let Some(description_parse_mode) = self.description_parse_mode {
form.text("description_parse_mode", description_parse_mode.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> EditMessageChecklistOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("checklist", self.checklist);
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("chat_id", self.chat_id.to_string());
let form = form.text("message_id", self.message_id.to_string());
form
}
}
impl<'a> SendChecklistOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("checklist", self.checklist);
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("chat_id", self.chat_id.to_string());
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
form
}
}
impl GetUserProfileAudiosOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(offset) = self.offset {
form.text("offset", offset.to_string())
} else {
form
};
let form = if let Some(limit) = self.limit {
form.text("limit", limit.to_string())
} else {
form
};
form
}
}
impl GetAvailableGiftsOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
form
}
}
impl<V: Into<ChatHandle> + Serialize> PromoteChatMemberOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(is_anonymous) = self.is_anonymous {
form.text("is_anonymous", is_anonymous.to_string())
} else {
form
};
let form = if let Some(can_manage_chat) = self.can_manage_chat {
form.text("can_manage_chat", can_manage_chat.to_string())
} else {
form
};
let form = if let Some(can_delete_messages) = self.can_delete_messages {
form.text("can_delete_messages", can_delete_messages.to_string())
} else {
form
};
let form = if let Some(can_manage_video_chats) = self.can_manage_video_chats {
form.text("can_manage_video_chats", can_manage_video_chats.to_string())
} else {
form
};
let form = if let Some(can_restrict_members) = self.can_restrict_members {
form.text("can_restrict_members", can_restrict_members.to_string())
} else {
form
};
let form = if let Some(can_promote_members) = self.can_promote_members {
form.text("can_promote_members", can_promote_members.to_string())
} else {
form
};
let form = if let Some(can_change_info) = self.can_change_info {
form.text("can_change_info", can_change_info.to_string())
} else {
form
};
let form = if let Some(can_invite_users) = self.can_invite_users {
form.text("can_invite_users", can_invite_users.to_string())
} else {
form
};
let form = if let Some(can_post_stories) = self.can_post_stories {
form.text("can_post_stories", can_post_stories.to_string())
} else {
form
};
let form = if let Some(can_edit_stories) = self.can_edit_stories {
form.text("can_edit_stories", can_edit_stories.to_string())
} else {
form
};
let form = if let Some(can_delete_stories) = self.can_delete_stories {
form.text("can_delete_stories", can_delete_stories.to_string())
} else {
form
};
let form = if let Some(can_post_messages) = self.can_post_messages {
form.text("can_post_messages", can_post_messages.to_string())
} else {
form
};
let form = if let Some(can_edit_messages) = self.can_edit_messages {
form.text("can_edit_messages", can_edit_messages.to_string())
} else {
form
};
let form = if let Some(can_pin_messages) = self.can_pin_messages {
form.text("can_pin_messages", can_pin_messages.to_string())
} else {
form
};
let form = if let Some(can_manage_topics) = self.can_manage_topics {
form.text("can_manage_topics", can_manage_topics.to_string())
} else {
form
};
let form = if let Some(can_manage_direct_messages) = self.can_manage_direct_messages {
form.text(
"can_manage_direct_messages",
can_manage_direct_messages.to_string(),
)
} else {
form
};
let form = if let Some(can_manage_tags) = self.can_manage_tags {
form.text("can_manage_tags", can_manage_tags.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> PinChatMessageOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = form.text("message_id", self.message_id.to_string());
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> SetStickerKeywordsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(keywords) = self.keywords {
form.text("keywords", keywords)
} else {
form
};
let form = form.text("sticker", self.sticker.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> DeleteForumTopicOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_thread_id", self.message_thread_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl GetChatMenuButtonOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(chat_id) = self.chat_id {
form.text("chat_id", chat_id.to_string())
} else {
form
};
form
}
}
impl GetForumTopicIconStickersOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> UnpinChatMessageOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl ReplaceManagedBotTokenOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SetChatDescriptionOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(description) = self.description {
form.text("description", description.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> CloseGeneralForumTopicOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditMessageTextOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(entities) = self.entities {
form.text("entities", entities)
} else {
form
};
let form = if let Some(link_preview_options) = self.link_preview_options {
form.text("link_preview_options", link_preview_options)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let form = if let Some(inline_message_id) = self.inline_message_id {
form.text("inline_message_id", inline_message_id.to_string())
} else {
form
};
let form = form.text("text", self.text.to_string());
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
let v: ChatHandle = chat_id.into();
form.text("chat_id", v.to_string())
} else {
form
};
form
}
}
impl<'a> RemoveBusinessAccountProfilePhotoOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = if let Some(is_public) = self.is_public {
form.text("is_public", is_public.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> ReopenGeneralForumTopicOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> DeleteChatStickerSetOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendMessageOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(entities) = self.entities {
form.text("entities", entities)
} else {
form
};
let form = if let Some(link_preview_options) = self.link_preview_options {
form.text("link_preview_options", link_preview_options)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("text", self.text.to_string());
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl SavePreparedKeyboardButtonOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("button", self.button);
let form = form.text("user_id", self.user_id.to_string());
form
}
}
impl<'a> DeclineSuggestedPostOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("chat_id", self.chat_id.to_string());
let form = form.text("message_id", self.message_id.to_string());
let form = if let Some(comment) = self.comment {
form.text("comment", comment.to_string())
} else {
form
};
form
}
}
impl SavePreparedInlineMessageOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("result", self.result);
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(allow_user_chats) = self.allow_user_chats {
form.text("allow_user_chats", allow_user_chats.to_string())
} else {
form
};
let form = if let Some(allow_bot_chats) = self.allow_bot_chats {
form.text("allow_bot_chats", allow_bot_chats.to_string())
} else {
form
};
let form = if let Some(allow_group_chats) = self.allow_group_chats {
form.text("allow_group_chats", allow_group_chats.to_string())
} else {
form
};
let form = if let Some(allow_channel_chats) = self.allow_channel_chats {
form.text("allow_channel_chats", allow_channel_chats.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditForumTopicOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_thread_id", self.message_thread_id.to_string());
let form = if let Some(name) = self.name {
form.text("name", name.to_string())
} else {
form
};
let form = if let Some(icon_custom_emoji_id) = self.icon_custom_emoji_id {
form.text("icon_custom_emoji_id", icon_custom_emoji_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> SetWebhookOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(certificate) = self.certificate {
form.text("certificate", certificate)
} else {
form
};
let form = if let Some(allowed_updates) = self.allowed_updates {
form.text("allowed_updates", allowed_updates)
} else {
form
};
let form = form.text("url", self.url.to_string());
let form = if let Some(ip_address) = self.ip_address {
form.text("ip_address", ip_address.to_string())
} else {
form
};
let form = if let Some(max_connections) = self.max_connections {
form.text("max_connections", max_connections.to_string())
} else {
form
};
let form = if let Some(drop_pending_updates) = self.drop_pending_updates {
form.text("drop_pending_updates", drop_pending_updates.to_string())
} else {
form
};
let form = if let Some(secret_token) = self.secret_token {
form.text("secret_token", secret_token.to_string())
} else {
form
};
form
}
}
impl<'a> SetUserEmojiStatusOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(emoji_status_custom_emoji_id) = self.emoji_status_custom_emoji_id {
form.text(
"emoji_status_custom_emoji_id",
emoji_status_custom_emoji_id.to_string(),
)
} else {
form
};
let form = if let Some(emoji_status_expiration_date) = self.emoji_status_expiration_date {
form.text(
"emoji_status_expiration_date",
emoji_status_expiration_date.to_string(),
)
} else {
form
};
form
}
}
impl<'a> GetBusinessAccountGiftsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = if let Some(exclude_unsaved) = self.exclude_unsaved {
form.text("exclude_unsaved", exclude_unsaved.to_string())
} else {
form
};
let form = if let Some(exclude_saved) = self.exclude_saved {
form.text("exclude_saved", exclude_saved.to_string())
} else {
form
};
let form = if let Some(exclude_unlimited) = self.exclude_unlimited {
form.text("exclude_unlimited", exclude_unlimited.to_string())
} else {
form
};
let form = if let Some(exclude_limited_upgradable) = self.exclude_limited_upgradable {
form.text(
"exclude_limited_upgradable",
exclude_limited_upgradable.to_string(),
)
} else {
form
};
let form = if let Some(exclude_limited_non_upgradable) = self.exclude_limited_non_upgradable
{
form.text(
"exclude_limited_non_upgradable",
exclude_limited_non_upgradable.to_string(),
)
} else {
form
};
let form = if let Some(exclude_unique) = self.exclude_unique {
form.text("exclude_unique", exclude_unique.to_string())
} else {
form
};
let form = if let Some(exclude_from_blockchain) = self.exclude_from_blockchain {
form.text(
"exclude_from_blockchain",
exclude_from_blockchain.to_string(),
)
} else {
form
};
let form = if let Some(sort_by_price) = self.sort_by_price {
form.text("sort_by_price", sort_by_price.to_string())
} else {
form
};
let form = if let Some(offset) = self.offset {
form.text("offset", offset.to_string())
} else {
form
};
let form = if let Some(limit) = self.limit {
form.text("limit", limit.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SetChatAdministratorCustomTitleOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = form.text("custom_title", self.custom_title.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditGeneralForumTopicOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("name", self.name.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl GetMyDefaultAdministratorRightsOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(for_channels) = self.for_channels {
form.text("for_channels", for_channels.to_string())
} else {
form
};
form
}
}
impl SetMyProfilePhotoOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("photo", self.photo);
form
}
}
impl<V: Into<ChatHandle> + Serialize> UnpinAllChatMessagesOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendAnimationOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("animation", self.animation.to_string());
let form = if let Some(duration) = self.duration {
form.text("duration", duration.to_string())
} else {
form
};
let form = if let Some(width) = self.width {
form.text("width", width.to_string())
} else {
form
};
let form = if let Some(height) = self.height {
form.text("height", height.to_string())
} else {
form
};
let form = if let Some(thumbnail) = self.thumbnail {
form.text("thumbnail", thumbnail.to_string())
} else {
form
};
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
form.text(
"show_caption_above_media",
show_caption_above_media.to_string(),
)
} else {
form
};
let form = if let Some(has_spoiler) = self.has_spoiler {
form.text("has_spoiler", has_spoiler.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl SetMyDefaultAdministratorRightsOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(rights) = self.rights {
form.text("rights", rights)
} else {
form
};
let form = if let Some(for_channels) = self.for_channels {
form.text("for_channels", for_channels.to_string())
} else {
form
};
form
}
}
impl<'a> EditStoryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("content", self.content);
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(areas) = self.areas {
form.text("areas", areas)
} else {
form
};
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("story_id", self.story_id.to_string());
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendPhotoOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("photo", self.photo.to_string());
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
form.text(
"show_caption_above_media",
show_caption_above_media.to_string(),
)
} else {
form
};
let form = if let Some(has_spoiler) = self.has_spoiler {
form.text("has_spoiler", has_spoiler.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> CreateNewStickerSetOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("stickers", self.stickers);
let form = form.text("user_id", self.user_id.to_string());
let form = form.text("name", self.name.to_string());
let form = form.text("title", self.title.to_string());
let form = if let Some(sticker_type) = self.sticker_type {
form.text("sticker_type", sticker_type.to_string())
} else {
form
};
let form = if let Some(needs_repainting) = self.needs_repainting {
form.text("needs_repainting", needs_repainting.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendLocationOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("latitude", self.latitude.to_string());
let form = form.text("longitude", self.longitude.to_string());
let form = if let Some(horizontal_accuracy) = self.horizontal_accuracy {
form.text("horizontal_accuracy", horizontal_accuracy.to_string())
} else {
form
};
let form = if let Some(live_period) = self.live_period {
form.text("live_period", live_period.to_string())
} else {
form
};
let form = if let Some(heading) = self.heading {
form.text("heading", heading.to_string())
} else {
form
};
let form = if let Some(proximity_alert_radius) = self.proximity_alert_radius {
form.text("proximity_alert_radius", proximity_alert_radius.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> GetStickerSetOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("name", self.name.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> GetUserChatBoostsOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> GetMyNameOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl SetChatMenuButtonOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(menu_button) = self.menu_button {
form.text("menu_button", menu_button)
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
form.text("chat_id", chat_id.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditMessageLiveLocationOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let form = if let Some(inline_message_id) = self.inline_message_id {
form.text("inline_message_id", inline_message_id.to_string())
} else {
form
};
let form = form.text("latitude", self.latitude.to_string());
let form = form.text("longitude", self.longitude.to_string());
let form = if let Some(live_period) = self.live_period {
form.text("live_period", live_period.to_string())
} else {
form
};
let form = if let Some(horizontal_accuracy) = self.horizontal_accuracy {
form.text("horizontal_accuracy", horizontal_accuracy.to_string())
} else {
form
};
let form = if let Some(heading) = self.heading {
form.text("heading", heading.to_string())
} else {
form
};
let form = if let Some(proximity_alert_radius) = self.proximity_alert_radius {
form.text("proximity_alert_radius", proximity_alert_radius.to_string())
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
let v: ChatHandle = chat_id.into();
form.text("chat_id", v.to_string())
} else {
form
};
form
}
}
impl<'a> SetBusinessAccountBioOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = if let Some(bio) = self.bio {
form.text("bio", bio.to_string())
} else {
form
};
form
}
}
impl<'a> ConvertGiftToStarsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("owned_gift_id", self.owned_gift_id.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendContactOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("phone_number", self.phone_number.to_string());
let form = form.text("first_name", self.first_name.to_string());
let form = if let Some(last_name) = self.last_name {
form.text("last_name", last_name.to_string())
} else {
form
};
let form = if let Some(vcard) = self.vcard {
form.text("vcard", vcard.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> DeleteStickerFromSetOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("sticker", self.sticker.to_string());
form
}
}
impl<'a> SetStickerSetThumbnailOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("name", self.name.to_string());
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(thumbnail) = self.thumbnail {
form.text("thumbnail", thumbnail.to_string())
} else {
form
};
let form = form.text("format", self.format.to_string());
form
}
}
impl<'a> SetCustomEmojiStickerSetThumbnailOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("name", self.name.to_string());
let form = if let Some(custom_emoji_id) = self.custom_emoji_id {
form.text("custom_emoji_id", custom_emoji_id.to_string())
} else {
form
};
form
}
}
impl<'a> SetStickerSetTitleOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("name", self.name.to_string());
let form = form.text("title", self.title.to_string());
form
}
}
impl<'a> AnswerInlineQueryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("results", self.results);
let form = if let Some(button) = self.button {
form.text("button", button)
} else {
form
};
let form = form.text("inline_query_id", self.inline_query_id.to_string());
let form = if let Some(cache_time) = self.cache_time {
form.text("cache_time", cache_time.to_string())
} else {
form
};
let form = if let Some(is_personal) = self.is_personal {
form.text("is_personal", is_personal.to_string())
} else {
form
};
let form = if let Some(next_offset) = self.next_offset {
form.text("next_offset", next_offset.to_string())
} else {
form
};
form
}
}
impl<'a> GetBusinessConnectionOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
form
}
}
impl<'a> SetBusinessAccountNameOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("first_name", self.first_name.to_string());
let form = if let Some(last_name) = self.last_name {
form.text("last_name", last_name.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditMessageMediaOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("media", self.media);
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let form = if let Some(inline_message_id) = self.inline_message_id {
form.text("inline_message_id", inline_message_id.to_string())
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
let v: ChatHandle = chat_id.into();
form.text("chat_id", v.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> UnhideGeneralForumTopicOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> SetMyShortDescriptionOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(short_description) = self.short_description {
form.text("short_description", short_description.to_string())
} else {
form
};
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> StopPollOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = form.text("message_id", self.message_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl CloseOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
form
}
}
impl<V: Into<ChatHandle> + Serialize> SetMessageReactionOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(reaction) = self.reaction {
form.text("reaction", reaction)
} else {
form
};
let form = form.text("message_id", self.message_id.to_string());
let form = if let Some(is_big) = self.is_big {
form.text("is_big", is_big.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl GetMeOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> EditChatSubscriptionInviteLinkOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("invite_link", self.invite_link.to_string());
let form = if let Some(name) = self.name {
form.text("name", name.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendDiceOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = if let Some(emoji) = self.emoji {
form.text("emoji", emoji.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendAudioOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("audio", self.audio.to_string());
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(duration) = self.duration {
form.text("duration", duration.to_string())
} else {
form
};
let form = if let Some(performer) = self.performer {
form.text("performer", performer.to_string())
} else {
form
};
let form = if let Some(title) = self.title {
form.text("title", title.to_string())
} else {
form
};
let form = if let Some(thumbnail) = self.thumbnail {
form.text("thumbnail", thumbnail.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> TransferGiftOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("owned_gift_id", self.owned_gift_id.to_string());
let form = form.text("new_owner_chat_id", self.new_owner_chat_id.to_string());
let form = if let Some(star_count) = self.star_count {
form.text("star_count", star_count.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> RemoveChatVerificationOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> CopyMessageOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(caption_entities) = self.caption_entities {
form.text("caption_entities", caption_entities)
} else {
form
};
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("message_id", self.message_id.to_string());
let form = if let Some(video_start_timestamp) = self.video_start_timestamp {
form.text("video_start_timestamp", video_start_timestamp.to_string())
} else {
form
};
let form = if let Some(caption) = self.caption {
form.text("caption", caption.to_string())
} else {
form
};
let form = if let Some(parse_mode) = self.parse_mode {
form.text("parse_mode", parse_mode.to_string())
} else {
form
};
let form = if let Some(show_caption_above_media) = self.show_caption_above_media {
form.text(
"show_caption_above_media",
show_caption_above_media.to_string(),
)
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
let v: ChatHandle = self.from_chat_id.into();
let form = form.text("from_chat_id", v.to_string());
form
}
}
impl<'a> GetGameHighScoresOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(chat_id) = self.chat_id {
form.text("chat_id", chat_id.to_string())
} else {
form
};
let form = if let Some(message_id) = self.message_id {
form.text("message_id", message_id.to_string())
} else {
form
};
let form = if let Some(inline_message_id) = self.inline_message_id {
form.text("inline_message_id", inline_message_id.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendVenueOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("latitude", self.latitude.to_string());
let form = form.text("longitude", self.longitude.to_string());
let form = form.text("title", self.title.to_string());
let form = form.text("address", self.address.to_string());
let form = if let Some(foursquare_id) = self.foursquare_id {
form.text("foursquare_id", foursquare_id.to_string())
} else {
form
};
let form = if let Some(foursquare_type) = self.foursquare_type {
form.text("foursquare_type", foursquare_type.to_string())
} else {
form
};
let form = if let Some(google_place_id) = self.google_place_id {
form.text("google_place_id", google_place_id.to_string())
} else {
form
};
let form = if let Some(google_place_type) = self.google_place_type {
form.text("google_place_type", google_place_type.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> UnpinAllForumTopicMessagesOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_thread_id", self.message_thread_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> AnswerWebAppQueryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("result", self.result);
let form = form.text("web_app_query_id", self.web_app_query_id.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> UnbanChatSenderChatOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("sender_chat_id", self.sender_chat_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> AnswerShippingQueryOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(shipping_options) = self.shipping_options {
form.text("shipping_options", shipping_options)
} else {
form
};
let form = form.text("shipping_query_id", self.shipping_query_id.to_string());
let form = form.text("ok", self.ok.to_string());
let form = if let Some(error_message) = self.error_message {
form.text("error_message", error_message.to_string())
} else {
form
};
form
}
}
impl GetMyStarBalanceOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendGiftOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(text_entities) = self.text_entities {
form.text("text_entities", text_entities)
} else {
form
};
let form = if let Some(user_id) = self.user_id {
form.text("user_id", user_id.to_string())
} else {
form
};
let form = form.text("gift_id", self.gift_id.to_string());
let form = if let Some(pay_for_upgrade) = self.pay_for_upgrade {
form.text("pay_for_upgrade", pay_for_upgrade.to_string())
} else {
form
};
let form = if let Some(text) = self.text {
form.text("text", text.to_string())
} else {
form
};
let form = if let Some(text_parse_mode) = self.text_parse_mode {
form.text("text_parse_mode", text_parse_mode.to_string())
} else {
form
};
let form = if let Some(chat_id) = self.chat_id {
let v: ChatHandle = chat_id.into();
form.text("chat_id", v.to_string())
} else {
form
};
form
}
}
impl<'a> GetFileOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("file_id", self.file_id.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> CreateChatSubscriptionInviteLinkOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(name) = self.name {
form.text("name", name.to_string())
} else {
form
};
let form = form.text("subscription_period", self.subscription_period.to_string());
let form = form.text("subscription_price", self.subscription_price.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SetChatStickerSetOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("sticker_set_name", self.sticker_set_name.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> ReopenForumTopicOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_thread_id", self.message_thread_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> VerifyUserOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(custom_description) = self.custom_description {
form.text("custom_description", custom_description.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> ForwardMessagesOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_ids", self.message_ids);
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
let v: ChatHandle = self.from_chat_id.into();
let form = form.text("from_chat_id", v.to_string());
form
}
}
impl GetUserProfilePhotosOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(offset) = self.offset {
form.text("offset", offset.to_string())
} else {
form
};
let form = if let Some(limit) = self.limit {
form.text("limit", limit.to_string())
} else {
form
};
form
}
}
impl<'a> SetMyCommandsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("commands", self.commands);
let form = if let Some(scope) = self.scope {
form.text("scope", scope)
} else {
form
};
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl<'a> DeleteMyCommandsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(scope) = self.scope {
form.text("scope", scope)
} else {
form
};
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl<'a> DeleteBusinessMessagesOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_ids", self.message_ids);
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
form
}
}
impl<'a> SetBusinessAccountProfilePhotoOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("photo", self.photo);
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = if let Some(is_public) = self.is_public {
form.text("is_public", is_public.to_string())
} else {
form
};
form
}
}
impl<V: Into<ChatHandle> + Serialize> BanChatSenderChatOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("sender_chat_id", self.sender_chat_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> GetChatMemberCountOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl GetManagedBotTokenOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> CloseForumTopicOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("message_thread_id", self.message_thread_id.to_string());
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> LeaveChatOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<V: Into<ChatHandle> + Serialize> GetChatAdministratorsOpts<V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl LogOutOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
form
}
}
impl<'a> SetMyNameOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(name) = self.name {
form.text("name", name.to_string())
} else {
form
};
let form = if let Some(language_code) = self.language_code {
form.text("language_code", language_code.to_string())
} else {
form
};
form
}
}
impl ApproveSuggestedPostOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("chat_id", self.chat_id.to_string());
let form = form.text("message_id", self.message_id.to_string());
let form = if let Some(send_date) = self.send_date {
form.text("send_date", send_date.to_string())
} else {
form
};
form
}
}
impl<'a, V: Into<ChatHandle> + Serialize> SendStickerOpts<'a, V> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = if let Some(suggested_post_parameters) = self.suggested_post_parameters {
form.text("suggested_post_parameters", suggested_post_parameters)
} else {
form
};
let form = if let Some(reply_parameters) = self.reply_parameters {
form.text("reply_parameters", reply_parameters)
} else {
form
};
let form = if let Some(reply_markup) = self.reply_markup {
form.text("reply_markup", reply_markup)
} else {
form
};
let form = if let Some(business_connection_id) = self.business_connection_id {
form.text("business_connection_id", business_connection_id.to_string())
} else {
form
};
let form = if let Some(message_thread_id) = self.message_thread_id {
form.text("message_thread_id", message_thread_id.to_string())
} else {
form
};
let form = if let Some(direct_messages_topic_id) = self.direct_messages_topic_id {
form.text(
"direct_messages_topic_id",
direct_messages_topic_id.to_string(),
)
} else {
form
};
let form = form.text("sticker", self.sticker.to_string());
let form = if let Some(emoji) = self.emoji {
form.text("emoji", emoji.to_string())
} else {
form
};
let form = if let Some(disable_notification) = self.disable_notification {
form.text("disable_notification", disable_notification.to_string())
} else {
form
};
let form = if let Some(protect_content) = self.protect_content {
form.text("protect_content", protect_content.to_string())
} else {
form
};
let form = if let Some(allow_paid_broadcast) = self.allow_paid_broadcast {
form.text("allow_paid_broadcast", allow_paid_broadcast.to_string())
} else {
form
};
let form = if let Some(message_effect_id) = self.message_effect_id {
form.text("message_effect_id", message_effect_id.to_string())
} else {
form
};
let v: ChatHandle = self.chat_id.into();
let form = form.text("chat_id", v.to_string());
form
}
}
impl<'a> ReadBusinessMessageOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text(
"business_connection_id",
self.business_connection_id.to_string(),
);
let form = form.text("chat_id", self.chat_id.to_string());
let form = form.text("message_id", self.message_id.to_string());
form
}
}
impl GetCustomEmojiStickersOpts {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("custom_emoji_ids", self.custom_emoji_ids);
form
}
}
impl<'a> UploadStickerFileOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("sticker", self.sticker);
let form = form.text("user_id", self.user_id.to_string());
let form = form.text("sticker_format", self.sticker_format.to_string());
form
}
}
impl<'a> GetUserGiftsOpts<'a> {
#[allow(clippy::let_and_return, dead_code)]
fn get_form(self, form: Form) -> Form {
let form = form.text("user_id", self.user_id.to_string());
let form = if let Some(exclude_unlimited) = self.exclude_unlimited {
form.text("exclude_unlimited", exclude_unlimited.to_string())
} else {
form
};
let form = if let Some(exclude_limited_upgradable) = self.exclude_limited_upgradable {
form.text(
"exclude_limited_upgradable",
exclude_limited_upgradable.to_string(),
)
} else {
form
};
let form = if let Some(exclude_limited_non_upgradable) = self.exclude_limited_non_upgradable
{
form.text(
"exclude_limited_non_upgradable",
exclude_limited_non_upgradable.to_string(),
)
} else {
form
};
let form = if let Some(exclude_from_blockchain) = self.exclude_from_blockchain {
form.text(
"exclude_from_blockchain",
exclude_from_blockchain.to_string(),
)
} else {
form
};
let form = if let Some(exclude_unique) = self.exclude_unique {
form.text("exclude_unique", exclude_unique.to_string())
} else {
form
};
let form = if let Some(sort_by_price) = self.sort_by_price {
form.text("sort_by_price", sort_by_price.to_string())
} else {
form
};
let form = if let Some(offset) = self.offset {
form.text("offset", offset.to_string())
} else {
form
};
let form = if let Some(limit) = self.limit {
form.text("limit", limit.to_string())
} else {
form
};
form
}
}
impl Bot {
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success."]
pub async fn get_my_short_description<'a>(
&self,
language_code: Option<&'a str>,
) -> BotResult<BotShortDescription> {
let form = GetMyShortDescriptionOpts { language_code };
let resp = self.post("getMyShortDescription", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future."]
pub async fn send_voice<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
voice: FileData,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
duration: Option<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let data = Form::new();
let (data, voice_json) = voice.convert_form(data, "voice".to_owned())?;
let form = SendVoiceOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
voice: voice_json,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
duration,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post_data("sendVoice", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the gifts owned by a chat. Returns OwnedGifts on success."]
pub async fn get_chat_gifts<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
exclude_unsaved: Option<bool>,
exclude_saved: Option<bool>,
exclude_unlimited: Option<bool>,
exclude_limited_upgradable: Option<bool>,
exclude_limited_non_upgradable: Option<bool>,
exclude_from_blockchain: Option<bool>,
exclude_unique: Option<bool>,
sort_by_price: Option<bool>,
offset: Option<&'a str>,
limit: Option<i64>,
) -> BotResult<OwnedGifts> {
let form = GetChatGiftsOpts {
chat_id,
exclude_unsaved,
exclude_saved,
exclude_unlimited,
exclude_limited_upgradable,
exclude_limited_non_upgradable,
exclude_from_blockchain,
exclude_unique,
sort_by_price,
offset,
limit,
};
let resp = self.post("getChatGifts", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub async fn ban_chat_member<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
until_date: Option<i64>,
revoke_messages: Option<bool>,
) -> BotResult<bool> {
let form = BanChatMemberOpts {
chat_id,
user_id,
until_date,
revoke_messages,
};
let resp = self.post("banChatMember", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success."]
pub async fn set_business_account_username<'a>(
&self,
business_connection_id: &'a str,
username: Option<&'a str>,
) -> BotResult<bool> {
let form = SetBusinessAccountUsernameOpts {
business_connection_id,
username,
};
let resp = self.post("setBusinessAccountUsername", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned."]
pub async fn get_my_commands<'a>(
&self,
scope: Option<&'a BotCommandScope>,
language_code: Option<&'a str>,
) -> BotResult<Vec<BotCommand>> {
let form = GetMyCommandsOpts {
scope: if let Some(scope) = scope {
Some(serde_json::to_string(&scope)?)
} else {
None
},
language_code,
};
let resp = self.post("getMyCommands", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success."]
pub async fn delete_story<'a>(
&self,
business_connection_id: &'a str,
story_id: i64,
) -> BotResult<bool> {
let form = DeleteStoryOpts {
business_connection_id,
story_id,
};
let resp = self.post("deleteStory", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
pub async fn edit_message_reply_markup<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<MessageBool> {
let form = EditMessageReplyMarkupOpts {
business_connection_id,
chat_id,
message_id,
inline_message_id,
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("editMessageReplyMarkup", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success."]
pub async fn replace_sticker_in_set<'a>(
&self,
user_id: i64,
name: &'a str,
old_sticker: &'a str,
sticker: &'a InputSticker,
) -> BotResult<bool> {
let form = ReplaceStickerInSetOpts {
user_id,
name,
old_sticker,
sticker: serde_json::to_string(&sticker)?,
};
let resp = self.post("replaceStickerInSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success."]
pub async fn unpin_all_general_forum_topic_messages<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = UnpinAllGeneralForumTopicMessagesOpts { chat_id };
let resp = self.post("unpinAllGeneralForumTopicMessages", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a sticker set that was created by the bot. Returns True on success."]
pub async fn delete_sticker_set<'a>(&self, name: &'a str) -> BotResult<bool> {
let form = DeleteStickerSetOpts { name };
let resp = self.post("deleteStickerSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the can_manage_tags administrator right. Returns True on success."]
pub async fn set_chat_member_tag<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
tag: Option<&'a str>,
) -> BotResult<bool> {
let form = SetChatMemberTagOpts {
chat_id,
user_id,
tag,
};
let resp = self.post("setChatMemberTag", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."]
pub async fn set_sticker_emoji_list<'a>(
&self,
sticker: &'a str,
emoji_list: &'a Vec<String>,
) -> BotResult<bool> {
let form = SetStickerEmojiListOpts {
sticker,
emoji_list: serde_json::to_string(&emoji_list)?,
};
let resp = self.post("setStickerEmojiList", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned."]
pub async fn answer_callback_query<'a>(
&self,
callback_query_id: &'a str,
text: Option<&'a str>,
show_alert: Option<bool>,
url: Option<&'a str>,
cache_time: Option<i64>,
) -> BotResult<bool> {
let form = AnswerCallbackQueryOpts {
callback_query_id,
text,
show_alert,
url,
cache_time,
};
let resp = self.post("answerCallbackQuery", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success."]
pub async fn add_sticker_to_set<'a>(
&self,
user_id: i64,
name: &'a str,
sticker: &'a InputSticker,
) -> BotResult<bool> {
let form = AddStickerToSetOpts {
user_id,
name,
sticker: serde_json::to_string(&sticker)?,
};
let resp = self.post("addStickerToSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success."]
pub async fn edit_user_star_subscription<'a>(
&self,
user_id: i64,
telegram_payment_charge_id: &'a str,
is_canceled: bool,
) -> BotResult<bool> {
let form = EditUserStarSubscriptionOpts {
user_id,
telegram_payment_charge_id,
is_canceled,
};
let resp = self.post("editUserStarSubscription", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub async fn set_chat_title<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
title: &'a str,
) -> BotResult<bool> {
let form = SetChatTitleOpts { chat_id, title };
let resp = self.post("setChatTitle", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send paid media. On success, the sent Message is returned."]
pub async fn send_paid_media<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
star_count: i64,
media: &'a Vec<InputPaidMedia>,
payload: Option<&'a str>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let form = SendPaidMediaOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
star_count,
media: serde_json::to_string(&media)?,
payload,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
show_caption_above_media,
disable_notification,
protect_content,
allow_paid_broadcast,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendPaidMedia", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success."]
pub async fn unban_chat_member<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
only_if_banned: Option<bool>,
) -> BotResult<bool> {
let form = UnbanChatMemberOpts {
chat_id,
user_id,
only_if_banned,
};
let resp = self.post("unbanChatMember", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Removes the profile photo of the bot. Requires no parameters. Returns True on success."]
pub async fn remove_my_profile_photo<'a>(&self) -> BotResult<bool> {
let resp = self.post_empty("removeMyProfilePhoto").await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object."]
pub async fn create_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
name: &'a str,
icon_color: Option<i64>,
icon_custom_emoji_id: Option<&'a str>,
) -> BotResult<ForumTopic> {
let form = CreateForumTopicOpts {
chat_id,
name,
icon_color,
icon_custom_emoji_id,
};
let resp = self.post("createForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future."]
pub async fn send_document<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
document: FileData,
thumbnail: Option<FileData>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
disable_content_type_detection: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let data = Form::new();
let (data, document_json) = document.convert_form(data, "document".to_owned())?;
let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
(data, Some(thumbnail_json))
} else {
(data, None)
};
let form = SendDocumentOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
document: document_json,
thumbnail: thumbnail_json,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
disable_content_type_detection,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post_data("sendDocument", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object."]
pub async fn revoke_chat_invite_link<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
invite_link: &'a str,
) -> BotResult<ChatInviteLink> {
let form = RevokeChatInviteLinkOpts {
chat_id,
invite_link,
};
let resp = self.post("revokeChatInviteLink", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success."]
pub async fn hide_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = HideGeneralForumTopicOpts { chat_id };
let resp = self.post("hideGeneralForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned."]
pub async fn stop_message_live_location<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<MessageBool> {
let form = StopMessageLiveLocationOpts {
business_connection_id,
chat_id,
message_id,
inline_message_id,
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("stopMessageLiveLocation", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success."]
pub async fn set_sticker_mask_position<'a>(
&self,
sticker: &'a str,
mask_position: Option<&'a MaskPosition>,
) -> BotResult<bool> {
let form = SetStickerMaskPositionOpts {
sticker,
mask_position: if let Some(mask_position) = mask_position {
Some(serde_json::to_string(&mask_position)?)
} else {
None
},
};
let resp = self.post("setStickerMaskPosition", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success."]
pub async fn delete_webhook<'a>(&self, drop_pending_updates: Option<bool>) -> BotResult<bool> {
let form = DeleteWebhookOpts {
drop_pending_updates,
};
let resp = self.post("deleteWebhook", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send invoices. On success, the sent Message is returned."]
pub async fn send_invoice<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
title: &'a str,
description: &'a str,
payload: &'a str,
provider_token: Option<&'a str>,
currency: &'a str,
prices: &'a Vec<LabeledPrice>,
max_tip_amount: Option<i64>,
suggested_tip_amounts: Option<&'a Vec<i64>>,
start_parameter: Option<&'a str>,
provider_data: Option<&'a str>,
photo_url: Option<&'a str>,
photo_size: Option<i64>,
photo_width: Option<i64>,
photo_height: Option<i64>,
need_name: Option<bool>,
need_phone_number: Option<bool>,
need_email: Option<bool>,
need_shipping_address: Option<bool>,
send_phone_number_to_provider: Option<bool>,
send_email_to_provider: Option<bool>,
is_flexible: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<Message> {
let form = SendInvoiceOpts {
chat_id,
message_thread_id,
direct_messages_topic_id,
title,
description,
payload,
provider_token,
currency,
prices: serde_json::to_string(&prices)?,
max_tip_amount,
suggested_tip_amounts: if let Some(suggested_tip_amounts) = suggested_tip_amounts {
Some(serde_json::to_string(&suggested_tip_amounts)?)
} else {
None
},
start_parameter,
provider_data,
photo_url,
photo_size,
photo_width,
photo_height,
need_name,
need_phone_number,
need_email,
need_shipping_address,
send_phone_number_to_provider,
send_email_to_provider,
is_flexible,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendInvoice", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive."]
pub async fn send_chat_action<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
action: &'a str,
) -> BotResult<bool> {
let form = SendChatActionOpts {
business_connection_id,
chat_id,
message_thread_id,
action,
};
let resp = self.post("sendChatAction", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent."]
pub async fn answer_pre_checkout_query<'a>(
&self,
pre_checkout_query_id: &'a str,
ok: bool,
error_message: Option<&'a str>,
) -> BotResult<bool> {
let form = AnswerPreCheckoutQueryOpts {
pre_checkout_query_id,
ok,
error_message,
};
let resp = self.post("answerPreCheckoutQuery", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success."]
pub async fn set_sticker_position_in_set<'a>(
&self,
sticker: &'a str,
position: i64,
) -> BotResult<bool> {
let form = SetStickerPositionInSetOpts { sticker, position };
let resp = self.post("setStickerPositionInSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send a game. On success, the sent Message is returned."]
pub async fn send_game<'a>(
&self,
business_connection_id: Option<&'a str>,
chat_id: i64,
message_thread_id: Option<i64>,
game_short_name: &'a str,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<Message> {
let form = SendGameOpts {
business_connection_id,
chat_id,
message_thread_id,
game_short_name,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendGame", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success."]
pub async fn export_chat_invite_link<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<String> {
let form = ExportChatInviteLinkOpts { chat_id };
let resp = self.post("exportChatInviteLink", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub async fn set_chat_photo<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
photo: FileData,
) -> BotResult<bool> {
let data = Form::new();
let (data, photo_json) = photo.convert_form(data, "photo".to_owned())?;
let form = SetChatPhotoOpts {
chat_id,
photo: photo_json,
};
let resp = self.post_data("setChatPhoto", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub async fn delete_chat_photo<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = DeleteChatPhotoOpts { chat_id };
let resp = self.post("deleteChatPhoto", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success."]
pub async fn get_chat_member<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
) -> BotResult<ChatMember> {
let form = GetChatMemberOpts { chat_id, user_id };
let resp = self.post("getChatMember", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
pub async fn edit_message_caption<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<MessageBool> {
let form = EditMessageCaptionOpts {
business_connection_id,
chat_id,
message_id,
inline_message_id,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
show_caption_above_media,
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("editMessageCaption", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Service messages about a supergroup, channel, or forum topic creation can't be deleted.- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages administrator right in a supergroup or a channel, it can delete any message there.- If the bot has can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct messages chat.Returns True on success."]
pub async fn delete_message<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_id: i64,
) -> BotResult<bool> {
let form = DeleteMessageOpts {
chat_id,
message_id,
};
let resp = self.post("deleteMessage", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object."]
pub async fn edit_chat_invite_link<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
invite_link: &'a str,
name: Option<&'a str>,
expire_date: Option<i64>,
member_limit: Option<i64>,
creates_join_request: Option<bool>,
) -> BotResult<ChatInviteLink> {
let form = EditChatInviteLinkOpts {
chat_id,
invite_link,
name,
expire_date,
member_limit,
creates_join_request,
};
let resp = self.post("editChatInviteLink", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues."]
pub async fn set_passport_data_errors<'a>(
&self,
user_id: i64,
errors: &'a Vec<PassportElementError>,
) -> BotResult<bool> {
let form = SetPassportDataErrorsOpts {
user_id,
errors: serde_json::to_string(&errors)?,
};
let resp = self.post("setPassportDataErrors", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success."]
pub async fn set_chat_permissions<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
permissions: &'a ChatPermissions,
use_independent_chat_permissions: Option<bool>,
) -> BotResult<bool> {
let form = SetChatPermissionsOpts {
chat_id,
permissions: serde_json::to_string(&permissions)?,
use_independent_chat_permissions,
};
let resp = self.post("setChatPermissions", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success."]
pub async fn post_story<'a>(
&self,
business_connection_id: &'a str,
content: &'a InputStoryContent,
active_period: i64,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
areas: Option<&'a Vec<StoryArea>>,
post_to_chat_page: Option<bool>,
protect_content: Option<bool>,
) -> BotResult<Story> {
let form = PostStoryOpts {
business_connection_id,
content: serde_json::to_string(&content)?,
active_period,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
areas: if let Some(areas) = areas {
Some(serde_json::to_string(&areas)?)
} else {
None
},
post_to_chat_page,
protect_content,
};
let resp = self.post("postStory", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects."]
pub async fn get_updates<'a>(
&self,
offset: Option<i64>,
limit: Option<i64>,
timeout: Option<i64>,
allowed_updates: Option<&'a Vec<String>>,
) -> BotResult<Vec<Update>> {
let form = GetUpdatesOpts {
offset,
limit,
timeout,
allowed_updates: if let Some(allowed_updates) = allowed_updates {
Some(serde_json::to_string(&allowed_updates)?)
} else {
None
},
};
let resp = self.post("getUpdates", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned."]
pub async fn copy_messages<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_ids: &'a Vec<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
remove_caption: Option<bool>,
) -> BotResult<Vec<MessageId>> {
let form = CopyMessagesOpts {
chat_id,
message_thread_id,
direct_messages_topic_id,
from_chat_id,
message_ids: serde_json::to_string(&message_ids)?,
disable_notification,
protect_content,
remove_caption,
};
let resp = self.post("copyMessages", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Gifts a Telegram Premium subscription to the given user. Returns True on success."]
pub async fn gift_premium_subscription<'a>(
&self,
user_id: i64,
month_count: i64,
star_count: i64,
text: Option<&'a str>,
text_parse_mode: Option<&'a str>,
text_entities: Option<&'a Vec<MessageEntity>>,
) -> BotResult<bool> {
let form = GiftPremiumSubscriptionOpts {
user_id,
month_count,
star_count,
text,
text_parse_mode,
text_entities: if let Some(text_entities) = text_entities {
Some(serde_json::to_string(&text_entities)?)
} else {
None
},
};
let resp = self.post("giftPremiumSubscription", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty."]
pub async fn get_webhook_info<'a>(&self) -> BotResult<WebhookInfo> {
let resp = self.post_empty("getWebhookInfo").await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success."]
pub async fn approve_chat_join_request<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
) -> BotResult<bool> {
let form = ApproveChatJoinRequestOpts { chat_id, user_id };
let resp = self.post("approveChatJoinRequest", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success."]
pub async fn transfer_business_account_stars<'a>(
&self,
business_connection_id: &'a str,
star_count: i64,
) -> BotResult<bool> {
let form = TransferBusinessAccountStarsOpts {
business_connection_id,
star_count,
};
let resp = self.post("transferBusinessAccountStars", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object."]
pub async fn get_star_transactions<'a>(
&self,
offset: Option<i64>,
limit: Option<i64>,
) -> BotResult<StarTransactions> {
let form = GetStarTransactionsOpts { offset, limit };
let resp = self.post("getStarTransactions", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False."]
pub async fn set_game_score<'a>(
&self,
user_id: i64,
score: i64,
force: Option<bool>,
disable_edit_message: Option<bool>,
chat_id: Option<i64>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
) -> BotResult<MessageBool> {
let form = SetGameScoreOpts {
user_id,
score,
force,
disable_edit_message,
chat_id,
message_id,
inline_message_id,
};
let resp = self.post("setGameScore", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success."]
pub async fn get_business_account_star_balance<'a>(
&self,
business_connection_id: &'a str,
) -> BotResult<StarAmount> {
let form = GetBusinessAccountStarBalanceOpts {
business_connection_id,
};
let resp = self.post("getBusinessAccountStarBalance", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current bot description for the given user language. Returns BotDescription on success."]
pub async fn get_my_description<'a>(
&self,
language_code: Option<&'a str>,
) -> BotResult<BotDescription> {
let form = GetMyDescriptionOpts { language_code };
let resp = self.post("getMyDescription", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned."]
pub async fn forward_message<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
video_start_timestamp: Option<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
message_id: i64,
) -> BotResult<Message> {
let form = ForwardMessageOpts {
chat_id,
message_thread_id,
direct_messages_topic_id,
from_chat_id,
video_start_timestamp,
disable_notification,
protect_content,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
message_id,
};
let resp = self.post("forwardMessage", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success."]
pub async fn set_my_description<'a>(
&self,
description: Option<&'a str>,
language_code: Option<&'a str>,
) -> BotResult<bool> {
let form = SetMyDescriptionOpts {
description,
language_code,
};
let resp = self.post("setMyDescription", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success."]
pub async fn set_business_account_gift_settings<'a>(
&self,
business_connection_id: &'a str,
show_gift_button: bool,
accepted_gift_types: &'a AcceptedGiftTypes,
) -> BotResult<bool> {
let form = SetBusinessAccountGiftSettingsOpts {
business_connection_id,
show_gift_button,
accepted_gift_types: serde_json::to_string(&accepted_gift_types)?,
};
let resp = self.post("setBusinessAccountGiftSettings", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success."]
pub async fn delete_messages<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_ids: &'a Vec<i64>,
) -> BotResult<bool> {
let form = DeleteMessagesOpts {
chat_id,
message_ids: serde_json::to_string(&message_ids)?,
};
let resp = self.post("deleteMessages", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create a link for an invoice. Returns the created invoice link as String on success."]
pub async fn create_invoice_link<'a>(
&self,
business_connection_id: Option<&'a str>,
title: &'a str,
description: &'a str,
payload: &'a str,
provider_token: Option<&'a str>,
currency: &'a str,
prices: &'a Vec<LabeledPrice>,
subscription_period: Option<i64>,
max_tip_amount: Option<i64>,
suggested_tip_amounts: Option<&'a Vec<i64>>,
provider_data: Option<&'a str>,
photo_url: Option<&'a str>,
photo_size: Option<i64>,
photo_width: Option<i64>,
photo_height: Option<i64>,
need_name: Option<bool>,
need_phone_number: Option<bool>,
need_email: Option<bool>,
need_shipping_address: Option<bool>,
send_phone_number_to_provider: Option<bool>,
send_email_to_provider: Option<bool>,
is_flexible: Option<bool>,
) -> BotResult<String> {
let form = CreateInvoiceLinkOpts {
business_connection_id,
title,
description,
payload,
provider_token,
currency,
prices: serde_json::to_string(&prices)?,
subscription_period,
max_tip_amount,
suggested_tip_amounts: if let Some(suggested_tip_amounts) = suggested_tip_amounts {
Some(serde_json::to_string(&suggested_tip_amounts)?)
} else {
None
},
provider_data,
photo_url,
photo_size,
photo_width,
photo_height,
need_name,
need_phone_number,
need_email,
need_shipping_address,
send_phone_number_to_provider,
send_email_to_provider,
is_flexible,
};
let resp = self.post("createInvoiceLink", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success."]
pub async fn repost_story<'a>(
&self,
business_connection_id: &'a str,
from_chat_id: i64,
from_story_id: i64,
active_period: i64,
post_to_chat_page: Option<bool>,
protect_content: Option<bool>,
) -> BotResult<Story> {
let form = RepostStoryOpts {
business_connection_id,
from_chat_id,
from_story_id,
active_period,
post_to_chat_page,
protect_content,
};
let resp = self.post("repostStory", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success."]
pub async fn decline_chat_join_request<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
) -> BotResult<bool> {
let form = DeclineChatJoinRequestOpts { chat_id, user_id };
let resp = self.post("declineChatJoinRequest", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Refunds a successful payment in Telegram Stars. Returns True on success."]
pub async fn refund_star_payment<'a>(
&self,
user_id: i64,
telegram_payment_charge_id: &'a str,
) -> BotResult<bool> {
let form = RefundStarPaymentOpts {
user_id,
telegram_payment_charge_id,
};
let resp = self.post("refundStarPayment", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Message objects that were sent is returned."]
pub async fn send_media_group<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
media: &'a Vec<EMedia>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
reply_parameters: Option<&'a ReplyParameters>,
) -> BotResult<Vec<Message>> {
let form = SendMediaGroupOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
media: serde_json::to_string(&media)?,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
};
let resp = self.post("sendMediaGroup", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success."]
pub async fn verify_chat<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
custom_description: Option<&'a str>,
) -> BotResult<bool> {
let form = VerifyChatOpts {
chat_id,
custom_description,
};
let resp = self.post("verifyChat", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to stream a partial message to a user while the message is being generated. Returns True on success."]
pub async fn send_message_draft<'a>(
&self,
chat_id: i64,
message_thread_id: Option<i64>,
draft_id: i64,
text: &'a str,
parse_mode: Option<&'a str>,
entities: Option<&'a Vec<MessageEntity>>,
) -> BotResult<bool> {
let form = SendMessageDraftOpts {
chat_id,
message_thread_id,
draft_id,
text,
parse_mode,
entities: if let Some(entities) = entities {
Some(serde_json::to_string(&entities)?)
} else {
None
},
};
let resp = self.post("sendMessageDraft", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success."]
pub async fn restrict_chat_member<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
permissions: &'a ChatPermissions,
use_independent_chat_permissions: Option<bool>,
until_date: Option<i64>,
) -> BotResult<bool> {
let form = RestrictChatMemberOpts {
chat_id,
user_id,
permissions: serde_json::to_string(&permissions)?,
use_independent_chat_permissions,
until_date,
};
let resp = self.post("restrictChatMember", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success."]
pub async fn remove_user_verification<'a>(&self, user_id: i64) -> BotResult<bool> {
let form = RemoveUserVerificationOpts { user_id };
let resp = self.post("removeUserVerification", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future."]
pub async fn send_video<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
video: FileData,
duration: Option<i64>,
width: Option<i64>,
height: Option<i64>,
thumbnail: Option<FileData>,
cover: Option<FileData>,
start_timestamp: Option<i64>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
has_spoiler: Option<bool>,
supports_streaming: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let data = Form::new();
let (data, video_json) = video.convert_form(data, "video".to_owned())?;
let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
(data, Some(thumbnail_json))
} else {
(data, None)
};
let (data, cover_json) = if let Some(cover) = cover {
let (data, cover_json) = cover.convert_form(data, "cover".to_owned())?;
(data, Some(cover_json))
} else {
(data, None)
};
let form = SendVideoOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
video: video_json,
duration,
width,
height,
thumbnail: thumbnail_json,
cover: cover_json,
start_timestamp,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
show_caption_above_media,
has_spoiler,
supports_streaming,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post_data("sendVideo", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success."]
pub async fn upgrade_gift<'a>(
&self,
business_connection_id: &'a str,
owned_gift_id: &'a str,
keep_original_details: Option<bool>,
star_count: Option<i64>,
) -> BotResult<bool> {
let form = UpgradeGiftOpts {
business_connection_id,
owned_gift_id,
keep_original_details,
star_count,
};
let resp = self.post("upgradeGift", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object."]
pub async fn create_chat_invite_link<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
name: Option<&'a str>,
expire_date: Option<i64>,
member_limit: Option<i64>,
creates_join_request: Option<bool>,
) -> BotResult<ChatInviteLink> {
let form = CreateChatInviteLinkOpts {
chat_id,
name,
expire_date,
member_limit,
creates_join_request,
};
let resp = self.post("createChatInviteLink", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success."]
pub async fn get_chat<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<ChatFullInfo> {
let form = GetChatOpts { chat_id };
let resp = self.post("getChat", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned."]
pub async fn send_video_note<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
video_note: FileData,
duration: Option<i64>,
length: Option<i64>,
thumbnail: Option<FileData>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let data = Form::new();
let (data, video_note_json) = video_note.convert_form(data, "video_note".to_owned())?;
let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
(data, Some(thumbnail_json))
} else {
(data, None)
};
let form = SendVideoNoteOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
video_note: video_note_json,
duration,
length,
thumbnail: thumbnail_json,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post_data("sendVideoNote", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send a native poll. On success, the sent Message is returned."]
pub async fn send_poll<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
question: &'a str,
question_parse_mode: Option<&'a str>,
question_entities: Option<&'a Vec<MessageEntity>>,
options: &'a Vec<InputPollOption>,
is_anonymous: Option<bool>,
tg_type: Option<&'a str>,
allows_multiple_answers: Option<bool>,
allows_revoting: Option<bool>,
shuffle_options: Option<bool>,
allow_adding_options: Option<bool>,
hide_results_until_closes: Option<bool>,
correct_option_ids: Option<&'a Vec<i64>>,
explanation: Option<&'a str>,
explanation_parse_mode: Option<&'a str>,
explanation_entities: Option<&'a Vec<MessageEntity>>,
open_period: Option<i64>,
close_date: Option<i64>,
is_closed: Option<bool>,
description: Option<&'a str>,
description_parse_mode: Option<&'a str>,
description_entities: Option<&'a Vec<MessageEntity>>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let form = SendPollOpts {
business_connection_id,
chat_id,
message_thread_id,
question,
question_parse_mode,
question_entities: if let Some(question_entities) = question_entities {
Some(serde_json::to_string(&question_entities)?)
} else {
None
},
options: serde_json::to_string(&options)?,
is_anonymous,
tg_type,
allows_multiple_answers,
allows_revoting,
shuffle_options,
allow_adding_options,
hide_results_until_closes,
correct_option_ids: if let Some(correct_option_ids) = correct_option_ids {
Some(serde_json::to_string(&correct_option_ids)?)
} else {
None
},
explanation,
explanation_parse_mode,
explanation_entities: if let Some(explanation_entities) = explanation_entities {
Some(serde_json::to_string(&explanation_entities)?)
} else {
None
},
open_period,
close_date,
is_closed,
description,
description_parse_mode,
description_entities: if let Some(description_entities) = description_entities {
Some(serde_json::to_string(&description_entities)?)
} else {
None
},
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendPoll", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned."]
pub async fn edit_message_checklist<'a>(
&self,
business_connection_id: &'a str,
chat_id: i64,
message_id: i64,
checklist: &'a InputChecklist,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<Message> {
let form = EditMessageChecklistOpts {
business_connection_id,
chat_id,
message_id,
checklist: serde_json::to_string(&checklist)?,
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("editMessageChecklist", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned."]
pub async fn send_checklist<'a>(
&self,
business_connection_id: &'a str,
chat_id: i64,
checklist: &'a InputChecklist,
disable_notification: Option<bool>,
protect_content: Option<bool>,
message_effect_id: Option<&'a str>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<Message> {
let form = SendChecklistOpts {
business_connection_id,
chat_id,
checklist: serde_json::to_string(&checklist)?,
disable_notification,
protect_content,
message_effect_id,
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendChecklist", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object."]
pub async fn get_user_profile_audios<'a>(
&self,
user_id: i64,
offset: Option<i64>,
limit: Option<i64>,
) -> BotResult<UserProfileAudios> {
let form = GetUserProfileAudiosOpts {
user_id,
offset,
limit,
};
let resp = self.post("getUserProfileAudios", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object."]
pub async fn get_available_gifts<'a>(&self) -> BotResult<Gifts> {
let resp = self.post_empty("getAvailableGifts").await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success."]
pub async fn promote_chat_member<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
is_anonymous: Option<bool>,
can_manage_chat: Option<bool>,
can_delete_messages: Option<bool>,
can_manage_video_chats: Option<bool>,
can_restrict_members: Option<bool>,
can_promote_members: Option<bool>,
can_change_info: Option<bool>,
can_invite_users: Option<bool>,
can_post_stories: Option<bool>,
can_edit_stories: Option<bool>,
can_delete_stories: Option<bool>,
can_post_messages: Option<bool>,
can_edit_messages: Option<bool>,
can_pin_messages: Option<bool>,
can_manage_topics: Option<bool>,
can_manage_direct_messages: Option<bool>,
can_manage_tags: Option<bool>,
) -> BotResult<bool> {
let form = PromoteChatMemberOpts {
chat_id,
user_id,
is_anonymous,
can_manage_chat,
can_delete_messages,
can_manage_video_chats,
can_restrict_members,
can_promote_members,
can_change_info,
can_invite_users,
can_post_stories,
can_edit_stories,
can_delete_stories,
can_post_messages,
can_edit_messages,
can_pin_messages,
can_manage_topics,
can_manage_direct_messages,
can_manage_tags,
};
let resp = self.post("promoteChatMember", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True on success."]
pub async fn pin_chat_message<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_id: i64,
disable_notification: Option<bool>,
) -> BotResult<bool> {
let form = PinChatMessageOpts {
business_connection_id,
chat_id,
message_id,
disable_notification,
};
let resp = self.post("pinChatMessage", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."]
pub async fn set_sticker_keywords<'a>(
&self,
sticker: &'a str,
keywords: Option<&'a Vec<String>>,
) -> BotResult<bool> {
let form = SetStickerKeywordsOpts {
sticker,
keywords: if let Some(keywords) = keywords {
Some(serde_json::to_string(&keywords)?)
} else {
None
},
};
let resp = self.post("setStickerKeywords", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success."]
pub async fn delete_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: i64,
) -> BotResult<bool> {
let form = DeleteForumTopicOpts {
chat_id,
message_thread_id,
};
let resp = self.post("deleteForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success."]
pub async fn get_chat_menu_button<'a>(&self, chat_id: Option<i64>) -> BotResult<MenuButton> {
let form = GetChatMenuButtonOpts { chat_id };
let resp = self.post("getChatMenuButton", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects."]
pub async fn get_forum_topic_icon_stickers<'a>(&self) -> BotResult<Vec<Sticker>> {
let resp = self.post_empty("getForumTopicIconStickers").await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns True on success."]
pub async fn unpin_chat_message<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_id: Option<i64>,
) -> BotResult<bool> {
let form = UnpinChatMessageOpts {
business_connection_id,
chat_id,
message_id,
};
let resp = self.post("unpinChatMessage", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to revoke the current token of a managed bot and generate a new one. Returns the new token as String on success."]
pub async fn replace_managed_bot_token<'a>(&self, user_id: i64) -> BotResult<String> {
let form = ReplaceManagedBotTokenOpts { user_id };
let resp = self.post("replaceManagedBotToken", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub async fn set_chat_description<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
description: Option<&'a str>,
) -> BotResult<bool> {
let form = SetChatDescriptionOpts {
chat_id,
description,
};
let resp = self.post("setChatDescription", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
pub async fn close_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = CloseGeneralForumTopicOpts { chat_id };
let resp = self.post("closeGeneralForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
pub async fn edit_message_text<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
text: &'a str,
parse_mode: Option<&'a str>,
entities: Option<&'a Vec<MessageEntity>>,
link_preview_options: Option<&'a LinkPreviewOptions>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<MessageBool> {
let form = EditMessageTextOpts {
business_connection_id,
chat_id,
message_id,
inline_message_id,
text,
parse_mode,
entities: if let Some(entities) = entities {
Some(serde_json::to_string(&entities)?)
} else {
None
},
link_preview_options: if let Some(link_preview_options) = link_preview_options {
Some(serde_json::to_string(&link_preview_options)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("editMessageText", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success."]
pub async fn remove_business_account_profile_photo<'a>(
&self,
business_connection_id: &'a str,
is_public: Option<bool>,
) -> BotResult<bool> {
let form = RemoveBusinessAccountProfilePhotoOpts {
business_connection_id,
is_public,
};
let resp = self.post("removeBusinessAccountProfilePhoto", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success."]
pub async fn reopen_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = ReopenGeneralForumTopicOpts { chat_id };
let resp = self.post("reopenGeneralForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success."]
pub async fn delete_chat_sticker_set<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = DeleteChatStickerSetOpts { chat_id };
let resp = self.post("deleteChatStickerSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send text messages. On success, the sent Message is returned."]
pub async fn send_message<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
text: &'a str,
parse_mode: Option<&'a str>,
entities: Option<&'a Vec<MessageEntity>>,
link_preview_options: Option<&'a LinkPreviewOptions>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let form = SendMessageOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
text,
parse_mode,
entities: if let Some(entities) = entities {
Some(serde_json::to_string(&entities)?)
} else {
None
},
link_preview_options: if let Some(link_preview_options) = link_preview_options {
Some(serde_json::to_string(&link_preview_options)?)
} else {
None
},
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendMessage", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object."]
pub async fn save_prepared_keyboard_button<'a>(
&self,
user_id: i64,
button: &'a KeyboardButton,
) -> BotResult<PreparedKeyboardButton> {
let form = SavePreparedKeyboardButtonOpts {
user_id,
button: serde_json::to_string(&button)?,
};
let resp = self.post("savePreparedKeyboardButton", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success."]
pub async fn decline_suggested_post<'a>(
&self,
chat_id: i64,
message_id: i64,
comment: Option<&'a str>,
) -> BotResult<bool> {
let form = DeclineSuggestedPostOpts {
chat_id,
message_id,
comment,
};
let resp = self.post("declineSuggestedPost", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object."]
pub async fn save_prepared_inline_message<'a>(
&self,
user_id: i64,
result: &'a InlineQueryResult,
allow_user_chats: Option<bool>,
allow_bot_chats: Option<bool>,
allow_group_chats: Option<bool>,
allow_channel_chats: Option<bool>,
) -> BotResult<PreparedInlineMessage> {
let form = SavePreparedInlineMessageOpts {
user_id,
result: serde_json::to_string(&result)?,
allow_user_chats,
allow_bot_chats,
allow_group_chats,
allow_channel_chats,
};
let resp = self.post("savePreparedInlineMessage", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
pub async fn edit_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: i64,
name: Option<&'a str>,
icon_custom_emoji_id: Option<&'a str>,
) -> BotResult<bool> {
let form = EditForumTopicOpts {
chat_id,
message_thread_id,
name,
icon_custom_emoji_id,
};
let resp = self.post("editForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header \"X-Telegram-Bot-Api-Secret-Token\" with the secret token as content."]
pub async fn set_webhook<'a>(
&self,
url: &'a str,
certificate: Option<FileData>,
ip_address: Option<&'a str>,
max_connections: Option<i64>,
allowed_updates: Option<&'a Vec<String>>,
drop_pending_updates: Option<bool>,
secret_token: Option<&'a str>,
) -> BotResult<bool> {
let data = Form::new();
let (data, certificate_json) = if let Some(certificate) = certificate {
let (data, certificate_json) =
certificate.convert_form(data, "certificate".to_owned())?;
(data, Some(certificate_json))
} else {
(data, None)
};
let form = SetWebhookOpts {
url,
certificate: certificate_json,
ip_address,
max_connections,
allowed_updates: if let Some(allowed_updates) = allowed_updates {
Some(serde_json::to_string(&allowed_updates)?)
} else {
None
},
drop_pending_updates,
secret_token,
};
let resp = self.post_data("setWebhook", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success."]
pub async fn set_user_emoji_status<'a>(
&self,
user_id: i64,
emoji_status_custom_emoji_id: Option<&'a str>,
emoji_status_expiration_date: Option<i64>,
) -> BotResult<bool> {
let form = SetUserEmojiStatusOpts {
user_id,
emoji_status_custom_emoji_id,
emoji_status_expiration_date,
};
let resp = self.post("setUserEmojiStatus", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success."]
pub async fn get_business_account_gifts<'a>(
&self,
business_connection_id: &'a str,
exclude_unsaved: Option<bool>,
exclude_saved: Option<bool>,
exclude_unlimited: Option<bool>,
exclude_limited_upgradable: Option<bool>,
exclude_limited_non_upgradable: Option<bool>,
exclude_unique: Option<bool>,
exclude_from_blockchain: Option<bool>,
sort_by_price: Option<bool>,
offset: Option<&'a str>,
limit: Option<i64>,
) -> BotResult<OwnedGifts> {
let form = GetBusinessAccountGiftsOpts {
business_connection_id,
exclude_unsaved,
exclude_saved,
exclude_unlimited,
exclude_limited_upgradable,
exclude_limited_non_upgradable,
exclude_unique,
exclude_from_blockchain,
sort_by_price,
offset,
limit,
};
let resp = self.post("getBusinessAccountGifts", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success."]
pub async fn set_chat_administrator_custom_title<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
custom_title: &'a str,
) -> BotResult<bool> {
let form = SetChatAdministratorCustomTitleOpts {
chat_id,
user_id,
custom_title,
};
let resp = self.post("setChatAdministratorCustomTitle", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
pub async fn edit_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
name: &'a str,
) -> BotResult<bool> {
let form = EditGeneralForumTopicOpts { chat_id, name };
let resp = self.post("editGeneralForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success."]
pub async fn get_my_default_administrator_rights<'a>(
&self,
for_channels: Option<bool>,
) -> BotResult<ChatAdministratorRights> {
let form = GetMyDefaultAdministratorRightsOpts { for_channels };
let resp = self.post("getMyDefaultAdministratorRights", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the profile photo of the bot. Returns True on success."]
pub async fn set_my_profile_photo<'a>(&self, photo: &'a InputProfilePhoto) -> BotResult<bool> {
let form = SetMyProfilePhotoOpts {
photo: serde_json::to_string(&photo)?,
};
let resp = self.post("setMyProfilePhoto", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns True on success."]
pub async fn unpin_all_chat_messages<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = UnpinAllChatMessagesOpts { chat_id };
let resp = self.post("unpinAllChatMessages", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future."]
pub async fn send_animation<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
animation: FileData,
duration: Option<i64>,
width: Option<i64>,
height: Option<i64>,
thumbnail: Option<FileData>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
has_spoiler: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let data = Form::new();
let (data, animation_json) = animation.convert_form(data, "animation".to_owned())?;
let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
(data, Some(thumbnail_json))
} else {
(data, None)
};
let form = SendAnimationOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
animation: animation_json,
duration,
width,
height,
thumbnail: thumbnail_json,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
show_caption_above_media,
has_spoiler,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post_data("sendAnimation", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success."]
pub async fn set_my_default_administrator_rights<'a>(
&self,
rights: Option<&'a ChatAdministratorRights>,
for_channels: Option<bool>,
) -> BotResult<bool> {
let form = SetMyDefaultAdministratorRightsOpts {
rights: if let Some(rights) = rights {
Some(serde_json::to_string(&rights)?)
} else {
None
},
for_channels,
};
let resp = self.post("setMyDefaultAdministratorRights", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success."]
pub async fn edit_story<'a>(
&self,
business_connection_id: &'a str,
story_id: i64,
content: &'a InputStoryContent,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
areas: Option<&'a Vec<StoryArea>>,
) -> BotResult<Story> {
let form = EditStoryOpts {
business_connection_id,
story_id,
content: serde_json::to_string(&content)?,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
areas: if let Some(areas) = areas {
Some(serde_json::to_string(&areas)?)
} else {
None
},
};
let resp = self.post("editStory", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send photos. On success, the sent Message is returned."]
pub async fn send_photo<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
photo: FileData,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
has_spoiler: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let data = Form::new();
let (data, photo_json) = photo.convert_form(data, "photo".to_owned())?;
let form = SendPhotoOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
photo: photo_json,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
show_caption_above_media,
has_spoiler,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post_data("sendPhoto", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success."]
pub async fn create_new_sticker_set<'a>(
&self,
user_id: i64,
name: &'a str,
title: &'a str,
stickers: &'a Vec<InputSticker>,
sticker_type: Option<&'a str>,
needs_repainting: Option<bool>,
) -> BotResult<bool> {
let form = CreateNewStickerSetOpts {
user_id,
name,
title,
stickers: serde_json::to_string(&stickers)?,
sticker_type,
needs_repainting,
};
let resp = self.post("createNewStickerSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send point on the map. On success, the sent Message is returned."]
pub async fn send_location<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
live_period: Option<i64>,
heading: Option<i64>,
proximity_alert_radius: Option<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let form = SendLocationOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
latitude,
longitude,
horizontal_accuracy,
live_period,
heading,
proximity_alert_radius,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendLocation", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get a sticker set. On success, a StickerSet object is returned."]
pub async fn get_sticker_set<'a>(&self, name: &'a str) -> BotResult<StickerSet> {
let form = GetStickerSetOpts { name };
let resp = self.post("getStickerSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object."]
pub async fn get_user_chat_boosts<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
user_id: i64,
) -> BotResult<UserChatBoosts> {
let form = GetUserChatBoostsOpts { chat_id, user_id };
let resp = self.post("getUserChatBoosts", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current bot name for the given user language. Returns BotName on success."]
pub async fn get_my_name<'a>(&self, language_code: Option<&'a str>) -> BotResult<BotName> {
let form = GetMyNameOpts { language_code };
let resp = self.post("getMyName", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success."]
pub async fn set_chat_menu_button<'a>(
&self,
chat_id: Option<i64>,
menu_button: Option<&'a MenuButton>,
) -> BotResult<bool> {
let form = SetChatMenuButtonOpts {
chat_id,
menu_button: if let Some(menu_button) = menu_button {
Some(serde_json::to_string(&menu_button)?)
} else {
None
},
};
let resp = self.post("setChatMenuButton", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned."]
pub async fn edit_message_live_location<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
live_period: Option<i64>,
horizontal_accuracy: Option<::ordered_float::OrderedFloat<f64>>,
heading: Option<i64>,
proximity_alert_radius: Option<i64>,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<MessageBool> {
let form = EditMessageLiveLocationOpts {
business_connection_id,
chat_id,
message_id,
inline_message_id,
latitude,
longitude,
live_period,
horizontal_accuracy,
heading,
proximity_alert_radius,
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("editMessageLiveLocation", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success."]
pub async fn set_business_account_bio<'a>(
&self,
business_connection_id: &'a str,
bio: Option<&'a str>,
) -> BotResult<bool> {
let form = SetBusinessAccountBioOpts {
business_connection_id,
bio,
};
let resp = self.post("setBusinessAccountBio", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success."]
pub async fn convert_gift_to_stars<'a>(
&self,
business_connection_id: &'a str,
owned_gift_id: &'a str,
) -> BotResult<bool> {
let form = ConvertGiftToStarsOpts {
business_connection_id,
owned_gift_id,
};
let resp = self.post("convertGiftToStars", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send phone contacts. On success, the sent Message is returned."]
pub async fn send_contact<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
phone_number: &'a str,
first_name: &'a str,
last_name: Option<&'a str>,
vcard: Option<&'a str>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let form = SendContactOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
phone_number,
first_name,
last_name,
vcard,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendContact", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a sticker from a set created by the bot. Returns True on success."]
pub async fn delete_sticker_from_set<'a>(&self, sticker: &'a str) -> BotResult<bool> {
let form = DeleteStickerFromSetOpts { sticker };
let resp = self.post("deleteStickerFromSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success."]
pub async fn set_sticker_set_thumbnail<'a>(
&self,
name: &'a str,
user_id: i64,
thumbnail: Option<FileData>,
format: &'a str,
) -> BotResult<bool> {
let data = Form::new();
let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
(data, Some(thumbnail_json))
} else {
(data, None)
};
let form = SetStickerSetThumbnailOpts {
name,
user_id,
thumbnail: thumbnail_json,
format,
};
let resp = self.post_data("setStickerSetThumbnail", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success."]
pub async fn set_custom_emoji_sticker_set_thumbnail<'a>(
&self,
name: &'a str,
custom_emoji_id: Option<&'a str>,
) -> BotResult<bool> {
let form = SetCustomEmojiStickerSetThumbnailOpts {
name,
custom_emoji_id,
};
let resp = self.post("setCustomEmojiStickerSetThumbnail", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the title of a created sticker set. Returns True on success."]
pub async fn set_sticker_set_title<'a>(
&self,
name: &'a str,
title: &'a str,
) -> BotResult<bool> {
let form = SetStickerSetTitleOpts { name, title };
let resp = self.post("setStickerSetTitle", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed."]
pub async fn answer_inline_query<'a>(
&self,
inline_query_id: &'a str,
results: &'a Vec<InlineQueryResult>,
cache_time: Option<i64>,
is_personal: Option<bool>,
next_offset: Option<&'a str>,
button: Option<&'a InlineQueryResultsButton>,
) -> BotResult<bool> {
let form = AnswerInlineQueryOpts {
inline_query_id,
results: serde_json::to_string(&results)?,
cache_time,
is_personal,
next_offset,
button: if let Some(button) = button {
Some(serde_json::to_string(&button)?)
} else {
None
},
};
let resp = self.post("answerInlineQuery", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success."]
pub async fn get_business_connection<'a>(
&self,
business_connection_id: &'a str,
) -> BotResult<BusinessConnection> {
let form = GetBusinessConnectionOpts {
business_connection_id,
};
let resp = self.post("getBusinessConnection", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success."]
pub async fn set_business_account_name<'a>(
&self,
business_connection_id: &'a str,
first_name: &'a str,
last_name: Option<&'a str>,
) -> BotResult<bool> {
let form = SetBusinessAccountNameOpts {
business_connection_id,
first_name,
last_name,
};
let resp = self.post("setBusinessAccountName", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
pub async fn edit_message_media<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: Option<V>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
media: &'a InputMedia,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<MessageBool> {
let form = EditMessageMediaOpts {
business_connection_id,
chat_id,
message_id,
inline_message_id,
media: serde_json::to_string(&media)?,
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("editMessageMedia", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
pub async fn unhide_general_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = UnhideGeneralForumTopicOpts { chat_id };
let resp = self.post("unhideGeneralForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success."]
pub async fn set_my_short_description<'a>(
&self,
short_description: Option<&'a str>,
language_code: Option<&'a str>,
) -> BotResult<bool> {
let form = SetMyShortDescriptionOpts {
short_description,
language_code,
};
let resp = self.post("setMyShortDescription", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned."]
pub async fn stop_poll<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_id: i64,
reply_markup: Option<&'a InlineKeyboardMarkup>,
) -> BotResult<Poll> {
let form = StopPollOpts {
business_connection_id,
chat_id,
message_id,
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("stopPoll", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters."]
pub async fn close<'a>(&self) -> BotResult<bool> {
let resp = self.post_empty("close").await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success."]
pub async fn set_message_reaction<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_id: i64,
reaction: Option<&'a Vec<ReactionType>>,
is_big: Option<bool>,
) -> BotResult<bool> {
let form = SetMessageReactionOpts {
chat_id,
message_id,
reaction: if let Some(reaction) = reaction {
Some(serde_json::to_string(&reaction)?)
} else {
None
},
is_big,
};
let resp = self.post("setMessageReaction", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object."]
pub async fn get_me<'a>(&self) -> BotResult<User> {
let resp = self.post_empty("getMe").await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object."]
pub async fn edit_chat_subscription_invite_link<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
invite_link: &'a str,
name: Option<&'a str>,
) -> BotResult<ChatInviteLink> {
let form = EditChatSubscriptionInviteLinkOpts {
chat_id,
invite_link,
name,
};
let resp = self.post("editChatSubscriptionInviteLink", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned."]
pub async fn send_dice<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
emoji: Option<&'a str>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let form = SendDiceOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
emoji,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendDice", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.For sending voice messages, use the sendVoice method instead."]
pub async fn send_audio<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
audio: FileData,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
duration: Option<i64>,
performer: Option<&'a str>,
title: Option<&'a str>,
thumbnail: Option<FileData>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let data = Form::new();
let (data, audio_json) = audio.convert_form(data, "audio".to_owned())?;
let (data, thumbnail_json) = if let Some(thumbnail) = thumbnail {
let (data, thumbnail_json) = thumbnail.convert_form(data, "thumbnail".to_owned())?;
(data, Some(thumbnail_json))
} else {
(data, None)
};
let form = SendAudioOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
audio: audio_json,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
duration,
performer,
title,
thumbnail: thumbnail_json,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post_data("sendAudio", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success."]
pub async fn transfer_gift<'a>(
&self,
business_connection_id: &'a str,
owned_gift_id: &'a str,
new_owner_chat_id: i64,
star_count: Option<i64>,
) -> BotResult<bool> {
let form = TransferGiftOpts {
business_connection_id,
owned_gift_id,
new_owner_chat_id,
star_count,
};
let resp = self.post("transferGift", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success."]
pub async fn remove_chat_verification<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = RemoveChatVerificationOpts { chat_id };
let resp = self.post("removeChatVerification", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success."]
pub async fn copy_message<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_id: i64,
video_start_timestamp: Option<i64>,
caption: Option<&'a str>,
parse_mode: Option<&'a str>,
caption_entities: Option<&'a Vec<MessageEntity>>,
show_caption_above_media: Option<bool>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<MessageId> {
let form = CopyMessageOpts {
chat_id,
message_thread_id,
direct_messages_topic_id,
from_chat_id,
message_id,
video_start_timestamp,
caption,
parse_mode,
caption_entities: if let Some(caption_entities) = caption_entities {
Some(serde_json::to_string(&caption_entities)?)
} else {
None
},
show_caption_above_media,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("copyMessage", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects."]
pub async fn get_game_high_scores<'a>(
&self,
user_id: i64,
chat_id: Option<i64>,
message_id: Option<i64>,
inline_message_id: Option<&'a str>,
) -> BotResult<Vec<GameHighScore>> {
let form = GetGameHighScoresOpts {
user_id,
chat_id,
message_id,
inline_message_id,
};
let resp = self.post("getGameHighScores", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send information about a venue. On success, the sent Message is returned."]
pub async fn send_venue<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
title: &'a str,
address: &'a str,
foursquare_id: Option<&'a str>,
foursquare_type: Option<&'a str>,
google_place_id: Option<&'a str>,
google_place_type: Option<&'a str>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let form = SendVenueOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
latitude,
longitude,
title,
address,
foursquare_id,
foursquare_type,
google_place_id,
google_place_type,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post("sendVenue", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success."]
pub async fn unpin_all_forum_topic_messages<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: i64,
) -> BotResult<bool> {
let form = UnpinAllForumTopicMessagesOpts {
chat_id,
message_thread_id,
};
let resp = self.post("unpinAllForumTopicMessages", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned."]
pub async fn answer_web_app_query<'a>(
&self,
web_app_query_id: &'a str,
result: &'a InlineQueryResult,
) -> BotResult<SentWebAppMessage> {
let form = AnswerWebAppQueryOpts {
web_app_query_id,
result: serde_json::to_string(&result)?,
};
let resp = self.post("answerWebAppQuery", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success."]
pub async fn unban_chat_sender_chat<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
sender_chat_id: i64,
) -> BotResult<bool> {
let form = UnbanChatSenderChatOpts {
chat_id,
sender_chat_id,
};
let resp = self.post("unbanChatSenderChat", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned."]
pub async fn answer_shipping_query<'a>(
&self,
shipping_query_id: &'a str,
ok: bool,
shipping_options: Option<&'a Vec<ShippingOption>>,
error_message: Option<&'a str>,
) -> BotResult<bool> {
let form = AnswerShippingQueryOpts {
shipping_query_id,
ok,
shipping_options: if let Some(shipping_options) = shipping_options {
Some(serde_json::to_string(&shipping_options)?)
} else {
None
},
error_message,
};
let resp = self.post("answerShippingQuery", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object."]
pub async fn get_my_star_balance<'a>(&self) -> BotResult<StarAmount> {
let resp = self.post_empty("getMyStarBalance").await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success."]
pub async fn send_gift<'a, V: Into<ChatHandle> + Serialize>(
&self,
user_id: Option<i64>,
chat_id: Option<V>,
gift_id: &'a str,
pay_for_upgrade: Option<bool>,
text: Option<&'a str>,
text_parse_mode: Option<&'a str>,
text_entities: Option<&'a Vec<MessageEntity>>,
) -> BotResult<bool> {
let form = SendGiftOpts {
user_id,
chat_id,
gift_id,
pay_for_upgrade,
text,
text_parse_mode,
text_entities: if let Some(text_entities) = text_entities {
Some(serde_json::to_string(&text_entities)?)
} else {
None
},
};
let resp = self.post("sendGift", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received."]
pub async fn get_file<'a>(&self, file_id: &'a str) -> BotResult<File> {
let form = GetFileOpts { file_id };
let resp = self.post("getFile", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object."]
pub async fn create_chat_subscription_invite_link<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
name: Option<&'a str>,
subscription_period: i64,
subscription_price: i64,
) -> BotResult<ChatInviteLink> {
let form = CreateChatSubscriptionInviteLinkOpts {
chat_id,
name,
subscription_period,
subscription_price,
};
let resp = self.post("createChatSubscriptionInviteLink", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success."]
pub async fn set_chat_sticker_set<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
sticker_set_name: &'a str,
) -> BotResult<bool> {
let form = SetChatStickerSetOpts {
chat_id,
sticker_set_name,
};
let resp = self.post("setChatStickerSet", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
pub async fn reopen_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: i64,
) -> BotResult<bool> {
let form = ReopenForumTopicOpts {
chat_id,
message_thread_id,
};
let resp = self.post("reopenForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Verifies a user on behalf of the organization which is represented by the bot. Returns True on success."]
pub async fn verify_user<'a>(
&self,
user_id: i64,
custom_description: Option<&'a str>,
) -> BotResult<bool> {
let form = VerifyUserOpts {
user_id,
custom_description,
};
let resp = self.post("verifyUser", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned."]
pub async fn forward_messages<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
from_chat_id: V,
message_ids: &'a Vec<i64>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
) -> BotResult<Vec<MessageId>> {
let form = ForwardMessagesOpts {
chat_id,
message_thread_id,
direct_messages_topic_id,
from_chat_id,
message_ids: serde_json::to_string(&message_ids)?,
disable_notification,
protect_content,
};
let resp = self.post("forwardMessages", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object."]
pub async fn get_user_profile_photos<'a>(
&self,
user_id: i64,
offset: Option<i64>,
limit: Option<i64>,
) -> BotResult<UserProfilePhotos> {
let form = GetUserProfilePhotosOpts {
user_id,
offset,
limit,
};
let resp = self.post("getUserProfilePhotos", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success."]
pub async fn set_my_commands<'a>(
&self,
commands: &'a Vec<BotCommand>,
scope: Option<&'a BotCommandScope>,
language_code: Option<&'a str>,
) -> BotResult<bool> {
let form = SetMyCommandsOpts {
commands: serde_json::to_string(&commands)?,
scope: if let Some(scope) = scope {
Some(serde_json::to_string(&scope)?)
} else {
None
},
language_code,
};
let resp = self.post("setMyCommands", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success."]
pub async fn delete_my_commands<'a>(
&self,
scope: Option<&'a BotCommandScope>,
language_code: Option<&'a str>,
) -> BotResult<bool> {
let form = DeleteMyCommandsOpts {
scope: if let Some(scope) = scope {
Some(serde_json::to_string(&scope)?)
} else {
None
},
language_code,
};
let resp = self.post("deleteMyCommands", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success."]
pub async fn delete_business_messages<'a>(
&self,
business_connection_id: &'a str,
message_ids: &'a Vec<i64>,
) -> BotResult<bool> {
let form = DeleteBusinessMessagesOpts {
business_connection_id,
message_ids: serde_json::to_string(&message_ids)?,
};
let resp = self.post("deleteBusinessMessages", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success."]
pub async fn set_business_account_profile_photo<'a>(
&self,
business_connection_id: &'a str,
photo: &'a InputProfilePhoto,
is_public: Option<bool>,
) -> BotResult<bool> {
let form = SetBusinessAccountProfilePhotoOpts {
business_connection_id,
photo: serde_json::to_string(&photo)?,
is_public,
};
let resp = self.post("setBusinessAccountProfilePhoto", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success."]
pub async fn ban_chat_sender_chat<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
sender_chat_id: i64,
) -> BotResult<bool> {
let form = BanChatSenderChatOpts {
chat_id,
sender_chat_id,
};
let resp = self.post("banChatSenderChat", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the number of members in a chat. Returns Int on success."]
pub async fn get_chat_member_count<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<i64> {
let form = GetChatMemberCountOpts { chat_id };
let resp = self.post("getChatMemberCount", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the token of a managed bot. Returns the token as String on success."]
pub async fn get_managed_bot_token<'a>(&self, user_id: i64) -> BotResult<String> {
let form = GetManagedBotTokenOpts { user_id };
let resp = self.post("getManagedBotToken", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
pub async fn close_forum_topic<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
message_thread_id: i64,
) -> BotResult<bool> {
let form = CloseForumTopicOpts {
chat_id,
message_thread_id,
};
let resp = self.post("closeForumTopic", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method for your bot to leave a group, supergroup or channel. Returns True on success."]
pub async fn leave_chat<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<bool> {
let form = LeaveChatOpts { chat_id };
let resp = self.post("leaveChat", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects."]
pub async fn get_chat_administrators<'a, V: Into<ChatHandle> + Serialize>(
&self,
chat_id: V,
) -> BotResult<Vec<ChatMember>> {
let form = GetChatAdministratorsOpts { chat_id };
let resp = self.post("getChatAdministrators", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters."]
pub async fn log_out<'a>(&self) -> BotResult<bool> {
let resp = self.post_empty("logOut").await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the bot's name. Returns True on success."]
pub async fn set_my_name<'a>(
&self,
name: Option<&'a str>,
language_code: Option<&'a str>,
) -> BotResult<bool> {
let form = SetMyNameOpts {
name,
language_code,
};
let resp = self.post("setMyName", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success."]
pub async fn approve_suggested_post<'a>(
&self,
chat_id: i64,
message_id: i64,
send_date: Option<i64>,
) -> BotResult<bool> {
let form = ApproveSuggestedPostOpts {
chat_id,
message_id,
send_date,
};
let resp = self.post("approveSuggestedPost", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned."]
pub async fn send_sticker<'a, V: Into<ChatHandle> + Serialize>(
&self,
business_connection_id: Option<&'a str>,
chat_id: V,
message_thread_id: Option<i64>,
direct_messages_topic_id: Option<i64>,
sticker: FileData,
emoji: Option<&'a str>,
disable_notification: Option<bool>,
protect_content: Option<bool>,
allow_paid_broadcast: Option<bool>,
message_effect_id: Option<&'a str>,
suggested_post_parameters: Option<&'a SuggestedPostParameters>,
reply_parameters: Option<&'a ReplyParameters>,
reply_markup: Option<&'a EReplyMarkup>,
) -> BotResult<Message> {
let data = Form::new();
let (data, sticker_json) = sticker.convert_form(data, "sticker".to_owned())?;
let form = SendStickerOpts {
business_connection_id,
chat_id,
message_thread_id,
direct_messages_topic_id,
sticker: sticker_json,
emoji,
disable_notification,
protect_content,
allow_paid_broadcast,
message_effect_id,
suggested_post_parameters: if let Some(suggested_post_parameters) =
suggested_post_parameters
{
Some(serde_json::to_string(&suggested_post_parameters)?)
} else {
None
},
reply_parameters: if let Some(reply_parameters) = reply_parameters {
Some(serde_json::to_string(&reply_parameters)?)
} else {
None
},
reply_markup: if let Some(reply_markup) = reply_markup {
Some(serde_json::to_string(&reply_markup)?)
} else {
None
},
};
let resp = self.post_data("sendSticker", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success."]
pub async fn read_business_message<'a>(
&self,
business_connection_id: &'a str,
chat_id: i64,
message_id: i64,
) -> BotResult<bool> {
let form = ReadBusinessMessageOpts {
business_connection_id,
chat_id,
message_id,
};
let resp = self.post("readBusinessMessage", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects."]
pub async fn get_custom_emoji_stickers<'a>(
&self,
custom_emoji_ids: &'a Vec<String>,
) -> BotResult<Vec<Sticker>> {
let form = GetCustomEmojiStickersOpts {
custom_emoji_ids: serde_json::to_string(&custom_emoji_ids)?,
};
let resp = self.post("getCustomEmojiStickers", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success."]
pub async fn upload_sticker_file<'a>(
&self,
user_id: i64,
sticker: FileData,
sticker_format: &'a str,
) -> BotResult<File> {
let data = Form::new();
let (data, sticker_json) = sticker.convert_form(data, "sticker".to_owned())?;
let form = UploadStickerFileOpts {
user_id,
sticker: sticker_json,
sticker_format,
};
let resp = self.post_data("uploadStickerFile", form, data).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the gifts owned and hosted by a user. Returns OwnedGifts on success."]
pub async fn get_user_gifts<'a>(
&self,
user_id: i64,
exclude_unlimited: Option<bool>,
exclude_limited_upgradable: Option<bool>,
exclude_limited_non_upgradable: Option<bool>,
exclude_from_blockchain: Option<bool>,
exclude_unique: Option<bool>,
sort_by_price: Option<bool>,
offset: Option<&'a str>,
limit: Option<i64>,
) -> BotResult<OwnedGifts> {
let form = GetUserGiftsOpts {
user_id,
exclude_unlimited,
exclude_limited_upgradable,
exclude_limited_non_upgradable,
exclude_from_blockchain,
exclude_unique,
sort_by_price,
offset,
limit,
};
let resp = self.post("getUserGifts", form).await?;
if resp.ok {
let res = resp.result.unwrap_or_default();
let resp = serde_json::from_value(res)?;
Ok(resp)
} else {
Err(ApiError::from_response(resp))
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success."]
pub fn build_get_my_short_description<'a>(&'a self) -> CallGetMyShortDescription<'a> {
CallGetMyShortDescription {
bot: self,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future."]
pub fn build_send_voice<'a, V>(&'a self, chat_id: V, voice: FileData) -> CallSendVoice<'a, V> {
CallSendVoice {
bot: self,
chat_id,
voice,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
caption: None,
parse_mode: None,
caption_entities: None,
duration: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the gifts owned by a chat. Returns OwnedGifts on success."]
pub fn build_get_chat_gifts<'a, V>(&'a self, chat_id: V) -> CallGetChatGifts<'a, V> {
CallGetChatGifts {
bot: self,
chat_id,
exclude_unsaved: None,
exclude_saved: None,
exclude_unlimited: None,
exclude_limited_upgradable: None,
exclude_limited_non_upgradable: None,
exclude_from_blockchain: None,
exclude_unique: None,
sort_by_price: None,
offset: None,
limit: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub fn build_ban_chat_member<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
) -> CallBanChatMember<'a, V> {
CallBanChatMember {
bot: self,
chat_id,
user_id,
until_date: None,
revoke_messages: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success."]
pub fn build_set_business_account_username<'a>(
&'a self,
business_connection_id: &'a str,
) -> CallSetBusinessAccountUsername<'a> {
CallSetBusinessAccountUsername {
bot: self,
business_connection_id,
username: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current list of the bot's commands for the given scope and user language. Returns an Array of BotCommand objects. If commands aren't set, an empty list is returned."]
pub fn build_get_my_commands<'a>(&'a self) -> CallGetMyCommands<'a> {
CallGetMyCommands {
bot: self,
scope: None,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success."]
pub fn build_delete_story<'a>(
&'a self,
business_connection_id: &'a str,
story_id: i64,
) -> CallDeleteStory<'a> {
CallDeleteStory {
bot: self,
business_connection_id,
story_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
pub fn build_edit_message_reply_markup<'a, V>(&'a self) -> CallEditMessageReplyMarkup<'a, V> {
CallEditMessageReplyMarkup {
bot: self,
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success."]
pub fn build_replace_sticker_in_set<'a, A: Into<&'a InputSticker>>(
&'a self,
user_id: i64,
name: &'a str,
old_sticker: &'a str,
sticker: A,
) -> CallReplaceStickerInSet<'a> {
CallReplaceStickerInSet {
bot: self,
user_id,
name,
old_sticker,
sticker: sticker.into(),
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success."]
pub fn build_unpin_all_general_forum_topic_messages<'a, V>(
&'a self,
chat_id: V,
) -> CallUnpinAllGeneralForumTopicMessages<'a, V> {
CallUnpinAllGeneralForumTopicMessages { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a sticker set that was created by the bot. Returns True on success."]
pub fn build_delete_sticker_set<'a>(&'a self, name: &'a str) -> CallDeleteStickerSet<'a> {
CallDeleteStickerSet { bot: self, name }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the can_manage_tags administrator right. Returns True on success."]
pub fn build_set_chat_member_tag<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
) -> CallSetChatMemberTag<'a, V> {
CallSetChatMemberTag {
bot: self,
chat_id,
user_id,
tag: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."]
pub fn build_set_sticker_emoji_list<'a>(
&'a self,
sticker: &'a str,
emoji_list: &'a Vec<String>,
) -> CallSetStickerEmojiList<'a> {
CallSetStickerEmojiList {
bot: self,
sticker,
emoji_list,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned."]
pub fn build_answer_callback_query<'a>(
&'a self,
callback_query_id: &'a str,
) -> CallAnswerCallbackQuery<'a> {
CallAnswerCallbackQuery {
bot: self,
callback_query_id,
text: None,
show_alert: None,
url: None,
cache_time: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success."]
pub fn build_add_sticker_to_set<'a, A: Into<&'a InputSticker>>(
&'a self,
user_id: i64,
name: &'a str,
sticker: A,
) -> CallAddStickerToSet<'a> {
CallAddStickerToSet {
bot: self,
user_id,
name,
sticker: sticker.into(),
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success."]
pub fn build_edit_user_star_subscription<'a>(
&'a self,
user_id: i64,
telegram_payment_charge_id: &'a str,
is_canceled: bool,
) -> CallEditUserStarSubscription<'a> {
CallEditUserStarSubscription {
bot: self,
user_id,
telegram_payment_charge_id,
is_canceled,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub fn build_set_chat_title<'a, V>(
&'a self,
chat_id: V,
title: &'a str,
) -> CallSetChatTitle<'a, V> {
CallSetChatTitle {
bot: self,
chat_id,
title,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send paid media. On success, the sent Message is returned."]
pub fn build_send_paid_media<'a, V>(
&'a self,
chat_id: V,
star_count: i64,
media: &'a Vec<InputPaidMedia>,
) -> CallSendPaidMedia<'a, V> {
CallSendPaidMedia {
bot: self,
chat_id,
star_count,
media,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
payload: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success."]
pub fn build_unban_chat_member<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
) -> CallUnbanChatMember<'a, V> {
CallUnbanChatMember {
bot: self,
chat_id,
user_id,
only_if_banned: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Removes the profile photo of the bot. Requires no parameters. Returns True on success."]
pub fn build_remove_my_profile_photo<'a>(&'a self) -> CallRemoveMyProfilePhoto<'a> {
CallRemoveMyProfilePhoto { bot: self }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object."]
pub fn build_create_forum_topic<'a, V>(
&'a self,
chat_id: V,
name: &'a str,
) -> CallCreateForumTopic<'a, V> {
CallCreateForumTopic {
bot: self,
chat_id,
name,
icon_color: None,
icon_custom_emoji_id: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future."]
pub fn build_send_document<'a, V>(
&'a self,
chat_id: V,
document: FileData,
) -> CallSendDocument<'a, V> {
CallSendDocument {
bot: self,
chat_id,
document,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
thumbnail: None,
caption: None,
parse_mode: None,
caption_entities: None,
disable_content_type_detection: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object."]
pub fn build_revoke_chat_invite_link<'a, V>(
&'a self,
chat_id: V,
invite_link: &'a str,
) -> CallRevokeChatInviteLink<'a, V> {
CallRevokeChatInviteLink {
bot: self,
chat_id,
invite_link,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success."]
pub fn build_hide_general_forum_topic<'a, V>(
&'a self,
chat_id: V,
) -> CallHideGeneralForumTopic<'a, V> {
CallHideGeneralForumTopic { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned."]
pub fn build_stop_message_live_location<'a, V>(&'a self) -> CallStopMessageLiveLocation<'a, V> {
CallStopMessageLiveLocation {
bot: self,
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success."]
pub fn build_set_sticker_mask_position<'a>(
&'a self,
sticker: &'a str,
) -> CallSetStickerMaskPosition<'a> {
CallSetStickerMaskPosition {
bot: self,
sticker,
mask_position: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success."]
pub fn build_delete_webhook<'a>(&'a self) -> CallDeleteWebhook<'a> {
CallDeleteWebhook {
bot: self,
drop_pending_updates: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send invoices. On success, the sent Message is returned."]
pub fn build_send_invoice<'a, V>(
&'a self,
chat_id: V,
title: &'a str,
description: &'a str,
payload: &'a str,
currency: &'a str,
prices: &'a Vec<LabeledPrice>,
) -> CallSendInvoice<'a, V> {
CallSendInvoice {
bot: self,
chat_id,
title,
description,
payload,
currency,
prices,
message_thread_id: None,
direct_messages_topic_id: None,
provider_token: None,
max_tip_amount: None,
suggested_tip_amounts: None,
start_parameter: None,
provider_data: None,
photo_url: None,
photo_size: None,
photo_width: None,
photo_height: None,
need_name: None,
need_phone_number: None,
need_email: None,
need_shipping_address: None,
send_phone_number_to_provider: None,
send_email_to_provider: None,
is_flexible: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive."]
pub fn build_send_chat_action<'a, V>(
&'a self,
chat_id: V,
action: &'a str,
) -> CallSendChatAction<'a, V> {
CallSendChatAction {
bot: self,
chat_id,
action,
business_connection_id: None,
message_thread_id: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent."]
pub fn build_answer_pre_checkout_query<'a>(
&'a self,
pre_checkout_query_id: &'a str,
ok: bool,
) -> CallAnswerPreCheckoutQuery<'a> {
CallAnswerPreCheckoutQuery {
bot: self,
pre_checkout_query_id,
ok,
error_message: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success."]
pub fn build_set_sticker_position_in_set<'a>(
&'a self,
sticker: &'a str,
position: i64,
) -> CallSetStickerPositionInSet<'a> {
CallSetStickerPositionInSet {
bot: self,
sticker,
position,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send a game. On success, the sent Message is returned."]
pub fn build_send_game<'a>(
&'a self,
chat_id: i64,
game_short_name: &'a str,
) -> CallSendGame<'a> {
CallSendGame {
bot: self,
chat_id,
game_short_name,
business_connection_id: None,
message_thread_id: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success."]
pub fn build_export_chat_invite_link<'a, V>(
&'a self,
chat_id: V,
) -> CallExportChatInviteLink<'a, V> {
CallExportChatInviteLink { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub fn build_set_chat_photo<'a, V>(
&'a self,
chat_id: V,
photo: FileData,
) -> CallSetChatPhoto<'a, V> {
CallSetChatPhoto {
bot: self,
chat_id,
photo,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub fn build_delete_chat_photo<'a, V>(&'a self, chat_id: V) -> CallDeleteChatPhoto<'a, V> {
CallDeleteChatPhoto { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success."]
pub fn build_get_chat_member<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
) -> CallGetChatMember<'a, V> {
CallGetChatMember {
bot: self,
chat_id,
user_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
pub fn build_edit_message_caption<'a, V>(&'a self) -> CallEditMessageCaption<'a, V> {
CallEditMessageCaption {
bot: self,
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Service messages about a supergroup, channel, or forum topic creation can't be deleted.- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages administrator right in a supergroup or a channel, it can delete any message there.- If the bot has can_manage_direct_messages administrator right in a channel, it can delete any message in the corresponding direct messages chat.Returns True on success."]
pub fn build_delete_message<'a, V>(
&'a self,
chat_id: V,
message_id: i64,
) -> CallDeleteMessage<'a, V> {
CallDeleteMessage {
bot: self,
chat_id,
message_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object."]
pub fn build_edit_chat_invite_link<'a, V>(
&'a self,
chat_id: V,
invite_link: &'a str,
) -> CallEditChatInviteLink<'a, V> {
CallEditChatInviteLink {
bot: self,
chat_id,
invite_link,
name: None,
expire_date: None,
member_limit: None,
creates_join_request: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues."]
pub fn build_set_passport_data_errors<'a>(
&'a self,
user_id: i64,
errors: &'a Vec<PassportElementError>,
) -> CallSetPassportDataErrors<'a> {
CallSetPassportDataErrors {
bot: self,
user_id,
errors,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success."]
pub fn build_set_chat_permissions<'a, V, A: Into<&'a ChatPermissions>>(
&'a self,
chat_id: V,
permissions: A,
) -> CallSetChatPermissions<'a, V> {
CallSetChatPermissions {
bot: self,
chat_id,
permissions: permissions.into(),
use_independent_chat_permissions: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success."]
pub fn build_post_story<'a, A: Into<&'a InputStoryContent>>(
&'a self,
business_connection_id: &'a str,
content: A,
active_period: i64,
) -> CallPostStory<'a> {
CallPostStory {
bot: self,
business_connection_id,
content: content.into(),
active_period,
caption: None,
parse_mode: None,
caption_entities: None,
areas: None,
post_to_chat_page: None,
protect_content: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects."]
pub fn build_get_updates<'a>(&'a self) -> CallGetUpdates<'a> {
CallGetUpdates {
bot: self,
offset: None,
limit: None,
timeout: None,
allowed_updates: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned."]
pub fn build_copy_messages<'a, V>(
&'a self,
chat_id: V,
from_chat_id: V,
message_ids: &'a Vec<i64>,
) -> CallCopyMessages<'a, V> {
CallCopyMessages {
bot: self,
chat_id,
from_chat_id,
message_ids,
message_thread_id: None,
direct_messages_topic_id: None,
disable_notification: None,
protect_content: None,
remove_caption: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Gifts a Telegram Premium subscription to the given user. Returns True on success."]
pub fn build_gift_premium_subscription<'a>(
&'a self,
user_id: i64,
month_count: i64,
star_count: i64,
) -> CallGiftPremiumSubscription<'a> {
CallGiftPremiumSubscription {
bot: self,
user_id,
month_count,
star_count,
text: None,
text_parse_mode: None,
text_entities: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty."]
pub fn build_get_webhook_info<'a>(&'a self) -> CallGetWebhookInfo<'a> {
CallGetWebhookInfo { bot: self }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success."]
pub fn build_approve_chat_join_request<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
) -> CallApproveChatJoinRequest<'a, V> {
CallApproveChatJoinRequest {
bot: self,
chat_id,
user_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success."]
pub fn build_transfer_business_account_stars<'a>(
&'a self,
business_connection_id: &'a str,
star_count: i64,
) -> CallTransferBusinessAccountStars<'a> {
CallTransferBusinessAccountStars {
bot: self,
business_connection_id,
star_count,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object."]
pub fn build_get_star_transactions<'a>(&'a self) -> CallGetStarTransactions<'a> {
CallGetStarTransactions {
bot: self,
offset: None,
limit: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False."]
pub fn build_set_game_score<'a>(&'a self, user_id: i64, score: i64) -> CallSetGameScore<'a> {
CallSetGameScore {
bot: self,
user_id,
score,
force: None,
disable_edit_message: None,
chat_id: None,
message_id: None,
inline_message_id: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success."]
pub fn build_get_business_account_star_balance<'a>(
&'a self,
business_connection_id: &'a str,
) -> CallGetBusinessAccountStarBalance<'a> {
CallGetBusinessAccountStarBalance {
bot: self,
business_connection_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current bot description for the given user language. Returns BotDescription on success."]
pub fn build_get_my_description<'a>(&'a self) -> CallGetMyDescription<'a> {
CallGetMyDescription {
bot: self,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to forward messages of any kind. Service messages and messages with protected content can't be forwarded. On success, the sent Message is returned."]
pub fn build_forward_message<'a, V>(
&'a self,
chat_id: V,
from_chat_id: V,
message_id: i64,
) -> CallForwardMessage<'a, V> {
CallForwardMessage {
bot: self,
chat_id,
from_chat_id,
message_id,
message_thread_id: None,
direct_messages_topic_id: None,
video_start_timestamp: None,
disable_notification: None,
protect_content: None,
message_effect_id: None,
suggested_post_parameters: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success."]
pub fn build_set_my_description<'a>(&'a self) -> CallSetMyDescription<'a> {
CallSetMyDescription {
bot: self,
description: None,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success."]
pub fn build_set_business_account_gift_settings<'a, A: Into<&'a AcceptedGiftTypes>>(
&'a self,
business_connection_id: &'a str,
show_gift_button: bool,
accepted_gift_types: A,
) -> CallSetBusinessAccountGiftSettings<'a> {
CallSetBusinessAccountGiftSettings {
bot: self,
business_connection_id,
show_gift_button,
accepted_gift_types: accepted_gift_types.into(),
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success."]
pub fn build_delete_messages<'a, V>(
&'a self,
chat_id: V,
message_ids: &'a Vec<i64>,
) -> CallDeleteMessages<'a, V> {
CallDeleteMessages {
bot: self,
chat_id,
message_ids,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create a link for an invoice. Returns the created invoice link as String on success."]
pub fn build_create_invoice_link<'a>(
&'a self,
title: &'a str,
description: &'a str,
payload: &'a str,
currency: &'a str,
prices: &'a Vec<LabeledPrice>,
) -> CallCreateInvoiceLink<'a> {
CallCreateInvoiceLink {
bot: self,
title,
description,
payload,
currency,
prices,
business_connection_id: None,
provider_token: None,
subscription_period: None,
max_tip_amount: None,
suggested_tip_amounts: None,
provider_data: None,
photo_url: None,
photo_size: None,
photo_width: None,
photo_height: None,
need_name: None,
need_phone_number: None,
need_email: None,
need_shipping_address: None,
send_phone_number_to_provider: None,
send_email_to_provider: None,
is_flexible: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success."]
pub fn build_repost_story<'a>(
&'a self,
business_connection_id: &'a str,
from_chat_id: i64,
from_story_id: i64,
active_period: i64,
) -> CallRepostStory<'a> {
CallRepostStory {
bot: self,
business_connection_id,
from_chat_id,
from_story_id,
active_period,
post_to_chat_page: None,
protect_content: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success."]
pub fn build_decline_chat_join_request<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
) -> CallDeclineChatJoinRequest<'a, V> {
CallDeclineChatJoinRequest {
bot: self,
chat_id,
user_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Refunds a successful payment in Telegram Stars. Returns True on success."]
pub fn build_refund_star_payment<'a>(
&'a self,
user_id: i64,
telegram_payment_charge_id: &'a str,
) -> CallRefundStarPayment<'a> {
CallRefundStarPayment {
bot: self,
user_id,
telegram_payment_charge_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Message objects that were sent is returned."]
pub fn build_send_media_group<'a, V>(
&'a self,
chat_id: V,
media: &'a Vec<EMedia>,
) -> CallSendMediaGroup<'a, V> {
CallSendMediaGroup {
bot: self,
chat_id,
media,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success."]
pub fn build_verify_chat<'a, V>(&'a self, chat_id: V) -> CallVerifyChat<'a, V> {
CallVerifyChat {
bot: self,
chat_id,
custom_description: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to stream a partial message to a user while the message is being generated. Returns True on success."]
pub fn build_send_message_draft<'a>(
&'a self,
chat_id: i64,
draft_id: i64,
text: &'a str,
) -> CallSendMessageDraft<'a> {
CallSendMessageDraft {
bot: self,
chat_id,
draft_id,
text,
message_thread_id: None,
parse_mode: None,
entities: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success."]
pub fn build_restrict_chat_member<'a, V, A: Into<&'a ChatPermissions>>(
&'a self,
chat_id: V,
user_id: i64,
permissions: A,
) -> CallRestrictChatMember<'a, V> {
CallRestrictChatMember {
bot: self,
chat_id,
user_id,
permissions: permissions.into(),
use_independent_chat_permissions: None,
until_date: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success."]
pub fn build_remove_user_verification<'a>(
&'a self,
user_id: i64,
) -> CallRemoveUserVerification<'a> {
CallRemoveUserVerification { bot: self, user_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future."]
pub fn build_send_video<'a, V>(&'a self, chat_id: V, video: FileData) -> CallSendVideo<'a, V> {
CallSendVideo {
bot: self,
chat_id,
video,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
duration: None,
width: None,
height: None,
thumbnail: None,
cover: None,
start_timestamp: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
has_spoiler: None,
supports_streaming: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success."]
pub fn build_upgrade_gift<'a>(
&'a self,
business_connection_id: &'a str,
owned_gift_id: &'a str,
) -> CallUpgradeGift<'a> {
CallUpgradeGift {
bot: self,
business_connection_id,
owned_gift_id,
keep_original_details: None,
star_count: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object."]
pub fn build_create_chat_invite_link<'a, V>(
&'a self,
chat_id: V,
) -> CallCreateChatInviteLink<'a, V> {
CallCreateChatInviteLink {
bot: self,
chat_id,
name: None,
expire_date: None,
member_limit: None,
creates_join_request: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success."]
pub fn build_get_chat<'a, V>(&'a self, chat_id: V) -> CallGetChat<'a, V> {
CallGetChat { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned."]
pub fn build_send_video_note<'a, V>(
&'a self,
chat_id: V,
video_note: FileData,
) -> CallSendVideoNote<'a, V> {
CallSendVideoNote {
bot: self,
chat_id,
video_note,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
duration: None,
length: None,
thumbnail: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send a native poll. On success, the sent Message is returned."]
pub fn build_send_poll<'a, V>(
&'a self,
chat_id: V,
question: &'a str,
options: &'a Vec<InputPollOption>,
) -> CallSendPoll<'a, V> {
CallSendPoll {
bot: self,
chat_id,
question,
options,
business_connection_id: None,
message_thread_id: None,
question_parse_mode: None,
question_entities: None,
is_anonymous: None,
tg_type: None,
allows_multiple_answers: None,
allows_revoting: None,
shuffle_options: None,
allow_adding_options: None,
hide_results_until_closes: None,
correct_option_ids: None,
explanation: None,
explanation_parse_mode: None,
explanation_entities: None,
open_period: None,
close_date: None,
is_closed: None,
description: None,
description_parse_mode: None,
description_entities: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned."]
pub fn build_edit_message_checklist<'a, A: Into<&'a InputChecklist>>(
&'a self,
business_connection_id: &'a str,
chat_id: i64,
message_id: i64,
checklist: A,
) -> CallEditMessageChecklist<'a> {
CallEditMessageChecklist {
bot: self,
business_connection_id,
chat_id,
message_id,
checklist: checklist.into(),
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned."]
pub fn build_send_checklist<'a, A: Into<&'a InputChecklist>>(
&'a self,
business_connection_id: &'a str,
chat_id: i64,
checklist: A,
) -> CallSendChecklist<'a> {
CallSendChecklist {
bot: self,
business_connection_id,
chat_id,
checklist: checklist.into(),
disable_notification: None,
protect_content: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object."]
pub fn build_get_user_profile_audios<'a>(
&'a self,
user_id: i64,
) -> CallGetUserProfileAudios<'a> {
CallGetUserProfileAudios {
bot: self,
user_id,
offset: None,
limit: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object."]
pub fn build_get_available_gifts<'a>(&'a self) -> CallGetAvailableGifts<'a> {
CallGetAvailableGifts { bot: self }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success."]
pub fn build_promote_chat_member<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
) -> CallPromoteChatMember<'a, V> {
CallPromoteChatMember {
bot: self,
chat_id,
user_id,
is_anonymous: None,
can_manage_chat: None,
can_delete_messages: None,
can_manage_video_chats: None,
can_restrict_members: None,
can_promote_members: None,
can_change_info: None,
can_invite_users: None,
can_post_stories: None,
can_edit_stories: None,
can_delete_stories: None,
can_post_messages: None,
can_edit_messages: None,
can_pin_messages: None,
can_manage_topics: None,
can_manage_direct_messages: None,
can_manage_tags: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True on success."]
pub fn build_pin_chat_message<'a, V>(
&'a self,
chat_id: V,
message_id: i64,
) -> CallPinChatMessage<'a, V> {
CallPinChatMessage {
bot: self,
chat_id,
message_id,
business_connection_id: None,
disable_notification: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success."]
pub fn build_set_sticker_keywords<'a>(
&'a self,
sticker: &'a str,
) -> CallSetStickerKeywords<'a> {
CallSetStickerKeywords {
bot: self,
sticker,
keywords: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success."]
pub fn build_delete_forum_topic<'a, V>(
&'a self,
chat_id: V,
message_thread_id: i64,
) -> CallDeleteForumTopic<'a, V> {
CallDeleteForumTopic {
bot: self,
chat_id,
message_thread_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success."]
pub fn build_get_chat_menu_button<'a>(&'a self) -> CallGetChatMenuButton<'a> {
CallGetChatMenuButton {
bot: self,
chat_id: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects."]
pub fn build_get_forum_topic_icon_stickers<'a>(&'a self) -> CallGetForumTopicIconStickers<'a> {
CallGetForumTopicIconStickers { bot: self }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns True on success."]
pub fn build_unpin_chat_message<'a, V>(&'a self, chat_id: V) -> CallUnpinChatMessage<'a, V> {
CallUnpinChatMessage {
bot: self,
chat_id,
business_connection_id: None,
message_id: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to revoke the current token of a managed bot and generate a new one. Returns the new token as String on success."]
pub fn build_replace_managed_bot_token<'a>(
&'a self,
user_id: i64,
) -> CallReplaceManagedBotToken<'a> {
CallReplaceManagedBotToken { bot: self, user_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success."]
pub fn build_set_chat_description<'a, V>(
&'a self,
chat_id: V,
) -> CallSetChatDescription<'a, V> {
CallSetChatDescription {
bot: self,
chat_id,
description: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
pub fn build_close_general_forum_topic<'a, V>(
&'a self,
chat_id: V,
) -> CallCloseGeneralForumTopic<'a, V> {
CallCloseGeneralForumTopic { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
pub fn build_edit_message_text<'a, V>(&'a self, text: &'a str) -> CallEditMessageText<'a, V> {
CallEditMessageText {
bot: self,
text,
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
parse_mode: None,
entities: None,
link_preview_options: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success."]
pub fn build_remove_business_account_profile_photo<'a>(
&'a self,
business_connection_id: &'a str,
) -> CallRemoveBusinessAccountProfilePhoto<'a> {
CallRemoveBusinessAccountProfilePhoto {
bot: self,
business_connection_id,
is_public: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success."]
pub fn build_reopen_general_forum_topic<'a, V>(
&'a self,
chat_id: V,
) -> CallReopenGeneralForumTopic<'a, V> {
CallReopenGeneralForumTopic { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success."]
pub fn build_delete_chat_sticker_set<'a, V>(
&'a self,
chat_id: V,
) -> CallDeleteChatStickerSet<'a, V> {
CallDeleteChatStickerSet { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send text messages. On success, the sent Message is returned."]
pub fn build_send_message<'a, V>(
&'a self,
chat_id: V,
text: &'a str,
) -> CallSendMessage<'a, V> {
CallSendMessage {
bot: self,
chat_id,
text,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
parse_mode: None,
entities: None,
link_preview_options: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object."]
pub fn build_save_prepared_keyboard_button<'a, A: Into<&'a KeyboardButton>>(
&'a self,
user_id: i64,
button: A,
) -> CallSavePreparedKeyboardButton<'a> {
CallSavePreparedKeyboardButton {
bot: self,
user_id,
button: button.into(),
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success."]
pub fn build_decline_suggested_post<'a>(
&'a self,
chat_id: i64,
message_id: i64,
) -> CallDeclineSuggestedPost<'a> {
CallDeclineSuggestedPost {
bot: self,
chat_id,
message_id,
comment: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object."]
pub fn build_save_prepared_inline_message<'a, A: Into<&'a InlineQueryResult>>(
&'a self,
user_id: i64,
result: A,
) -> CallSavePreparedInlineMessage<'a> {
CallSavePreparedInlineMessage {
bot: self,
user_id,
result: result.into(),
allow_user_chats: None,
allow_bot_chats: None,
allow_group_chats: None,
allow_channel_chats: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
pub fn build_edit_forum_topic<'a, V>(
&'a self,
chat_id: V,
message_thread_id: i64,
) -> CallEditForumTopic<'a, V> {
CallEditForumTopic {
bot: self,
chat_id,
message_thread_id,
name: None,
icon_custom_emoji_id: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to specify a URL and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update. In case of an unsuccessful request (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token. If specified, the request will contain a header \"X-Telegram-Bot-Api-Secret-Token\" with the secret token as content."]
pub fn build_set_webhook<'a>(&'a self, url: &'a str) -> CallSetWebhook<'a> {
CallSetWebhook {
bot: self,
url,
certificate: None,
ip_address: None,
max_connections: None,
allowed_updates: None,
drop_pending_updates: None,
secret_token: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success."]
pub fn build_set_user_emoji_status<'a>(&'a self, user_id: i64) -> CallSetUserEmojiStatus<'a> {
CallSetUserEmojiStatus {
bot: self,
user_id,
emoji_status_custom_emoji_id: None,
emoji_status_expiration_date: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success."]
pub fn build_get_business_account_gifts<'a>(
&'a self,
business_connection_id: &'a str,
) -> CallGetBusinessAccountGifts<'a> {
CallGetBusinessAccountGifts {
bot: self,
business_connection_id,
exclude_unsaved: None,
exclude_saved: None,
exclude_unlimited: None,
exclude_limited_upgradable: None,
exclude_limited_non_upgradable: None,
exclude_unique: None,
exclude_from_blockchain: None,
sort_by_price: None,
offset: None,
limit: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success."]
pub fn build_set_chat_administrator_custom_title<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
custom_title: &'a str,
) -> CallSetChatAdministratorCustomTitle<'a, V> {
CallSetChatAdministratorCustomTitle {
bot: self,
chat_id,
user_id,
custom_title,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
pub fn build_edit_general_forum_topic<'a, V>(
&'a self,
chat_id: V,
name: &'a str,
) -> CallEditGeneralForumTopic<'a, V> {
CallEditGeneralForumTopic {
bot: self,
chat_id,
name,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success."]
pub fn build_get_my_default_administrator_rights<'a>(
&'a self,
) -> CallGetMyDefaultAdministratorRights<'a> {
CallGetMyDefaultAdministratorRights {
bot: self,
for_channels: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the profile photo of the bot. Returns True on success."]
pub fn build_set_my_profile_photo<'a, A: Into<&'a InputProfilePhoto>>(
&'a self,
photo: A,
) -> CallSetMyProfilePhoto<'a> {
CallSetMyProfilePhoto {
bot: self,
photo: photo.into(),
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns True on success."]
pub fn build_unpin_all_chat_messages<'a, V>(
&'a self,
chat_id: V,
) -> CallUnpinAllChatMessages<'a, V> {
CallUnpinAllChatMessages { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future."]
pub fn build_send_animation<'a, V>(
&'a self,
chat_id: V,
animation: FileData,
) -> CallSendAnimation<'a, V> {
CallSendAnimation {
bot: self,
chat_id,
animation,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
duration: None,
width: None,
height: None,
thumbnail: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
has_spoiler: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success."]
pub fn build_set_my_default_administrator_rights<'a>(
&'a self,
) -> CallSetMyDefaultAdministratorRights<'a> {
CallSetMyDefaultAdministratorRights {
bot: self,
rights: None,
for_channels: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success."]
pub fn build_edit_story<'a, A: Into<&'a InputStoryContent>>(
&'a self,
business_connection_id: &'a str,
story_id: i64,
content: A,
) -> CallEditStory<'a> {
CallEditStory {
bot: self,
business_connection_id,
story_id,
content: content.into(),
caption: None,
parse_mode: None,
caption_entities: None,
areas: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send photos. On success, the sent Message is returned."]
pub fn build_send_photo<'a, V>(&'a self, chat_id: V, photo: FileData) -> CallSendPhoto<'a, V> {
CallSendPhoto {
bot: self,
chat_id,
photo,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
has_spoiler: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success."]
pub fn build_create_new_sticker_set<'a>(
&'a self,
user_id: i64,
name: &'a str,
title: &'a str,
stickers: &'a Vec<InputSticker>,
) -> CallCreateNewStickerSet<'a> {
CallCreateNewStickerSet {
bot: self,
user_id,
name,
title,
stickers,
sticker_type: None,
needs_repainting: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send point on the map. On success, the sent Message is returned."]
pub fn build_send_location<'a, V>(
&'a self,
chat_id: V,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
) -> CallSendLocation<'a, V> {
CallSendLocation {
bot: self,
chat_id,
latitude,
longitude,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
horizontal_accuracy: None,
live_period: None,
heading: None,
proximity_alert_radius: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get a sticker set. On success, a StickerSet object is returned."]
pub fn build_get_sticker_set<'a>(&'a self, name: &'a str) -> CallGetStickerSet<'a> {
CallGetStickerSet { bot: self, name }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object."]
pub fn build_get_user_chat_boosts<'a, V>(
&'a self,
chat_id: V,
user_id: i64,
) -> CallGetUserChatBoosts<'a, V> {
CallGetUserChatBoosts {
bot: self,
chat_id,
user_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the current bot name for the given user language. Returns BotName on success."]
pub fn build_get_my_name<'a>(&'a self) -> CallGetMyName<'a> {
CallGetMyName {
bot: self,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success."]
pub fn build_set_chat_menu_button<'a>(&'a self) -> CallSetChatMenuButton<'a> {
CallSetChatMenuButton {
bot: self,
chat_id: None,
menu_button: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned."]
pub fn build_edit_message_live_location<'a, V>(
&'a self,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
) -> CallEditMessageLiveLocation<'a, V> {
CallEditMessageLiveLocation {
bot: self,
latitude,
longitude,
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
live_period: None,
horizontal_accuracy: None,
heading: None,
proximity_alert_radius: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success."]
pub fn build_set_business_account_bio<'a>(
&'a self,
business_connection_id: &'a str,
) -> CallSetBusinessAccountBio<'a> {
CallSetBusinessAccountBio {
bot: self,
business_connection_id,
bio: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success."]
pub fn build_convert_gift_to_stars<'a>(
&'a self,
business_connection_id: &'a str,
owned_gift_id: &'a str,
) -> CallConvertGiftToStars<'a> {
CallConvertGiftToStars {
bot: self,
business_connection_id,
owned_gift_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send phone contacts. On success, the sent Message is returned."]
pub fn build_send_contact<'a, V>(
&'a self,
chat_id: V,
phone_number: &'a str,
first_name: &'a str,
) -> CallSendContact<'a, V> {
CallSendContact {
bot: self,
chat_id,
phone_number,
first_name,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
last_name: None,
vcard: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete a sticker from a set created by the bot. Returns True on success."]
pub fn build_delete_sticker_from_set<'a>(
&'a self,
sticker: &'a str,
) -> CallDeleteStickerFromSet<'a> {
CallDeleteStickerFromSet { bot: self, sticker }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success."]
pub fn build_set_sticker_set_thumbnail<'a>(
&'a self,
name: &'a str,
user_id: i64,
format: &'a str,
) -> CallSetStickerSetThumbnail<'a> {
CallSetStickerSetThumbnail {
bot: self,
name,
user_id,
format,
thumbnail: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success."]
pub fn build_set_custom_emoji_sticker_set_thumbnail<'a>(
&'a self,
name: &'a str,
) -> CallSetCustomEmojiStickerSetThumbnail<'a> {
CallSetCustomEmojiStickerSetThumbnail {
bot: self,
name,
custom_emoji_id: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the title of a created sticker set. Returns True on success."]
pub fn build_set_sticker_set_title<'a>(
&'a self,
name: &'a str,
title: &'a str,
) -> CallSetStickerSetTitle<'a> {
CallSetStickerSetTitle {
bot: self,
name,
title,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed."]
pub fn build_answer_inline_query<'a>(
&'a self,
inline_query_id: &'a str,
results: &'a Vec<InlineQueryResult>,
) -> CallAnswerInlineQuery<'a> {
CallAnswerInlineQuery {
bot: self,
inline_query_id,
results,
cache_time: None,
is_personal: None,
next_offset: None,
button: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success."]
pub fn build_get_business_connection<'a>(
&'a self,
business_connection_id: &'a str,
) -> CallGetBusinessConnection<'a> {
CallGetBusinessConnection {
bot: self,
business_connection_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success."]
pub fn build_set_business_account_name<'a>(
&'a self,
business_connection_id: &'a str,
first_name: &'a str,
) -> CallSetBusinessAccountName<'a> {
CallSetBusinessAccountName {
bot: self,
business_connection_id,
first_name,
last_name: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent."]
pub fn build_edit_message_media<'a, V, A: Into<&'a InputMedia>>(
&'a self,
media: A,
) -> CallEditMessageMedia<'a, V> {
CallEditMessageMedia {
bot: self,
media: media.into(),
business_connection_id: None,
chat_id: None,
message_id: None,
inline_message_id: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success."]
pub fn build_unhide_general_forum_topic<'a, V>(
&'a self,
chat_id: V,
) -> CallUnhideGeneralForumTopic<'a, V> {
CallUnhideGeneralForumTopic { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success."]
pub fn build_set_my_short_description<'a>(&'a self) -> CallSetMyShortDescription<'a> {
CallSetMyShortDescription {
bot: self,
short_description: None,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned."]
pub fn build_stop_poll<'a, V>(&'a self, chat_id: V, message_id: i64) -> CallStopPoll<'a, V> {
CallStopPoll {
bot: self,
chat_id,
message_id,
business_connection_id: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns True on success. Requires no parameters."]
pub fn build_close<'a>(&'a self) -> CallClose<'a> {
CallClose { bot: self }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success."]
pub fn build_set_message_reaction<'a, V>(
&'a self,
chat_id: V,
message_id: i64,
) -> CallSetMessageReaction<'a, V> {
CallSetMessageReaction {
bot: self,
chat_id,
message_id,
reaction: None,
is_big: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object."]
pub fn build_get_me<'a>(&'a self) -> CallGetMe<'a> {
CallGetMe { bot: self }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object."]
pub fn build_edit_chat_subscription_invite_link<'a, V>(
&'a self,
chat_id: V,
invite_link: &'a str,
) -> CallEditChatSubscriptionInviteLink<'a, V> {
CallEditChatSubscriptionInviteLink {
bot: self,
chat_id,
invite_link,
name: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned."]
pub fn build_send_dice<'a, V>(&'a self, chat_id: V) -> CallSendDice<'a, V> {
CallSendDice {
bot: self,
chat_id,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
emoji: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.For sending voice messages, use the sendVoice method instead."]
pub fn build_send_audio<'a, V>(&'a self, chat_id: V, audio: FileData) -> CallSendAudio<'a, V> {
CallSendAudio {
bot: self,
chat_id,
audio,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
caption: None,
parse_mode: None,
caption_entities: None,
duration: None,
performer: None,
title: None,
thumbnail: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success."]
pub fn build_transfer_gift<'a>(
&'a self,
business_connection_id: &'a str,
owned_gift_id: &'a str,
new_owner_chat_id: i64,
) -> CallTransferGift<'a> {
CallTransferGift {
bot: self,
business_connection_id,
owned_gift_id,
new_owner_chat_id,
star_count: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success."]
pub fn build_remove_chat_verification<'a, V>(
&'a self,
chat_id: V,
) -> CallRemoveChatVerification<'a, V> {
CallRemoveChatVerification { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to copy messages of any kind. Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success."]
pub fn build_copy_message<'a, V>(
&'a self,
chat_id: V,
from_chat_id: V,
message_id: i64,
) -> CallCopyMessage<'a, V> {
CallCopyMessage {
bot: self,
chat_id,
from_chat_id,
message_id,
message_thread_id: None,
direct_messages_topic_id: None,
video_start_timestamp: None,
caption: None,
parse_mode: None,
caption_entities: None,
show_caption_above_media: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects."]
pub fn build_get_game_high_scores<'a>(&'a self, user_id: i64) -> CallGetGameHighScores<'a> {
CallGetGameHighScores {
bot: self,
user_id,
chat_id: None,
message_id: None,
inline_message_id: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send information about a venue. On success, the sent Message is returned."]
pub fn build_send_venue<'a, V>(
&'a self,
chat_id: V,
latitude: ::ordered_float::OrderedFloat<f64>,
longitude: ::ordered_float::OrderedFloat<f64>,
title: &'a str,
address: &'a str,
) -> CallSendVenue<'a, V> {
CallSendVenue {
bot: self,
chat_id,
latitude,
longitude,
title,
address,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
foursquare_id: None,
foursquare_type: None,
google_place_id: None,
google_place_type: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success."]
pub fn build_unpin_all_forum_topic_messages<'a, V>(
&'a self,
chat_id: V,
message_thread_id: i64,
) -> CallUnpinAllForumTopicMessages<'a, V> {
CallUnpinAllForumTopicMessages {
bot: self,
chat_id,
message_thread_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned."]
pub fn build_answer_web_app_query<'a, A: Into<&'a InlineQueryResult>>(
&'a self,
web_app_query_id: &'a str,
result: A,
) -> CallAnswerWebAppQuery<'a> {
CallAnswerWebAppQuery {
bot: self,
web_app_query_id,
result: result.into(),
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success."]
pub fn build_unban_chat_sender_chat<'a, V>(
&'a self,
chat_id: V,
sender_chat_id: i64,
) -> CallUnbanChatSenderChat<'a, V> {
CallUnbanChatSenderChat {
bot: self,
chat_id,
sender_chat_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned."]
pub fn build_answer_shipping_query<'a>(
&'a self,
shipping_query_id: &'a str,
ok: bool,
) -> CallAnswerShippingQuery<'a> {
CallAnswerShippingQuery {
bot: self,
shipping_query_id,
ok,
shipping_options: None,
error_message: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object."]
pub fn build_get_my_star_balance<'a>(&'a self) -> CallGetMyStarBalance<'a> {
CallGetMyStarBalance { bot: self }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success."]
pub fn build_send_gift<'a, V>(&'a self, gift_id: &'a str) -> CallSendGift<'a, V> {
CallSendGift {
bot: self,
gift_id,
user_id: None,
chat_id: None,
pay_for_upgrade: None,
text: None,
text_parse_mode: None,
text_entities: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received."]
pub fn build_get_file<'a>(&'a self, file_id: &'a str) -> CallGetFile<'a> {
CallGetFile { bot: self, file_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object."]
pub fn build_create_chat_subscription_invite_link<'a, V>(
&'a self,
chat_id: V,
subscription_period: i64,
subscription_price: i64,
) -> CallCreateChatSubscriptionInviteLink<'a, V> {
CallCreateChatSubscriptionInviteLink {
bot: self,
chat_id,
subscription_period,
subscription_price,
name: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success."]
pub fn build_set_chat_sticker_set<'a, V>(
&'a self,
chat_id: V,
sticker_set_name: &'a str,
) -> CallSetChatStickerSet<'a, V> {
CallSetChatStickerSet {
bot: self,
chat_id,
sticker_set_name,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
pub fn build_reopen_forum_topic<'a, V>(
&'a self,
chat_id: V,
message_thread_id: i64,
) -> CallReopenForumTopic<'a, V> {
CallReopenForumTopic {
bot: self,
chat_id,
message_thread_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Verifies a user on behalf of the organization which is represented by the bot. Returns True on success."]
pub fn build_verify_user<'a>(&'a self, user_id: i64) -> CallVerifyUser<'a> {
CallVerifyUser {
bot: self,
user_id,
custom_description: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of MessageId of the sent messages is returned."]
pub fn build_forward_messages<'a, V>(
&'a self,
chat_id: V,
from_chat_id: V,
message_ids: &'a Vec<i64>,
) -> CallForwardMessages<'a, V> {
CallForwardMessages {
bot: self,
chat_id,
from_chat_id,
message_ids,
message_thread_id: None,
direct_messages_topic_id: None,
disable_notification: None,
protect_content: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object."]
pub fn build_get_user_profile_photos<'a>(
&'a self,
user_id: i64,
) -> CallGetUserProfilePhotos<'a> {
CallGetUserProfilePhotos {
bot: self,
user_id,
offset: None,
limit: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success."]
pub fn build_set_my_commands<'a>(
&'a self,
commands: &'a Vec<BotCommand>,
) -> CallSetMyCommands<'a> {
CallSetMyCommands {
bot: self,
commands,
scope: None,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success."]
pub fn build_delete_my_commands<'a>(&'a self) -> CallDeleteMyCommands<'a> {
CallDeleteMyCommands {
bot: self,
scope: None,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success."]
pub fn build_delete_business_messages<'a>(
&'a self,
business_connection_id: &'a str,
message_ids: &'a Vec<i64>,
) -> CallDeleteBusinessMessages<'a> {
CallDeleteBusinessMessages {
bot: self,
business_connection_id,
message_ids,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success."]
pub fn build_set_business_account_profile_photo<'a, A: Into<&'a InputProfilePhoto>>(
&'a self,
business_connection_id: &'a str,
photo: A,
) -> CallSetBusinessAccountProfilePhoto<'a> {
CallSetBusinessAccountProfilePhoto {
bot: self,
business_connection_id,
photo: photo.into(),
is_public: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success."]
pub fn build_ban_chat_sender_chat<'a, V>(
&'a self,
chat_id: V,
sender_chat_id: i64,
) -> CallBanChatSenderChat<'a, V> {
CallBanChatSenderChat {
bot: self,
chat_id,
sender_chat_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the number of members in a chat. Returns Int on success."]
pub fn build_get_chat_member_count<'a, V>(
&'a self,
chat_id: V,
) -> CallGetChatMemberCount<'a, V> {
CallGetChatMemberCount { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get the token of a managed bot. Returns the token as String on success."]
pub fn build_get_managed_bot_token<'a>(&'a self, user_id: i64) -> CallGetManagedBotToken<'a> {
CallGetManagedBotToken { bot: self, user_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success."]
pub fn build_close_forum_topic<'a, V>(
&'a self,
chat_id: V,
message_thread_id: i64,
) -> CallCloseForumTopic<'a, V> {
CallCloseForumTopic {
bot: self,
chat_id,
message_thread_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method for your bot to leave a group, supergroup or channel. Returns True on success."]
pub fn build_leave_chat<'a, V>(&'a self, chat_id: V) -> CallLeaveChat<'a, V> {
CallLeaveChat { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects."]
pub fn build_get_chat_administrators<'a, V>(
&'a self,
chat_id: V,
) -> CallGetChatAdministrators<'a, V> {
CallGetChatAdministrators { bot: self, chat_id }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to log out from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns True on success. Requires no parameters."]
pub fn build_log_out<'a>(&'a self) -> CallLogOut<'a> {
CallLogOut { bot: self }
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to change the bot's name. Returns True on success."]
pub fn build_set_my_name<'a>(&'a self) -> CallSetMyName<'a> {
CallSetMyName {
bot: self,
name: None,
language_code: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success."]
pub fn build_approve_suggested_post<'a>(
&'a self,
chat_id: i64,
message_id: i64,
) -> CallApproveSuggestedPost<'a> {
CallApproveSuggestedPost {
bot: self,
chat_id,
message_id,
send_date: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned."]
pub fn build_send_sticker<'a, V>(
&'a self,
chat_id: V,
sticker: FileData,
) -> CallSendSticker<'a, V> {
CallSendSticker {
bot: self,
chat_id,
sticker,
business_connection_id: None,
message_thread_id: None,
direct_messages_topic_id: None,
emoji: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
suggested_post_parameters: None,
reply_parameters: None,
reply_markup: None,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success."]
pub fn build_read_business_message<'a>(
&'a self,
business_connection_id: &'a str,
chat_id: i64,
message_id: i64,
) -> CallReadBusinessMessage<'a> {
CallReadBusinessMessage {
bot: self,
business_connection_id,
chat_id,
message_id,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects."]
pub fn build_get_custom_emoji_stickers<'a>(
&'a self,
custom_emoji_ids: &'a Vec<String>,
) -> CallGetCustomEmojiStickers<'a> {
CallGetCustomEmojiStickers {
bot: self,
custom_emoji_ids,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success."]
pub fn build_upload_sticker_file<'a>(
&'a self,
user_id: i64,
sticker: FileData,
sticker_format: &'a str,
) -> CallUploadStickerFile<'a> {
CallUploadStickerFile {
bot: self,
user_id,
sticker,
sticker_format,
}
}
#[allow(clippy::needless_lifetimes, clippy::too_many_arguments)]
#[allow(rustdoc::invalid_html_tags)]
#[doc = "Returns the gifts owned and hosted by a user. Returns OwnedGifts on success."]
pub fn build_get_user_gifts<'a>(&'a self, user_id: i64) -> CallGetUserGifts<'a> {
CallGetUserGifts {
bot: self,
user_id,
exclude_unlimited: None,
exclude_limited_upgradable: None,
exclude_limited_non_upgradable: None,
exclude_from_blockchain: None,
exclude_unique: None,
sort_by_price: None,
offset: None,
limit: None,
}
}
}