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
use std::{
future::{Future, IntoFuture},
pin::Pin,
};
use serde::Serialize;
use crate::{
api::API, entities::misc::chat_id::ChatId, errors::ConogramError, impl_into_future,
request::RequestT,
};
#[derive(Debug, Clone, Serialize)]
pub struct SetChatStickerSetParams {
pub chat_id: ChatId,
pub sticker_set_name: String,
}
impl_into_future!(SetChatStickerSetRequest<'a>);
///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](https://core.telegram.org/bots/api/#getchat) requests to check if the bot can use this method. Returns *True* on success.
#[derive(Clone)]
pub struct SetChatStickerSetRequest<'a> {
api: &'a API,
params: SetChatStickerSetParams,
}
impl<'a> RequestT for SetChatStickerSetRequest<'a> {
type ParamsType = SetChatStickerSetParams;
type ReturnType = bool;
fn get_name() -> &'static str {
"setChatStickerSet"
}
fn get_api_ref(&self) -> &API {
self.api
}
fn get_params_ref(&self) -> &Self::ParamsType {
&self.params
}
fn is_multipart() -> bool {
false
}
}
impl<'a> SetChatStickerSetRequest<'a> {
pub fn new(
api: &'a API,
chat_id: impl Into<ChatId>,
sticker_set_name: impl Into<String>,
) -> Self {
Self {
api,
params: SetChatStickerSetParams {
chat_id: chat_id.into(),
sticker_set_name: sticker_set_name.into(),
},
}
}
///Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`)
#[must_use]
pub fn chat_id(mut self, chat_id: impl Into<ChatId>) -> Self {
self.params.chat_id = chat_id.into();
self
}
///Name of the sticker set to be set as the group sticker set
#[must_use]
pub fn sticker_set_name(mut self, sticker_set_name: impl Into<String>) -> Self {
self.params.sticker_set_name = sticker_set_name.into();
self
}
}
impl API {
///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](https://core.telegram.org/bots/api/#getchat) requests to check if the bot can use this method. Returns *True* on success.
pub fn set_chat_sticker_set(
&self,
chat_id: impl Into<ChatId>,
sticker_set_name: impl Into<String>,
) -> SetChatStickerSetRequest {
SetChatStickerSetRequest::new(self, chat_id, sticker_set_name)
}
}
// Divider: all content below this line will be preserved after code regen