mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Add replaceStickerInSet
TBA method
This commit is contained in:
parent
b534a09633
commit
2265141030
12 changed files with 194 additions and 76 deletions
|
@ -39,7 +39,7 @@
|
||||||
//! [github]: https://github.com/WaffleLapkin/tg-methods-schema
|
//! [github]: https://github.com/WaffleLapkin/tg-methods-schema
|
||||||
|
|
||||||
Schema(
|
Schema(
|
||||||
api_version: ApiVersion(ver: "7.1", date: "February 16, 2024"),
|
api_version: ApiVersion(ver: "7.2", date: "March 31, 2024"),
|
||||||
methods: [
|
methods: [
|
||||||
Method(
|
Method(
|
||||||
names: ("getUpdates", "GetUpdates", "get_updates"),
|
names: ("getUpdates", "GetUpdates", "get_updates"),
|
||||||
|
@ -3859,6 +3859,42 @@ Schema(
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Method(
|
||||||
|
names: ("replaceStickerInSet", "ReplaceStickerInSet", "replace_sticker_in_set"),
|
||||||
|
return_ty: True,
|
||||||
|
doc: Doc(
|
||||||
|
md: "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.",
|
||||||
|
md_links: {
|
||||||
|
"DeleteStickerFromSet": "https://docs.rs/teloxide/latest/teloxide/payloads/struct.DeleteStickerFromSet.html",
|
||||||
|
"AddStickerToSet": "https://docs.rs/teloxide/latest/teloxide/payloads/struct.AddStickerToSet.html",
|
||||||
|
"SetStickerPositionInSet": "https://docs.rs/teloxide/latest/teloxide/payloads/struct.SetStickerPositionInSet.html",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
tg_doc: "https://core.telegram.org/bots/api#replacestickerinset",
|
||||||
|
tg_category: "Stickers",
|
||||||
|
params: [
|
||||||
|
Param(
|
||||||
|
name: "user_id",
|
||||||
|
ty: RawTy("UserId"),
|
||||||
|
descr: Doc(md: "User identifier of the sticker set owner"),
|
||||||
|
),
|
||||||
|
Param(
|
||||||
|
name: "name",
|
||||||
|
ty: String,
|
||||||
|
descr: Doc(md: "Sticker set name"),
|
||||||
|
),
|
||||||
|
Param(
|
||||||
|
name: "old_sticker",
|
||||||
|
ty: String,
|
||||||
|
descr: Doc(md: "File identifier of the replaced sticker"),
|
||||||
|
),
|
||||||
|
Param(
|
||||||
|
name: "sticker",
|
||||||
|
ty: RawTy("InputSticker"),
|
||||||
|
descr: Doc(md: "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."),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Method(
|
Method(
|
||||||
names: ("setStickerSetThumbnail", "SetStickerSetThumbnail", "set_sticker_set_thumbnail"),
|
names: ("setStickerSetThumbnail", "SetStickerSetThumbnail", "set_sticker_set_thumbnail"),
|
||||||
return_ty: True,
|
return_ty: True,
|
||||||
|
|
|
@ -196,6 +196,7 @@ where
|
||||||
add_sticker_to_set,
|
add_sticker_to_set,
|
||||||
set_sticker_position_in_set,
|
set_sticker_position_in_set,
|
||||||
delete_sticker_from_set,
|
delete_sticker_from_set,
|
||||||
|
replace_sticker_in_set,
|
||||||
set_sticker_set_thumbnail,
|
set_sticker_set_thumbnail,
|
||||||
set_custom_emoji_sticker_set_thumbnail,
|
set_custom_emoji_sticker_set_thumbnail,
|
||||||
set_sticker_set_title,
|
set_sticker_set_title,
|
||||||
|
|
|
@ -295,6 +295,7 @@ where
|
||||||
add_sticker_to_set,
|
add_sticker_to_set,
|
||||||
set_sticker_position_in_set,
|
set_sticker_position_in_set,
|
||||||
delete_sticker_from_set,
|
delete_sticker_from_set,
|
||||||
|
replace_sticker_in_set,
|
||||||
set_sticker_set_thumbnail,
|
set_sticker_set_thumbnail,
|
||||||
set_custom_emoji_sticker_set_thumbnail,
|
set_custom_emoji_sticker_set_thumbnail,
|
||||||
set_sticker_set_title,
|
set_sticker_set_title,
|
||||||
|
|
|
@ -269,6 +269,7 @@ where
|
||||||
add_sticker_to_set,
|
add_sticker_to_set,
|
||||||
set_sticker_position_in_set,
|
set_sticker_position_in_set,
|
||||||
delete_sticker_from_set,
|
delete_sticker_from_set,
|
||||||
|
replace_sticker_in_set,
|
||||||
set_sticker_set_thumbnail,
|
set_sticker_set_thumbnail,
|
||||||
set_custom_emoji_sticker_set_thumbnail,
|
set_custom_emoji_sticker_set_thumbnail,
|
||||||
set_sticker_set_title,
|
set_sticker_set_title,
|
||||||
|
|
|
@ -178,6 +178,7 @@ where
|
||||||
add_sticker_to_set,
|
add_sticker_to_set,
|
||||||
set_sticker_position_in_set,
|
set_sticker_position_in_set,
|
||||||
delete_sticker_from_set,
|
delete_sticker_from_set,
|
||||||
|
replace_sticker_in_set,
|
||||||
set_sticker_set_thumbnail,
|
set_sticker_set_thumbnail,
|
||||||
set_custom_emoji_sticker_set_thumbnail,
|
set_custom_emoji_sticker_set_thumbnail,
|
||||||
set_sticker_set_title,
|
set_sticker_set_title,
|
||||||
|
|
|
@ -225,6 +225,7 @@ where
|
||||||
add_sticker_to_set,
|
add_sticker_to_set,
|
||||||
set_sticker_position_in_set,
|
set_sticker_position_in_set,
|
||||||
delete_sticker_from_set,
|
delete_sticker_from_set,
|
||||||
|
replace_sticker_in_set,
|
||||||
set_sticker_set_thumbnail,
|
set_sticker_set_thumbnail,
|
||||||
set_custom_emoji_sticker_set_thumbnail,
|
set_custom_emoji_sticker_set_thumbnail,
|
||||||
set_sticker_set_title,
|
set_sticker_set_title,
|
||||||
|
|
|
@ -1244,6 +1244,30 @@ impl Requester for Bot {
|
||||||
Self::DeleteStickerFromSet::new(self.clone(), payloads::DeleteStickerFromSet::new(sticker))
|
Self::DeleteStickerFromSet::new(self.clone(), payloads::DeleteStickerFromSet::new(sticker))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ReplaceStickerInSet = JsonRequest<payloads::ReplaceStickerInSet>;
|
||||||
|
|
||||||
|
fn replace_sticker_in_set<N, O>(
|
||||||
|
&self,
|
||||||
|
user_id: UserId,
|
||||||
|
name: N,
|
||||||
|
old_sticker: O,
|
||||||
|
sticker: InputSticker,
|
||||||
|
) -> Self::ReplaceStickerInSet
|
||||||
|
where
|
||||||
|
N: Into<String>,
|
||||||
|
O: Into<String>,
|
||||||
|
{
|
||||||
|
Self::ReplaceStickerInSet::new(
|
||||||
|
self.clone(),
|
||||||
|
payloads::ReplaceStickerInSet {
|
||||||
|
user_id,
|
||||||
|
name: name.into(),
|
||||||
|
old_sticker: old_sticker.into(),
|
||||||
|
sticker,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
type SetStickerSetThumbnail = MultipartRequest<payloads::SetStickerSetThumbnail>;
|
type SetStickerSetThumbnail = MultipartRequest<payloads::SetStickerSetThumbnail>;
|
||||||
|
|
||||||
fn set_sticker_set_thumbnail<N>(&self, name: N, user_id: UserId) -> Self::SetStickerSetThumbnail
|
fn set_sticker_set_thumbnail<N>(&self, name: N, user_id: UserId) -> Self::SetStickerSetThumbnail
|
||||||
|
|
|
@ -1339,6 +1339,15 @@ macro_rules! requester_forward {
|
||||||
$body!(delete_sticker_from_set this (sticker: S))
|
$body!(delete_sticker_from_set this (sticker: S))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
(@method replace_sticker_in_set $body:ident $ty:ident) => {
|
||||||
|
type ReplaceStickerInSet = $ty![ReplaceStickerInSet];
|
||||||
|
|
||||||
|
fn replace_sticker_in_set<N, O>(&self, user_id: UserId, name: N, old_sticker: O, sticker: InputSticker) -> Self::ReplaceStickerInSet where N: Into<String>,
|
||||||
|
O: Into<String> {
|
||||||
|
let this = self;
|
||||||
|
$body!(replace_sticker_in_set this (user_id: UserId, name: N, old_sticker: O, sticker: InputSticker))
|
||||||
|
}
|
||||||
|
};
|
||||||
(@method set_sticker_set_thumbnail $body:ident $ty:ident) => {
|
(@method set_sticker_set_thumbnail $body:ident $ty:ident) => {
|
||||||
type SetStickerSetThumbnail = $ty![SetStickerSetThumbnail];
|
type SetStickerSetThumbnail = $ty![SetStickerSetThumbnail];
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ mod pin_chat_message;
|
||||||
mod promote_chat_member;
|
mod promote_chat_member;
|
||||||
mod reopen_forum_topic;
|
mod reopen_forum_topic;
|
||||||
mod reopen_general_forum_topic;
|
mod reopen_general_forum_topic;
|
||||||
|
mod replace_sticker_in_set;
|
||||||
mod restrict_chat_member;
|
mod restrict_chat_member;
|
||||||
mod revoke_chat_invite_link;
|
mod revoke_chat_invite_link;
|
||||||
mod send_animation;
|
mod send_animation;
|
||||||
|
@ -225,6 +226,7 @@ pub use pin_chat_message::{PinChatMessage, PinChatMessageSetters};
|
||||||
pub use promote_chat_member::{PromoteChatMember, PromoteChatMemberSetters};
|
pub use promote_chat_member::{PromoteChatMember, PromoteChatMemberSetters};
|
||||||
pub use reopen_forum_topic::{ReopenForumTopic, ReopenForumTopicSetters};
|
pub use reopen_forum_topic::{ReopenForumTopic, ReopenForumTopicSetters};
|
||||||
pub use reopen_general_forum_topic::{ReopenGeneralForumTopic, ReopenGeneralForumTopicSetters};
|
pub use reopen_general_forum_topic::{ReopenGeneralForumTopic, ReopenGeneralForumTopicSetters};
|
||||||
|
pub use replace_sticker_in_set::{ReplaceStickerInSet, ReplaceStickerInSetSetters};
|
||||||
pub use restrict_chat_member::{RestrictChatMember, RestrictChatMemberSetters};
|
pub use restrict_chat_member::{RestrictChatMember, RestrictChatMemberSetters};
|
||||||
pub use revoke_chat_invite_link::{RevokeChatInviteLink, RevokeChatInviteLinkSetters};
|
pub use revoke_chat_invite_link::{RevokeChatInviteLink, RevokeChatInviteLinkSetters};
|
||||||
pub use send_animation::{SendAnimation, SendAnimationSetters};
|
pub use send_animation::{SendAnimation, SendAnimationSetters};
|
||||||
|
|
27
crates/teloxide-core/src/payloads/replace_sticker_in_set.rs
Normal file
27
crates/teloxide-core/src/payloads/replace_sticker_in_set.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
//! Generated by `codegen_payloads`, do not edit by hand.
|
||||||
|
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use crate::types::{InputSticker, True, UserId};
|
||||||
|
|
||||||
|
impl_payload! {
|
||||||
|
@[multipart = sticker]
|
||||||
|
/// 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.
|
||||||
|
///
|
||||||
|
/// [DeleteStickerFromSet]: https://docs.rs/teloxide/latest/teloxide/payloads/struct.DeleteStickerFromSet.html
|
||||||
|
/// [AddStickerToSet]: https://docs.rs/teloxide/latest/teloxide/payloads/struct.AddStickerToSet.html
|
||||||
|
/// [SetStickerPositionInSet]: https://docs.rs/teloxide/latest/teloxide/payloads/struct.SetStickerPositionInSet.html
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub ReplaceStickerInSet (ReplaceStickerInSetSetters) => True {
|
||||||
|
required {
|
||||||
|
/// User identifier of the sticker set owner
|
||||||
|
pub user_id: UserId,
|
||||||
|
/// Sticker set name
|
||||||
|
pub name: String [into],
|
||||||
|
/// File identifier of the replaced sticker
|
||||||
|
pub old_sticker: String [into],
|
||||||
|
/// 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.
|
||||||
|
pub sticker: InputSticker,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,10 +29,10 @@ pub use crate::payloads::{
|
||||||
GetWebhookInfoSetters as _, HideGeneralForumTopicSetters as _, KickChatMemberSetters as _,
|
GetWebhookInfoSetters as _, HideGeneralForumTopicSetters as _, KickChatMemberSetters as _,
|
||||||
LeaveChatSetters as _, LogOutSetters as _, PinChatMessageSetters as _,
|
LeaveChatSetters as _, LogOutSetters as _, PinChatMessageSetters as _,
|
||||||
PromoteChatMemberSetters as _, ReopenForumTopicSetters as _,
|
PromoteChatMemberSetters as _, ReopenForumTopicSetters as _,
|
||||||
ReopenGeneralForumTopicSetters as _, RestrictChatMemberSetters as _,
|
ReopenGeneralForumTopicSetters as _, ReplaceStickerInSetSetters as _,
|
||||||
RevokeChatInviteLinkSetters as _, SendAnimationSetters as _, SendAudioSetters as _,
|
RestrictChatMemberSetters as _, RevokeChatInviteLinkSetters as _, SendAnimationSetters as _,
|
||||||
SendChatActionSetters as _, SendContactSetters as _, SendDiceSetters as _,
|
SendAudioSetters as _, SendChatActionSetters as _, SendContactSetters as _,
|
||||||
SendDocumentSetters as _, SendGameSetters as _, SendInvoiceSetters as _,
|
SendDiceSetters as _, SendDocumentSetters as _, SendGameSetters as _, SendInvoiceSetters as _,
|
||||||
SendLocationSetters as _, SendMediaGroupSetters as _, SendMessageSetters as _,
|
SendLocationSetters as _, SendMediaGroupSetters as _, SendMessageSetters as _,
|
||||||
SendPhotoSetters as _, SendPollSetters as _, SendStickerSetters as _, SendVenueSetters as _,
|
SendPhotoSetters as _, SendPollSetters as _, SendStickerSetters as _, SendVenueSetters as _,
|
||||||
SendVideoNoteSetters as _, SendVideoSetters as _, SendVoiceSetters as _,
|
SendVideoNoteSetters as _, SendVideoSetters as _, SendVoiceSetters as _,
|
||||||
|
|
|
@ -1108,6 +1108,20 @@ pub trait Requester {
|
||||||
where
|
where
|
||||||
S: Into<String>;
|
S: Into<String>;
|
||||||
|
|
||||||
|
type ReplaceStickerInSet: Request<Payload = ReplaceStickerInSet, Err = Self::Err>;
|
||||||
|
|
||||||
|
/// For Telegram documentation see [`ReplaceStickerInSet`].
|
||||||
|
fn replace_sticker_in_set<N, O>(
|
||||||
|
&self,
|
||||||
|
user_id: UserId,
|
||||||
|
name: N,
|
||||||
|
old_sticker: O,
|
||||||
|
sticker: InputSticker,
|
||||||
|
) -> Self::ReplaceStickerInSet
|
||||||
|
where
|
||||||
|
N: Into<String>,
|
||||||
|
O: Into<String>;
|
||||||
|
|
||||||
type SetStickerSetThumbnail: Request<Payload = SetStickerSetThumbnail, Err = Self::Err>;
|
type SetStickerSetThumbnail: Request<Payload = SetStickerSetThumbnail, Err = Self::Err>;
|
||||||
|
|
||||||
/// For Telegram documentation see [`SetStickerSetThumbnail`].
|
/// For Telegram documentation see [`SetStickerSetThumbnail`].
|
||||||
|
@ -1405,6 +1419,7 @@ macro_rules! forward_all {
|
||||||
add_sticker_to_set,
|
add_sticker_to_set,
|
||||||
set_sticker_position_in_set,
|
set_sticker_position_in_set,
|
||||||
delete_sticker_from_set,
|
delete_sticker_from_set,
|
||||||
|
replace_sticker_in_set,
|
||||||
set_sticker_set_thumbnail,
|
set_sticker_set_thumbnail,
|
||||||
set_custom_emoji_sticker_set_thumbnail,
|
set_custom_emoji_sticker_set_thumbnail,
|
||||||
set_sticker_set_title,
|
set_sticker_set_title,
|
||||||
|
|
Loading…
Reference in a new issue