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
use crate::client::Bot;
use serde::Serialize;
/// Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns `true` on success.
/// # Documentation
/// <https://core.telegram.org/bots/api#setstickeremojilist>
/// # Returns
/// - `bool`
#[derive(Clone, Debug, Serialize)]
pub struct SetStickerEmojiList {
/// File identifier of the sticker
pub sticker: Box<str>,
/// A JSON-serialized list of 1-20 emoji associated with the sticker
pub emoji_list: Box<[Box<str>]>,
}
impl SetStickerEmojiList {
/// Creates a new `SetStickerEmojiList`.
///
/// # Arguments
/// * `sticker` - File identifier of the sticker
/// * `emoji_list` - A JSON-serialized list of 1-20 emoji associated with the sticker
#[must_use]
pub fn new<T0: Into<Box<str>>, T1Item: Into<Box<str>>, T1: IntoIterator<Item = T1Item>>(
sticker: T0,
emoji_list: T1,
) -> Self {
Self {
sticker: sticker.into(),
emoji_list: emoji_list.into_iter().map(Into::into).collect(),
}
}
/// File identifier of the sticker
#[must_use]
pub fn sticker<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.sticker = val.into();
this
}
/// A JSON-serialized list of 1-20 emoji associated with the sticker
///
/// # Notes
/// Adds multiple elements.
#[must_use]
pub fn emoji_lists<TItem: Into<Box<str>>, T: IntoIterator<Item = TItem>>(self, val: T) -> Self {
let mut this = self;
this.emoji_list = this
.emoji_list
.into_vec()
.into_iter()
.chain(val.into_iter().map(Into::into))
.collect();
this
}
/// A JSON-serialized 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
}
}
impl super::TelegramMethod for SetStickerEmojiList {
type Method = Self;
type Return = bool;
fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
super::Request::new("setStickerEmojiList", self, None)
}
}