From 5bc0d09cd3591169addcb430965f7383cf1d0e79 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Mon, 1 Jan 2024 20:28:27 +0200 Subject: [PATCH] reactions 2.0 --- src/api_params.rs | 138 +++++++++++-------------------- src/objects.rs | 206 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 254 insertions(+), 90 deletions(-) diff --git a/src/api_params.rs b/src/api_params.rs index e1224df..ee8a696 100644 --- a/src/api_params.rs +++ b/src/api_params.rs @@ -310,11 +310,7 @@ pub struct SendMessageParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -380,11 +376,7 @@ pub struct CopyMessageParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -429,11 +421,7 @@ pub struct SendPhotoParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -490,11 +478,7 @@ pub struct SendAudioParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -543,11 +527,7 @@ pub struct SendDocumentParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -612,11 +592,7 @@ pub struct SendVideoParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -677,11 +653,7 @@ pub struct SendAnimationParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -726,11 +698,7 @@ pub struct SendVoiceParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -771,11 +739,7 @@ pub struct SendVideoNoteParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -803,11 +767,7 @@ pub struct SendMediaGroupParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] @@ -849,11 +809,7 @@ pub struct SendLocationParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -959,11 +915,7 @@ pub struct SendVenueParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -1003,11 +955,7 @@ pub struct SendContactParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -1078,11 +1026,7 @@ pub struct SendPollParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -1112,11 +1056,7 @@ pub struct SendDiceParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -1873,11 +1813,7 @@ pub struct SendStickerParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -2150,11 +2086,7 @@ pub struct SendInvoiceParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -2293,11 +2225,7 @@ pub struct SendGameParams { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] - pub reply_to_message_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - #[builder(setter(into, strip_option), default)] - pub allow_sending_without_reply: Option, + pub reply_parameters: Option, #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] @@ -2553,5 +2481,35 @@ pub struct GetChatMenuButtonParams { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] pub struct UnpinAllGeneralForumTopicMessagesParams { + #[builder(setter(into))] pub chat_id: ChatId, } + +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] +pub struct ReplyParameters { + pub message_id: i32, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub chat_id: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub allow_sending_without_reply: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub quote: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub quote_parse_mode: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub quote_entities: Option>, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub quote_position: Option, +} diff --git a/src/objects.rs b/src/objects.rs index 9be947c..13c14db 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -637,6 +637,14 @@ pub struct Message { #[builder(setter(into, strip_option), default)] pub reply_to_message: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub external_reply: Option>, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub quote: Option>, + #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] pub via_bot: Option>, @@ -897,6 +905,115 @@ pub struct MessageEntity { pub custom_emoji_id: Option, } +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Builder)] +pub struct TextQuote { + #[builder(setter(into))] + pub text: String, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub entities: Option>, + + pub position: u32, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub is_manual: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Builder)] +pub struct ExternalReplyInfo { + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub origin: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub chain: Option, + + pub message_id: i32, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub link_preview_options: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub animation: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub audio: Option