From 6e07840e7b504631ff909059316e202b19e052a7 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Fri, 19 Apr 2024 14:27:23 +0300 Subject: [PATCH] Bot API 7.2 - Other Changes (#160) --- src/api_params.rs | 13 +++++++++++++ src/api_traits/async_telegram_api.rs | 8 ++++++++ src/api_traits/telegram_api.rs | 8 ++++++++ src/objects.rs | 25 +++++++++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/src/api_params.rs b/src/api_params.rs index df004e2..a0520bf 100644 --- a/src/api_params.rs +++ b/src/api_params.rs @@ -2022,6 +2022,19 @@ pub struct DeleteStickerFromSetParams { pub sticker: String, } +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] +pub struct ReplaceStickerInSetParams { + pub user_id: u64, + + #[builder(setter(into))] + pub name: String, + + #[builder(setter(into))] + pub old_sticker: String, + + pub sticker: InputSticker, +} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] pub struct SetStickerEmojiListParams { #[builder(setter(into))] diff --git a/src/api_traits/async_telegram_api.rs b/src/api_traits/async_telegram_api.rs index b498499..aad0d64 100644 --- a/src/api_traits/async_telegram_api.rs +++ b/src/api_traits/async_telegram_api.rs @@ -65,6 +65,7 @@ use crate::api_params::PinChatMessageParams; use crate::api_params::PromoteChatMemberParams; use crate::api_params::ReopenForumTopicParams; use crate::api_params::ReopenGeneralForumTopicParams; +use crate::api_params::ReplaceStickerInSetParams; use crate::api_params::RestrictChatMemberParams; use crate::api_params::RevokeChatInviteLinkParams; use crate::api_params::SendAnimationParams; @@ -1174,6 +1175,13 @@ pub trait AsyncTelegramApi { self.request("setStickerPositionInSet", Some(params)).await } + async fn replace_sticker_in_set( + &self, + params: &ReplaceStickerInSetParams, + ) -> Result, Self::Error> { + self.request("replaceStickerInSet", Some(params)).await + } + async fn delete_sticker_from_set( &self, params: &DeleteStickerFromSetParams, diff --git a/src/api_traits/telegram_api.rs b/src/api_traits/telegram_api.rs index 9e749cc..d08abc8 100644 --- a/src/api_traits/telegram_api.rs +++ b/src/api_traits/telegram_api.rs @@ -64,6 +64,7 @@ use crate::api_params::PinChatMessageParams; use crate::api_params::PromoteChatMemberParams; use crate::api_params::ReopenForumTopicParams; use crate::api_params::ReopenGeneralForumTopicParams; +use crate::api_params::ReplaceStickerInSetParams; use crate::api_params::RestrictChatMemberParams; use crate::api_params::RevokeChatInviteLinkParams; use crate::api_params::SendAnimationParams; @@ -1126,6 +1127,13 @@ pub trait TelegramApi { self.request("deleteStickerFromSet", Some(params)) } + fn replace_sticker_in_set( + &self, + params: &ReplaceStickerInSetParams, + ) -> Result, Self::Error> { + self.request("replaceStickerInSet", Some(params)) + } + fn set_sticker_emoji_list( &self, params: &SetStickerEmojiListParams, diff --git a/src/objects.rs b/src/objects.rs index a9aa81f..49312df 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -468,6 +468,10 @@ pub struct User { #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] pub supports_inline_queries: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub can_connect_to_business: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] @@ -505,6 +509,10 @@ pub struct Chat { #[builder(setter(into, strip_option), default)] pub active_usernames: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub birthdate: Option, + #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] pub business_intro: Option, @@ -517,6 +525,10 @@ pub struct Chat { #[builder(setter(into, strip_option), default)] pub business_opening_hours: Option, + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub personal_chat: Option>, + #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] pub available_reactions: Option>, @@ -703,6 +715,10 @@ pub struct Message { #[builder(setter(into, strip_option), default)] pub has_protected_content: Option, + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub is_from_offline: Option, + #[serde(skip_serializing_if = "Option::is_none")] #[builder(setter(into, strip_option), default)] pub media_group_id: Option, @@ -2044,6 +2060,15 @@ pub struct ChatPermissions { pub can_manage_topics: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] +pub struct Birthdate { + pub day: u8, + + pub month: u8, + + pub year: u16, +} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)] pub struct BusinessIntro { #[serde(skip_serializing_if = "Option::is_none")]