Skip to content

Commit

Permalink
Bot API 7.2 - Other Changes (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrat555 authored Apr 19, 2024
1 parent b5101a9 commit 6e07840
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/api_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
8 changes: 8 additions & 0 deletions src/api_traits/async_telegram_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1174,6 +1175,13 @@ pub trait AsyncTelegramApi {
self.request("setStickerPositionInSet", Some(params)).await
}

async fn replace_sticker_in_set(
&self,
params: &ReplaceStickerInSetParams,
) -> Result<MethodResponse<bool>, Self::Error> {
self.request("replaceStickerInSet", Some(params)).await
}

async fn delete_sticker_from_set(
&self,
params: &DeleteStickerFromSetParams,
Expand Down
8 changes: 8 additions & 0 deletions src/api_traits/telegram_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1126,6 +1127,13 @@ pub trait TelegramApi {
self.request("deleteStickerFromSet", Some(params))
}

fn replace_sticker_in_set(
&self,
params: &ReplaceStickerInSetParams,
) -> Result<MethodResponse<bool>, Self::Error> {
self.request("replaceStickerInSet", Some(params))
}

fn set_sticker_emoji_list(
&self,
params: &SetStickerEmojiListParams,
Expand Down
25 changes: 25 additions & 0 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub can_connect_to_business: Option<bool>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)]
Expand Down Expand Up @@ -505,6 +509,10 @@ pub struct Chat {
#[builder(setter(into, strip_option), default)]
pub active_usernames: Option<Vec<String>>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub birthdate: Option<Birthdate>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub business_intro: Option<BusinessIntro>,
Expand All @@ -517,6 +525,10 @@ pub struct Chat {
#[builder(setter(into, strip_option), default)]
pub business_opening_hours: Option<BusinessOpeningHours>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub personal_chat: Option<Box<Chat>>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub available_reactions: Option<Vec<ReactionType>>,
Expand Down Expand Up @@ -703,6 +715,10 @@ pub struct Message {
#[builder(setter(into, strip_option), default)]
pub has_protected_content: Option<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub is_from_offline: Option<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub media_group_id: Option<String>,
Expand Down Expand Up @@ -2044,6 +2060,15 @@ pub struct ChatPermissions {
pub can_manage_topics: Option<bool>,
}

#[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")]
Expand Down

0 comments on commit 6e07840

Please sign in to comment.