Add the TBA method unpinAllGeneralForumTopicMessages

This commit is contained in:
Сырцев Вадим Игоревич 2024-06-26 11:40:00 +03:00
parent f12e55bd2c
commit 6b97f72d12
12 changed files with 93 additions and 4 deletions

View file

@ -39,7 +39,7 @@
//! [github]: https://github.com/WaffleLapkin/tg-methods-schema //! [github]: https://github.com/WaffleLapkin/tg-methods-schema
Schema( Schema(
api_version: ApiVersion(ver: "6.7", date: "April 21, 2023"), api_version: ApiVersion(ver: "6.8", date: "August 18, 2023"),
methods: [ methods: [
Method( Method(
names: ("getUpdates", "GetUpdates", "get_updates"), names: ("getUpdates", "GetUpdates", "get_updates"),
@ -2801,6 +2801,20 @@ Schema(
), ),
], ],
), ),
Method(
names: ("unpinAllGeneralForumTopicMessages", "UnpinAllGeneralForumTopicMessages", "unpin_all_general_forum_topic_messages"),
return_ty: True,
doc: Doc(md: "Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the _can\\_pin\\_messages_ administrator right in the supergroup. Returns True on success."),
tg_doc: "https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages",
tg_category: "Available methods",
params: [
Param(
name: "chat_id",
ty: RawTy("Recipient"),
descr: Doc(md: "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)")
),
],
),
Method( Method(
names: ("answerCallbackQuery", "AnswerCallbackQuery", "answer_callback_query"), names: ("answerCallbackQuery", "AnswerCallbackQuery", "answer_callback_query"),
return_ty: True, return_ty: True,

View file

@ -156,6 +156,7 @@ where
reopen_general_forum_topic, reopen_general_forum_topic,
hide_general_forum_topic, hide_general_forum_topic,
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,

View file

@ -251,6 +251,7 @@ where
reopen_general_forum_topic, reopen_general_forum_topic,
hide_general_forum_topic, hide_general_forum_topic,
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,
@ -699,6 +700,11 @@ trait ErasableRequester<'a> {
chat_id: Recipient, chat_id: Recipient,
) -> ErasedRequest<'a, UnhideGeneralForumTopic, Self::Err>; ) -> ErasedRequest<'a, UnhideGeneralForumTopic, Self::Err>;
fn unpin_all_general_forum_topic_messages(
&self,
chat_id: Recipient,
) -> ErasedRequest<'a, UnpinAllGeneralForumTopicMessages, Self::Err>;
fn answer_callback_query( fn answer_callback_query(
&self, &self,
callback_query_id: String, callback_query_id: String,
@ -1500,6 +1506,13 @@ where
Requester::unhide_general_forum_topic(self, chat_id).erase() Requester::unhide_general_forum_topic(self, chat_id).erase()
} }
fn unpin_all_general_forum_topic_messages(
&self,
chat_id: Recipient,
) -> ErasedRequest<'a, UnpinAllGeneralForumTopicMessages, Self::Err> {
Requester::unpin_all_general_forum_topic_messages(self, chat_id).erase()
}
fn answer_callback_query( fn answer_callback_query(
&self, &self,
callback_query_id: String, callback_query_id: String,

View file

@ -231,12 +231,13 @@ where
close_forum_topic, close_forum_topic,
reopen_forum_topic, reopen_forum_topic,
delete_forum_topic, delete_forum_topic,
unpin_all_forum_topic_messages,
edit_general_forum_topic, edit_general_forum_topic,
close_general_forum_topic, close_general_forum_topic,
reopen_general_forum_topic, reopen_general_forum_topic,
hide_general_forum_topic, hide_general_forum_topic,
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_forum_topic_messages, unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,

View file

@ -139,6 +139,7 @@ where
reopen_general_forum_topic, reopen_general_forum_topic,
hide_general_forum_topic, hide_general_forum_topic,
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,

View file

@ -185,6 +185,7 @@ where
reopen_general_forum_topic, reopen_general_forum_topic,
hide_general_forum_topic, hide_general_forum_topic,
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,

View file

@ -802,6 +802,22 @@ impl Requester for Bot {
) )
} }
type UnpinAllGeneralForumTopicMessages =
JsonRequest<payloads::UnpinAllGeneralForumTopicMessages>;
fn unpin_all_general_forum_topic_messages<C>(
&self,
chat_id: C,
) -> Self::UnpinAllGeneralForumTopicMessages
where
C: Into<Recipient>,
{
Self::UnpinAllGeneralForumTopicMessages::new(
self.clone(),
payloads::UnpinAllGeneralForumTopicMessages::new(chat_id),
)
}
type AnswerCallbackQuery = JsonRequest<payloads::AnswerCallbackQuery>; type AnswerCallbackQuery = JsonRequest<payloads::AnswerCallbackQuery>;
fn answer_callback_query<C>(&self, callback_query_id: C) -> Self::AnswerCallbackQuery fn answer_callback_query<C>(&self, callback_query_id: C) -> Self::AnswerCallbackQuery

View file

