Skip to main content

telexide_fork/model/
stickers.rs

1use super::PhotoSize;
2use serde::{Deserialize, Serialize};
3
4/// This object represents a sticker.
5#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
6pub struct Sticker {
7    /// Identifier for this file, which can be used to download or reuse the
8    /// file
9    pub file_id: String,
10    /// Unique identifier for this file, which is supposed to be the same over
11    /// time and for different bots. Can't be used to download or reuse the
12    /// file.
13    pub file_unique_id: String,
14    /// Sticker width
15    pub width: usize,
16    /// Sticker height
17    pub height: usize,
18    /// True, if the sticker is [animated](https://telegram.org/blog/animated-stickers)
19    #[serde(default)]
20    pub is_animated: bool,
21    /// Sticker thumbnail in the .WEBP or .JPG format
22    pub thumb: Option<PhotoSize>,
23    /// Emoji associated with the sticker
24    pub emoji: Option<String>,
25    /// Name of the sticker set to which the sticker belongs
26    pub set_name: Option<String>,
27    /// For mask stickers, the position where the mask should be placed
28    pub mask_position: Option<MaskPosition>,
29    /// File size
30    pub file_size: Option<usize>,
31}
32
33/// This object represents a sticker set.
34#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
35pub struct StickerSet {
36    /// Sticker set name
37    pub name: String,
38    /// Sticker set title
39    pub title: String,
40    /// True, if the sticker set contains [animated stickers](https://telegram.org/blog/animated-stickers)
41    pub is_animated: bool,
42    /// True, if the sticker set contains masks
43    pub contains_masks: bool,
44    /// List of all set stickers
45    pub stickers: Vec<Sticker>,
46    /// Optional. Sticker set thumbnail in the .WEBP or .TGS format
47    pub thumb: Option<PhotoSize>,
48}
49
50/// This object describes the position on faces where a mask should be placed by
51/// default.
52#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
53pub struct MaskPosition {
54    /// The part of the face relative to which the mask should be placed
55    pub point: MaskPoint,
56    /// Shift by X-axis measured in widths of the mask scaled to the face size,
57    /// from left to right. For example, choosing -1.0 will place mask just
58    /// to the left of the default mask position.
59    pub x_shift: f64,
60    /// Shift by Y-axis measured in heights of the mask scaled to the face size,
61    /// from top to bottom. For example, 1.0 will place the mask just below
62    /// the default mask position.
63    pub y_shift: f64,
64    /// Mask scaling coefficient. For example, 2.0 means double size.
65    pub scale: f64,
66}
67
68/// The part of the face relative to which a mask should be placed
69#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
70pub enum MaskPoint {
71    #[serde(rename = "forehead")]
72    Forehead,
73    #[serde(rename = "eyes")]
74    Eyes,
75    #[serde(rename = "mouth")]
76    Mouth,
77    #[serde(rename = "chin")]
78    Chin,
79}