diff --git a/schema.ron b/schema.ron index bd79cb18..b5d6d0c2 100644 --- a/schema.ron +++ b/schema.ron @@ -3164,6 +3164,20 @@ Schema( ), ], ), + Method( + names: ("getCustomEmojiStickers", "GetCustomEmojiStickers", "get_custom_emoji_stickers"), + return_ty: ArrayOf(RawTy("Sticker")), + doc: Doc(md: "Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects."), + tg_doc: "https://core.telegram.org/bots/api#getcustomemojistickers", + tg_category: "Stickers", + params: [ + Param( + name: "custom_emoji_ids", + ty: ArrayOf(String), + descr: Doc(md: "List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified."), + ), + ], + ), Method( names: ("uploadStickerFile", "UploadStickerFile", "upload_sticker_file"), return_ty: RawTy("FileMeta"), @@ -3212,7 +3226,7 @@ Schema( name: "sticker", ty: RawTy("InputSticker"), descr: Doc( - md: "**PNG** or **TGS** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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 info on Sending Files »]", + md: "**PNG** image, **TGS** animation or **WEBM** video with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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 info on Sending Files »]", md_links: {"More info on Sending Files »": "https://core.telegram.org/bots/api#sending-files"}, ), ), @@ -3222,9 +3236,9 @@ Schema( descr: Doc(md: "One or more emoji corresponding to the sticker"), ), Param( - name: "contains_masks", - ty: Option(bool), - descr: Doc(md: "Pass _True_, if a set of mask stickers should be created"), + name: "sticker_type", + ty: Option(RawTy("StickerType")), + descr: Doc(md: "Type of stickers in the set, pass “regular” or “mask”. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created."), ), Param( name: "mask_position", diff --git a/src/adaptors/auto_send.rs b/src/adaptors/auto_send.rs index dfd4a4c8..607d69c0 100644 --- a/src/adaptors/auto_send.rs +++ b/src/adaptors/auto_send.rs @@ -142,6 +142,7 @@ where delete_message, send_sticker, get_sticker_set, + get_custom_emoji_stickers, upload_sticker_file, create_new_sticker_set, add_sticker_to_set, diff --git a/src/adaptors/cache_me.rs b/src/adaptors/cache_me.rs index 5ae8669a..30365693 100644 --- a/src/adaptors/cache_me.rs +++ b/src/adaptors/cache_me.rs @@ -169,6 +169,7 @@ where delete_message, send_sticker, get_sticker_set, + get_custom_emoji_stickers, upload_sticker_file, create_new_sticker_set, add_sticker_to_set, diff --git a/src/adaptors/erased.rs b/src/adaptors/erased.rs index fc12d8ac..aee6c21c 100644 --- a/src/adaptors/erased.rs +++ b/src/adaptors/erased.rs @@ -166,6 +166,9 @@ macro_rules! fwd_erased { (@convert $m:ident, $arg:ident, errors : $T:ty) => { $arg.into_iter().collect() }; + (@convert $m:ident, $arg:ident, custom_emoji_ids : $T:ty) => { + $arg.into_iter().collect() + }; (@convert $m:ident, $arg:ident, $arg_:ident : $T:ty) => { $arg.into() }; @@ -258,6 +261,7 @@ where delete_message, send_sticker, get_sticker_set, + get_custom_emoji_stickers, upload_sticker_file, create_new_sticker_set, add_sticker_to_set, @@ -713,6 +717,11 @@ trait ErasableRequester<'a> { fn get_sticker_set(&self, name: String) -> ErasedRequest<'a, GetStickerSet, Self::Err>; + fn get_custom_emoji_stickers( + &self, + custom_emoji_ids: Vec, + ) -> ErasedRequest<'a, GetCustomEmojiStickers, Self::Err>; + fn upload_sticker_file( &self, user_id: UserId, @@ -1426,6 +1435,13 @@ where Requester::get_sticker_set(self, name).erase() } + fn get_custom_emoji_stickers( + &self, + custom_emoji_ids: Vec, + ) -> ErasedRequest<'a, GetCustomEmojiStickers, Self::Err> { + Requester::get_custom_emoji_stickers(self, custom_emoji_ids).erase() + } + fn upload_sticker_file( &self, user_id: UserId, diff --git a/src/adaptors/parse_mode.rs b/src/adaptors/parse_mode.rs index ca53a67e..04516105 100644 --- a/src/adaptors/parse_mode.rs +++ b/src/adaptors/parse_mode.rs @@ -164,6 +164,7 @@ impl Requester for DefaultParseMode { delete_message, send_sticker, get_sticker_set, + get_custom_emoji_stickers, upload_sticker_file, create_new_sticker_set, add_sticker_to_set, diff --git a/src/adaptors/throttle/requester_impl.rs b/src/adaptors/throttle/requester_impl.rs index 50cbccf6..e7817f50 100644 --- a/src/adaptors/throttle/requester_impl.rs +++ b/src/adaptors/throttle/requester_impl.rs @@ -148,6 +148,7 @@ where stop_poll, delete_message, get_sticker_set, + get_custom_emoji_stickers, upload_sticker_file, create_new_sticker_set, add_sticker_to_set, diff --git a/src/adaptors/trace.rs b/src/adaptors/trace.rs index 7e0e9a78..fef86e76 100644 --- a/src/adaptors/trace.rs +++ b/src/adaptors/trace.rs @@ -195,6 +195,7 @@ where delete_message, send_sticker, get_sticker_set, + get_custom_emoji_stickers, upload_sticker_file, create_new_sticker_set, add_sticker_to_set, diff --git a/src/bot/api.rs b/src/bot/api.rs index 96c6239a..d78cad73 100644 --- a/src/bot/api.rs +++ b/src/bot/api.rs @@ -911,6 +911,18 @@ impl Requester for Bot { Self::GetStickerSet::new(self.clone(), payloads::GetStickerSet::new(name)) } + type GetCustomEmojiStickers = JsonRequest; + + fn get_custom_emoji_stickers(&self, custom_emoji_ids: C) -> Self::GetCustomEmojiStickers + where + C: IntoIterator, + { + Self::GetCustomEmojiStickers::new( + self.clone(), + payloads::GetCustomEmojiStickers::new(custom_emoji_ids), + ) + } + type UploadStickerFile = MultipartRequest; fn upload_sticker_file( diff --git a/src/local_macros.rs b/src/local_macros.rs index a1d668cb..56659c5e 100644 --- a/src/local_macros.rs +++ b/src/local_macros.rs @@ -1087,6 +1087,14 @@ macro_rules! requester_forward { $body!(get_sticker_set this (name: N)) } }; + (@method get_custom_emoji_stickers $body:ident $ty:ident) => { + type GetCustomEmojiStickers = $ty![GetCustomEmojiStickers]; + + fn get_custom_emoji_stickers(&self, custom_emoji_ids: C) -> Self::GetCustomEmojiStickers where C: IntoIterator { + let this = self; + $body!(get_custom_emoji_stickers this (custom_emoji_ids: C)) + } + }; (@method upload_sticker_file $body:ident $ty:ident) => { type UploadStickerFile = $ty![UploadStickerFile]; diff --git a/src/payloads.rs b/src/payloads.rs index 5989336f..168c257a 100644 --- a/src/payloads.rs +++ b/src/payloads.rs @@ -55,6 +55,7 @@ mod get_chat_member; mod get_chat_member_count; mod get_chat_members_count; mod get_chat_menu_button; +mod get_custom_emoji_stickers; mod get_file; mod get_game_high_scores; mod get_me; @@ -157,6 +158,7 @@ pub use get_chat_member::{GetChatMember, GetChatMemberSetters}; pub use get_chat_member_count::{GetChatMemberCount, GetChatMemberCountSetters}; pub use get_chat_members_count::{GetChatMembersCount, GetChatMembersCountSetters}; pub use get_chat_menu_button::{GetChatMenuButton, GetChatMenuButtonSetters}; +pub use get_custom_emoji_stickers::{GetCustomEmojiStickers, GetCustomEmojiStickersSetters}; pub use get_file::{GetFile, GetFileSetters}; pub use get_game_high_scores::{GetGameHighScores, GetGameHighScoresSetters}; pub use get_me::{GetMe, GetMeSetters}; diff --git a/src/payloads/create_new_sticker_set.rs b/src/payloads/create_new_sticker_set.rs index cf4c4453..0c92056e 100644 --- a/src/payloads/create_new_sticker_set.rs +++ b/src/payloads/create_new_sticker_set.rs @@ -2,7 +2,7 @@ use serde::Serialize; -use crate::types::{InputSticker, MaskPosition, True, UserId}; +use crate::types::{InputSticker, MaskPosition, StickerType, True, UserId}; impl_payload! { @[multipart = sticker] @@ -16,7 +16,7 @@ impl_payload! { pub name: String [into], /// Sticker set title, 1-64 characters pub title: String [into], - /// **PNG** or **TGS** image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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 info on Sending Files »] + /// **PNG** image, **TGS** animation or **WEBM** video with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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 info on Sending Files »] /// /// [More info on Sending Files »]: crate::types::InputFile #[serde(flatten)] @@ -25,8 +25,8 @@ impl_payload! { pub emojis: String [into], } optional { - /// Pass _True_, if a set of mask stickers should be created - pub contains_masks: bool, + /// Type of stickers in the set, pass “regular” or “mask”. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created. + pub sticker_type: StickerType, /// A JSON-serialized object for position where the mask should be placed on faces pub mask_position: MaskPosition, } diff --git a/src/payloads/get_custom_emoji_stickers.rs b/src/payloads/get_custom_emoji_stickers.rs new file mode 100644 index 00000000..68cedfff --- /dev/null +++ b/src/payloads/get_custom_emoji_stickers.rs @@ -0,0 +1,16 @@ +//! Generated by `codegen_payloads`, do not edit by hand. + +use serde::Serialize; + +use crate::types::Sticker; + +impl_payload! { + /// Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects. + #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)] + pub GetCustomEmojiStickers (GetCustomEmojiStickersSetters) => Vec { + required { + /// List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. + pub custom_emoji_ids: Vec [collect], + } + } +} diff --git a/src/payloads/setters.rs b/src/payloads/setters.rs index a25e3026..d9e68c24 100644 --- a/src/payloads/setters.rs +++ b/src/payloads/setters.rs @@ -18,8 +18,8 @@ pub use crate::payloads::{ EditMessageTextSetters as _, ExportChatInviteLinkSetters as _, ForwardMessageSetters as _, GetChatAdministratorsSetters as _, GetChatMemberCountSetters as _, GetChatMemberSetters as _, GetChatMembersCountSetters as _, GetChatMenuButtonSetters as _, GetChatSetters as _, - GetFileSetters as _, GetGameHighScoresSetters as _, GetMeSetters as _, - GetMyCommandsSetters as _, GetMyDefaultAdministratorRightsSetters as _, + GetCustomEmojiStickersSetters as _, GetFileSetters as _, GetGameHighScoresSetters as _, + GetMeSetters as _, GetMyCommandsSetters as _, GetMyDefaultAdministratorRightsSetters as _, GetStickerSetSetters as _, GetUpdatesSetters as _, GetUserProfilePhotosSetters as _, GetWebhookInfoSetters as _, KickChatMemberSetters as _, LeaveChatSetters as _, LogOutSetters as _, PinChatMessageSetters as _, PromoteChatMemberSetters as _, diff --git a/src/requests/requester.rs b/src/requests/requester.rs index 874517bf..b18a825c 100644 --- a/src/requests/requester.rs +++ b/src/requests/requester.rs @@ -750,6 +750,13 @@ pub trait Requester { where N: Into; + type GetCustomEmojiStickers: Request; + + /// For Telegram documentation see [`GetCustomEmojiStickers`]. + fn get_custom_emoji_stickers(&self, custom_emoji_ids: C) -> Self::GetCustomEmojiStickers + where + C: IntoIterator; + type UploadStickerFile: Request; /// For Telegram documentation see [`UploadStickerFile`]. @@ -1019,6 +1026,7 @@ macro_rules! forward_all { delete_message, send_sticker, get_sticker_set, + get_custom_emoji_stickers, upload_sticker_file, create_new_sticker_set, add_sticker_to_set,