ferrisgram/methods/
close_general_forum_topic.rs

1// WARNING: THIS CODE IS AUTOGENERATED.
2// DO NOT EDIT!!!
3
4#![allow(clippy::too_many_arguments)]
5use serde::Serialize;
6
7use crate::error::Result;
8use crate::Bot;
9
10impl Bot {
11    /// Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
12    /// <https://core.telegram.org/bots/api#closegeneralforumtopic>
13    pub fn close_general_forum_topic(&self, chat_id: i64) -> CloseGeneralForumTopicBuilder {
14        CloseGeneralForumTopicBuilder::new(self, chat_id)
15    }
16}
17
18#[derive(Serialize)]
19pub struct CloseGeneralForumTopicBuilder<'a> {
20    #[serde(skip)]
21    bot: &'a Bot,
22    /// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
23    pub chat_id: i64,
24}
25
26impl<'a> CloseGeneralForumTopicBuilder<'a> {
27    pub fn new(bot: &'a Bot, chat_id: i64) -> Self {
28        Self { bot, chat_id }
29    }
30
31    pub fn chat_id(mut self, chat_id: i64) -> Self {
32        self.chat_id = chat_id;
33        self
34    }
35
36    pub async fn send(self) -> Result<bool> {
37        let form = serde_json::to_value(&self)?;
38        self.bot.get("closeGeneralForumTopic", Some(&form)).await
39    }
40}