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
// WARNING: THIS CODE IS AUTOGENERATED.
// DO NOT EDIT!!!
#![allow(clippy::too_many_arguments)]
use serde::Serialize;
use crate::error::Result;
use crate::Bot;
impl Bot {
/// Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
/// <https://core.telegram.org/bots/api#setchatstickerset>
pub fn set_chat_sticker_set(
&self,
chat_id: i64,
sticker_set_name: String,
) -> SetChatStickerSetBuilder {
SetChatStickerSetBuilder::new(self, chat_id, sticker_set_name)
}
}
#[derive(Serialize)]
pub struct SetChatStickerSetBuilder<'a> {
#[serde(skip)]
bot: &'a Bot,
/// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
pub chat_id: i64,
/// Name of the sticker set to be set as the group sticker set
pub sticker_set_name: String,
}
impl<'a> SetChatStickerSetBuilder<'a> {
pub fn new(bot: &'a Bot, chat_id: i64, sticker_set_name: String) -> Self {
Self {
bot,
chat_id,
sticker_set_name,
}
}
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
pub fn sticker_set_name(mut self, sticker_set_name: String) -> Self {
self.sticker_set_name = sticker_set_name;
self
}
pub async fn send(self) -> Result<bool> {
let form = serde_json::to_value(&self)?;
self.bot.get("setChatStickerSet", Some(&form)).await
}
}