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
// 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 edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
/// <https://core.telegram.org/bots/api#editforumtopic>
pub fn edit_forum_topic(&self, chat_id: i64, message_thread_id: i64) -> EditForumTopicBuilder {
EditForumTopicBuilder::new(self, chat_id, message_thread_id)
}
}
#[derive(Serialize)]
pub struct EditForumTopicBuilder<'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,
/// Unique identifier for the target message thread of the forum topic
pub message_thread_id: i64,
/// New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept
#[serde(skip_serializing_if = "Option::is_none")]
pub icon_custom_emoji_id: Option<String>,
}
impl<'a> EditForumTopicBuilder<'a> {
pub fn new(bot: &'a Bot, chat_id: i64, message_thread_id: i64) -> Self {
Self {
bot,
chat_id,
message_thread_id,
name: None,
icon_custom_emoji_id: None,
}
}
pub fn chat_id(mut self, chat_id: i64) -> Self {
self.chat_id = chat_id;
self
}
pub fn message_thread_id(mut self, message_thread_id: i64) -> Self {
self.message_thread_id = message_thread_id;
self
}
pub fn name(mut self, name: String) -> Self {
self.name = Some(name);
self
}
pub fn icon_custom_emoji_id(mut self, icon_custom_emoji_id: String) -> Self {
self.icon_custom_emoji_id = Some(icon_custom_emoji_id);
self
}
pub async fn send(self) -> Result<bool> {
let form = serde_json::to_value(&self)?;
self.bot.get("editForumTopic", Some(&form)).await
}
}