conogram/entities/
input_sticker.rs

1use serde::Serialize;
2
3use crate::entities::{
4    mask_position::MaskPosition,
5    misc::input_file::{GetFiles, InputFile},
6};
7
8/// This object describes a sticker to be added to a sticker set.
9///
10/// API Reference: [link](https://core.telegram.org/bots/api/#inputsticker)
11#[derive(Debug, Clone, Default, PartialEq, Serialize)]
12pub struct InputSticker {
13    /// The added sticker. 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, upload a new one using multipart/form-data, or pass “attach://\<file\_attach\_name\>” to upload a new one using multipart/form-data under \<file\_attach\_name\> name. Animated and video stickers can't be uploaded via HTTP URL. [More information on Sending Files »](https://core.telegram.org/bots/api/#sending-files)
14    pub sticker: InputFile,
15
16    /// Format of the added sticker, must be one of “static” for a **.WEBP** or **.PNG** image, “animated” for a **.TGS** animation, “video” for a **WEBM** video
17    pub format: InputStickerFormat,
18
19    /// List of 1-20 emoji associated with the sticker
20    pub emoji_list: Vec<String>,
21
22    /// *Optional*. Position where the mask should be placed on faces. For “mask” stickers only.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub mask_position: Option<MaskPosition>,
25
26    /// *Optional*. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom\_emoji” stickers only.
27    #[serde(skip_serializing_if = "Vec::is_empty")]
28    pub keywords: Vec<String>,
29}
30
31/// Format of the added sticker, must be one of “static” for a **.WEBP** or **.PNG** image, “animated” for a **.TGS** animation, “video” for a **WEBM** video
32#[derive(Debug, Clone, Copy, Default, PartialEq, Serialize)]
33pub enum InputStickerFormat {
34    /// `static`
35    #[default]
36    #[serde(rename = "static")]
37    Static,
38
39    /// `animated`
40    #[serde(rename = "animated")]
41    Animated,
42
43    /// `video`
44    #[serde(rename = "video")]
45    Video,
46}
47
48impl GetFiles for InputSticker {
49    fn get_files(&self) -> Vec<&InputFile> {
50        vec![&self.sticker]
51    }
52} // Divider: all content below this line will be preserved after code regen