1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
use serde::{Deserialize, Serialize};
/// This object describes a sticker to be added to a sticker set.
/// # Documentation
/// <https://core.telegram.org/bots/api#inputsticker>
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct InputSticker {
/// 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, or pass `attach://<file_attach_name>` to upload a new file 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>
pub sticker: crate::types::InputFile,
/// 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
pub format: Box<str>,
/// List of 1-20 emoji associated with the sticker
pub emoji_list: Box<[Box<str>]>,
/// Position where the mask should be placed on faces. For `mask` stickers only.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_position: Option<crate::types::MaskPosition>,
/// List of 0-20 search keywords for the sticker with total length of up to 64 characters. For `regular` and `custom_emoji` stickers only.
#[serde(skip_serializing_if = "Option::is_none")]
pub keywords: Option<Box<[Box<str>]>>,
}
impl InputSticker {
/// Creates a new `InputSticker`.
///
/// # Arguments
/// * `sticker` - 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, or pass `attach://<file_attach_name>` to upload a new file 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>
/// * `format` - 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
/// * `emoji_list` - List of 1-20 emoji associated with the sticker
///
/// # Notes
/// Use builder methods to set optional fields.
#[must_use]
pub fn new<
T0: Into<crate::types::InputFile>,
T1: Into<Box<str>>,
T2Item: Into<Box<str>>,
T2: IntoIterator<Item = T2Item>,
>(
sticker: T0,
format: T1,
emoji_list: T2,
) -> Self {
Self {
sticker: sticker.into(),
format: format.into(),
emoji_list: emoji_list.into_iter().map(Into::into).collect(),
mask_position: None,
keywords: None,
}
}
/// 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, or pass `attach://<file_attach_name>` to upload a new file 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>
#[must_use]
pub fn sticker<T: Into<crate::types::InputFile>>(self, val: T) -> Self {
let mut this = self;
this.sticker = val.into();
this
}
/// 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
#[must_use]
pub fn format<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.format = val.into();
this
}
/// List of 1-20 emoji associated with the sticker
///
/// # Notes
/// Adds multiple elements.
#[must_use]
pub fn emoji_lists<T: Into<Box<[Box<str>]>>>(self, val: T) -> Self {
let mut this = self;
this.emoji_list = this
.emoji_list
.into_vec()
.into_iter()
.chain(val.into())
.collect();
this
}
/// List of 1-20 emoji associated with the sticker
///
/// # Notes
/// Adds a single element.
#[must_use]
pub fn emoji_list<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.emoji_list = this
.emoji_list
.into_vec()
.into_iter()
.chain(Some(val.into()))
.collect();
this
}
/// Position where the mask should be placed on faces. For `mask` stickers only.
#[must_use]
pub fn mask_position<T: Into<crate::types::MaskPosition>>(self, val: T) -> Self {
let mut this = self;
this.mask_position = Some(val.into());
this
}
/// Position where the mask should be placed on faces. For `mask` stickers only.
#[must_use]
pub fn mask_position_option<T: Into<crate::types::MaskPosition>>(self, val: Option<T>) -> Self {
let mut this = self;
this.mask_position = val.map(Into::into);
this
}
/// List of 0-20 search keywords for the sticker with total length of up to 64 characters. For `regular` and `custom_emoji` stickers only.
///
/// # Notes
/// Adds multiple elements.
#[must_use]
pub fn keywords<T: Into<Box<[Box<str>]>>>(self, val: T) -> Self {
let mut this = self;
this.keywords = Some(
this.keywords
.unwrap_or_default()
.into_vec()
.into_iter()
.chain(val.into())
.collect(),
);
this
}
/// List of 0-20 search keywords for the sticker with total length of up to 64 characters. For `regular` and `custom_emoji` stickers only.
///
/// # Notes
/// Adds a single element.
#[must_use]
pub fn keyword<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.keywords = Some(
this.keywords
.unwrap_or_default()
.into_vec()
.into_iter()
.chain(Some(val.into()))
.collect(),
);
this
}
/// List of 0-20 search keywords for the sticker with total length of up to 64 characters. For `regular` and `custom_emoji` stickers only.
///
/// # Notes
/// Adds a single element.
#[must_use]
pub fn keywords_option<T: Into<Box<[Box<str>]>>>(self, val: Option<T>) -> Self {
let mut this = self;
this.keywords = val.map(Into::into);
this
}
}