mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
TBA 6.2 methods
This commit is contained in:
parent
a75c645c68
commit
967da8fd9e
14 changed files with 91 additions and 10 deletions
22
schema.ron
22
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",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<String>,
|
||||
) -> 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<String>,
|
||||
) -> ErasedRequest<'a, GetCustomEmojiStickers, Self::Err> {
|
||||
Requester::get_custom_emoji_stickers(self, custom_emoji_ids).erase()
|
||||
}
|
||||
|
||||
fn upload_sticker_file(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
|
|
|
@ -164,6 +164,7 @@ impl<B: Requester> Requester for DefaultParseMode<B> {
|
|||
delete_message,
|
||||
send_sticker,
|
||||
get_sticker_set,
|
||||
get_custom_emoji_stickers,
|
||||
upload_sticker_file,
|
||||
create_new_sticker_set,
|
||||
add_sticker_to_set,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -911,6 +911,18 @@ impl Requester for Bot {
|
|||
Self::GetStickerSet::new(self.clone(), payloads::GetStickerSet::new(name))
|
||||
}
|
||||
|
||||
type GetCustomEmojiStickers = JsonRequest<payloads::GetCustomEmojiStickers>;
|
||||
|
||||
fn get_custom_emoji_stickers<C>(&self, custom_emoji_ids: C) -> Self::GetCustomEmojiStickers
|
||||
where
|
||||
C: IntoIterator<Item = String>,
|
||||
{
|
||||
Self::GetCustomEmojiStickers::new(
|
||||
self.clone(),
|
||||
payloads::GetCustomEmojiStickers::new(custom_emoji_ids),
|
||||
)
|
||||
}
|
||||
|
||||
type UploadStickerFile = MultipartRequest<payloads::UploadStickerFile>;
|
||||
|
||||
fn upload_sticker_file(
|
||||
|
|
|
@ -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<C>(&self, custom_emoji_ids: C) -> Self::GetCustomEmojiStickers where C: IntoIterator<Item = String> {
|
||||
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];
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
16
src/payloads/get_custom_emoji_stickers.rs
Normal file
16
src/payloads/get_custom_emoji_stickers.rs
Normal file
|
@ -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<Sticker> {
|
||||
required {
|
||||
/// List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.
|
||||
pub custom_emoji_ids: Vec<String> [collect],
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 _,
|
||||
|
|
|
@ -750,6 +750,13 @@ pub trait Requester {
|
|||
where
|
||||
N: Into<String>;
|
||||
|
||||
type GetCustomEmojiStickers: Request<Payload = GetCustomEmojiStickers, Err = Self::Err>;
|
||||
|
||||
/// For Telegram documentation see [`GetCustomEmojiStickers`].
|
||||
fn get_custom_emoji_stickers<C>(&self, custom_emoji_ids: C) -> Self::GetCustomEmojiStickers
|
||||
where
|
||||
C: IntoIterator<Item = String>;
|
||||
|
||||
type UploadStickerFile: Request<Payload = UploadStickerFile, Err = Self::Err>;
|
||||
|
||||
/// 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,
|
||||
|
|
Loading…
Reference in a new issue