mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Add format
parameter to SetStickerSetThumbnail
This commit is contained in:
parent
2655607320
commit
cf1b73b8b2
5 changed files with 20 additions and 7 deletions
|
@ -3915,6 +3915,11 @@ Schema(
|
|||
md_links: {"More info on Sending Files »": "https://core.telegram.org/bots/api#sending-files"},
|
||||
),
|
||||
),
|
||||
Param(
|
||||
name: "format",
|
||||
ty: RawTy("StickerFormat"),
|
||||
descr: Doc(md: "Format of the thumbnail, must be one of \"static\" for a .WEBP or .PNG image, \"animated\" for a .TGS animation, or \"video\" for a WEBM video")
|
||||
)
|
||||
],
|
||||
),
|
||||
Method(
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
requests::{JsonRequest, MultipartRequest},
|
||||
types::{
|
||||
BotCommand, ChatId, ChatPermissions, InlineQueryResult, InputFile, InputMedia,
|
||||
InputSticker, LabeledPrice, MessageId, Recipient, ThreadId, UserId,
|
||||
InputSticker, LabeledPrice, MessageId, Recipient, StickerFormat, ThreadId, UserId,
|
||||
},
|
||||
Bot,
|
||||
};
|
||||
|
@ -1173,7 +1173,7 @@ impl Requester for Bot {
|
|||
&self,
|
||||
user_id: UserId,
|
||||
sticker: InputFile,
|
||||
sticker_format: crate::types::StickerFormat,
|
||||
sticker_format: StickerFormat,
|
||||
) -> Self::UploadStickerFile {
|
||||
Self::UploadStickerFile::new(
|
||||
self.clone(),
|
||||
|
@ -1269,13 +1269,18 @@ impl Requester for Bot {
|
|||
|
||||
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,
|
||||
format: StickerFormat,
|
||||
) -> Self::SetStickerSetThumbnail
|
||||
where
|
||||
N: Into<String>,
|
||||
{
|
||||
Self::SetStickerSetThumbnail::new(
|
||||
self.clone(),
|
||||
payloads::SetStickerSetThumbnail::new(name, user_id),
|
||||
payloads::SetStickerSetThumbnail::new(name, user_id, format),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1351,9 +1351,9 @@ macro_rules! requester_forward {
|
|||
(@method set_sticker_set_thumbnail $body:ident $ty:ident) => {
|
||||
type SetStickerSetThumbnail = $ty![SetStickerSetThumbnail];
|
||||
|
||||
fn set_sticker_set_thumbnail<N>(&self, name: N, user_id: UserId) -> Self::SetStickerSetThumbnail where N: Into<String> {
|
||||
fn set_sticker_set_thumbnail<N>(&self, name: N, user_id: UserId, format: StickerFormat) -> Self::SetStickerSetThumbnail where N: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_sticker_set_thumbnail this (name: N, user_id: UserId))
|
||||
$body!(set_sticker_set_thumbnail this (name: N, user_id: UserId, format: StickerFormat))
|
||||
}
|
||||
};
|
||||
(@method set_custom_emoji_sticker_set_thumbnail $body:ident $ty:ident) => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::types::{InputFile, True, UserId};
|
||||
use crate::types::{InputFile, StickerFormat, True, UserId};
|
||||
|
||||
impl_payload! {
|
||||
@[multipart = thumbnail]
|
||||
|
@ -14,6 +14,8 @@ impl_payload! {
|
|||
pub name: String [into],
|
||||
/// User identifier of sticker file owner
|
||||
pub user_id: UserId,
|
||||
/// Format of the thumbnail, must be one of "static" for a .WEBP or .PNG image, "animated" for a .TGS animation, or "video" for a WEBM video
|
||||
pub format: StickerFormat,
|
||||
}
|
||||
optional {
|
||||
/// A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. 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. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
|
||||
|
|
|
@ -1128,6 +1128,7 @@ pub trait Requester {
|
|||
&self,
|
||||
name: N,
|
||||
user_id: UserId,
|
||||
format: StickerFormat,
|
||||
) -> Self::SetStickerSetThumbnail
|
||||
where
|
||||
N: Into<String>;
|
||||
|
|
Loading…
Reference in a new issue