@ -1009,6 +1009,14 @@ macro_rules! requester_forward {
$body!(unhide_general_forum_topic this (chat_id: C)) $body!(unhide_general_forum_topic this (chat_id: C))
} }
}; };
(@method unpin_all_general_forum_topic_messages $body:ident $ty:ident) => {
type UnpinAllGeneralForumTopicMessages = $ty![UnpinAllGeneralForumTopicMessages];
fn unpin_all_general_forum_topic_messages<C>(&self, chat_id: C) -> Self::UnpinAllGeneralForumTopicMessages where C: Into<Recipient> {
let this = self;
$body!(unpin_all_general_forum_topic_messages this (chat_id: C))
}
};
(@method answer_callback_query $body:ident $ty:ident) => { (@method answer_callback_query $body:ident $ty:ident) => {
type AnswerCallbackQuery = $ty![AnswerCallbackQuery]; type AnswerCallbackQuery = $ty![AnswerCallbackQuery];

View file

@ -135,6 +135,7 @@ mod unban_chat_sender_chat;
mod unhide_general_forum_topic; mod unhide_general_forum_topic;
mod unpin_all_chat_messages; mod unpin_all_chat_messages;
mod unpin_all_forum_topic_messages; mod unpin_all_forum_topic_messages;
mod unpin_all_general_forum_topic_messages;
mod unpin_chat_message; mod unpin_chat_message;
mod upload_sticker_file; mod upload_sticker_file;
@ -276,6 +277,9 @@ pub use unpin_all_chat_messages::{UnpinAllChatMessages, UnpinAllChatMessagesSett
pub use unpin_all_forum_topic_messages::{ pub use unpin_all_forum_topic_messages::{
UnpinAllForumTopicMessages, UnpinAllForumTopicMessagesSetters, UnpinAllForumTopicMessages, UnpinAllForumTopicMessagesSetters,
}; };
pub use unpin_all_general_forum_topic_messages::{
UnpinAllGeneralForumTopicMessages, UnpinAllGeneralForumTopicMessagesSetters,
};
pub use unpin_chat_message::{UnpinChatMessage, UnpinChatMessageSetters}; pub use unpin_chat_message::{UnpinChatMessage, UnpinChatMessageSetters};
pub use upload_sticker_file::{UploadStickerFile, UploadStickerFileSetters}; pub use upload_sticker_file::{UploadStickerFile, UploadStickerFileSetters};
// END BLOCK payload_modules // END BLOCK payload_modules

View file

@ -47,6 +47,6 @@ pub use crate::payloads::{
StopMessageLiveLocationInlineSetters as _, StopMessageLiveLocationSetters as _, StopMessageLiveLocationInlineSetters as _, StopMessageLiveLocationSetters as _,
StopPollSetters as _, UnbanChatMemberSetters as _, UnbanChatSenderChatSetters as _, StopPollSetters as _, UnbanChatMemberSetters as _, UnbanChatSenderChatSetters as _,
UnhideGeneralForumTopicSetters as _, UnpinAllChatMessagesSetters as _, UnhideGeneralForumTopicSetters as _, UnpinAllChatMessagesSetters as _,
UnpinAllForumTopicMessagesSetters as _, UnpinChatMessageSetters as _, UnpinAllForumTopicMessagesSetters as _, UnpinAllGeneralForumTopicMessagesSetters as _,
UploadStickerFileSetters as _, UnpinChatMessageSetters as _, UploadStickerFileSetters as _,
}; };

View file

@ -0,0 +1,16 @@
//! Generated by `codegen_payloads`, do not edit by hand.
use serde::Serialize;
use crate::types::{Recipient, True};
impl_payload! {
/// Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the _can\_pin\_messages_ administrator right in the supergroup. Returns True on success.
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub UnpinAllGeneralForumTopicMessages (UnpinAllGeneralForumTopicMessagesSetters) => True {
required {
/// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
pub chat_id: Recipient [into],
}
}
}

View file

@ -758,6 +758,19 @@ pub trait Requester {
where where
C: Into<Recipient>; C: Into<Recipient>;
type UnpinAllGeneralForumTopicMessages: Request<
Payload = UnpinAllGeneralForumTopicMessages,
Err = Self::Err,
>;
/// For Telegram documentation see [`UnpinAllGeneralForumTopicMessages`].
fn unpin_all_general_forum_topic_messages<C>(
&self,
chat_id: C,
) -> Self::UnpinAllGeneralForumTopicMessages
where
C: Into<Recipient>;
type AnswerCallbackQuery: Request<Payload = AnswerCallbackQuery, Err = Self::Err>; type AnswerCallbackQuery: Request<Payload = AnswerCallbackQuery, Err = Self::Err>;
/// For Telegram documentation see [`AnswerCallbackQuery`]. /// For Telegram documentation see [`AnswerCallbackQuery`].
@ -1297,6 +1310,7 @@ macro_rules! forward_all {
reopen_general_forum_topic, reopen_general_forum_topic,
hide_general_forum_topic, hide_general_forum_topic,
unhide_general_forum_topic, unhide_general_forum_topic,
unpin_all_general_forum_topic_messages,
answer_callback_query, answer_callback_query,
set_my_commands, set_my_commands,
get_my_commands, get_my_commands,