Add multiple message actions methods of TBA 7.0

This commit is contained in:
Сырцев Вадим Игоревич 2024-07-15 21:47:21 +03:00 committed by Andrey Brusnik
parent e96a6a5ec2
commit 13dd93cc63
No known key found for this signature in database
GPG key ID: D33232F28CFF442C
14 changed files with 406 additions and 13 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.9", date: "September 22, 2023"), api_version: ApiVersion(ver: "7.0", date: "December 29, 2023"),
methods: [ methods: [
Method( Method(
names: ("getUpdates", "GetUpdates", "get_updates"), names: ("getUpdates", "GetUpdates", "get_updates"),
@ -338,6 +338,51 @@ Schema(
), ),
], ],
), ),
Method(
names: ("forwardMessages", "ForwardMessages", "forward_messages"),
return_ty: ArrayOf(RawTy("MessageId")),
doc: Doc(
md: "Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of [MessageId] of the sent messages is returned.",
md_links: {"MessageId": "https://core.telegram.org/bots/api#messageid"},
),
tg_doc: "https://core.telegram.org/bots/api#forwardmessages",
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 channel (in the format `@channelusername`)"),
),
Param(
name: "message_thread_id",
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
name: "from_chat_id",
ty: RawTy("Recipient"),
descr: Doc(md: "Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)"),
),
Param(
name: "message_ids",
ty: ArrayOf(RawTy("MessageId")),
descr: Doc(md: "A JSON-serialized list of 1-100 identifiers of messages in the chat _from\\_chat\\_id_ to forward. The identifiers must be specified in a strictly increasing order.")
),
Param(
name: "disable_notification",
ty: Option(bool),
descr: Doc(
md: "Sends the message [silently]. Users will receive a notification with no sound.",
md_links: {"silently": "https://telegram.org/blog/channels-2-0#silent-messages"}
)
),
Param(
name: "protect_content",
ty: Option(bool),
descr: Doc(md: "Protects the contents of sent messages from forwarding and saving"),
),
],
),
Method( Method(
names: ("copyMessage", "CopyMessage", "copy_message"), names: ("copyMessage", "CopyMessage", "copy_message"),
return_ty: RawTy("MessageId"), return_ty: RawTy("MessageId"),
@ -422,6 +467,60 @@ Schema(
), ),
], ],
), ),
Method(
names: ("copyMessages", "CopyMessages", "copy_messages"),
return_ty: ArrayOf(RawTy("MessageId")),
doc: Doc(
md: "Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz [poll] can be copied only if the value of the field _correct\\_option\\_id_ is known to the bot. The method is analogous to the method [forwardMessages], but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of [MessageId] of the sent messages is returned.",
md_links: {
"poll": "https://core.telegram.org/bots/api#poll",
"forwardMessages": "https://core.telegram.org/bots/api#forwardmessages",
"MessageId": "https://core.telegram.org/bots/api#messageid"
},
),
tg_doc: "https://core.telegram.org/bots/api#copymessages",
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 channel (in the format `@channelusername`)"),
),
Param(
name: "message_thread_id",
ty: Option(RawTy("ThreadId")),
descr: Doc(md: "Unique identifier for the target message thread (topic) of the forum; for forum supergroups only"),
),
Param(
name: "from_chat_id",
ty: RawTy("Recipient"),
descr: Doc(md: "Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)"),
),
Param(
name: "message_ids",
ty: ArrayOf(RawTy("MessageId")),
descr: Doc(md: "Identifiers of 1-100 messages in the chat _from\\_chat\\_id_ to copy. The identifiers must be specified in a strictly increasing order.")
),
Param(
name: "disable_notification",
ty: Option(bool),
descr: Doc(
md: "Sends the message [silently]. Users will receive a notification with no sound.",
md_links: {"silently": "https://telegram.org/blog/channels-2-0#silent-messages"}
)
),
Param(
name: "protect_content",
ty: Option(bool),
descr: Doc(md: "Protects the contents of sent messages from forwarding and saving"),
),
Param(
name: "remove_caption",
ty: Option(bool),
descr: Doc(md: "Pass _True_ to copy the messages without their captions")
)
],
),
Method( Method(
names: ("sendPhoto", "SendPhoto", "send_photo"), names: ("sendPhoto", "SendPhoto", "send_photo"),
return_ty: RawTy("Message"), return_ty: RawTy("Message"),
@ -3529,6 +3628,28 @@ Schema(
), ),
], ],
), ),
Method(
names: ("deleteMessages", "DeleteMessages", "delete_messages"),
return_ty: True,
doc: Doc(md: "Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns _True_ on success."),
tg_doc: "https://core.telegram.org/bots/api#delete_messages",
tg_category: "Updating messages",
params: [
Param(
name: "chat_id",
ty: RawTy("Recipient"),
descr: Doc(md: "Unique identifier for the target chat or username of the target channel (in the format `@channelusername`).")
),
Param(
name: "message_ids",
ty: ArrayOf(RawTy("MessageId")),
descr: Doc(
md: "Identifiers of 1-100 messages to delete. See [deleteMessage] for limitations on which messages can be deleted",
md_links: {"deleteMessage": "https://core.telegram.org/bots/api#delete_message"}
)
),
],
),
Method( Method(
names: ("sendSticker", "SendSticker", "send_sticker"), names: ("sendSticker", "SendSticker", "send_sticker"),
return_ty: RawTy("Message"), return_ty: RawTy("Message"),

View file

@ -94,7 +94,9 @@ where
delete_webhook, delete_webhook,
get_webhook_info, get_webhook_info,
forward_message, forward_message,
forward_messages,
copy_message, copy_message,
copy_messages,
send_message, send_message,
send_photo, send_photo,
send_audio, send_audio,
@ -183,6 +185,7 @@ where
edit_message_reply_markup_inline, edit_message_reply_markup_inline,
stop_poll, stop_poll,
delete_message, delete_message,
delete_messages,
send_sticker, send_sticker,
get_sticker_set, get_sticker_set,
get_custom_emoji_stickers, get_custom_emoji_stickers,

View file

@ -170,6 +170,9 @@ macro_rules! fwd_erased {
(@convert $m:ident, $arg:ident, emoji_list: $T:ty) => { (@convert $m:ident, $arg:ident, emoji_list: $T:ty) => {
$arg.into_iter().collect() $arg.into_iter().collect()
}; };
(@convert $m:ident, $arg:ident, message_ids: $T:ty) => {
$arg.into_iter().collect()
};
(@convert $m:ident, $arg:ident, $arg_:ident : $T:ty) => { (@convert $m:ident, $arg:ident, $arg_:ident : $T:ty) => {
$arg.into() $arg.into()
}; };
@ -190,7 +193,9 @@ where
delete_webhook, delete_webhook,
get_webhook_info, get_webhook_info,
forward_message, forward_message,
forward_messages,
copy_message, copy_message,
copy_messages,
send_message, send_message,
send_photo, send_photo,
send_audio, send_audio,
@ -279,6 +284,7 @@ where
edit_message_reply_markup_inline, edit_message_reply_markup_inline,
stop_poll, stop_poll,
delete_message, delete_message,
delete_messages,
send_sticker, send_sticker,
get_sticker_set, get_sticker_set,
get_custom_emoji_stickers, get_custom_emoji_stickers,
@ -341,6 +347,13 @@ trait ErasableRequester<'a> {
message_id: MessageId, message_id: MessageId,
) -> ErasedRequest<'a, ForwardMessage, Self::Err>; ) -> ErasedRequest<'a, ForwardMessage, Self::Err>;
fn forward_messages(
&self,
chat_id: Recipient,
from_chat_id: Recipient,
message_ids: Vec<MessageId>,
) -> ErasedRequest<'a, ForwardMessages, Self::Err>;
fn copy_message( fn copy_message(
&self, &self,
chat_id: Recipient, chat_id: Recipient,
@ -348,6 +361,13 @@ trait ErasableRequester<'a> {
message_id: MessageId, message_id: MessageId,
) -> ErasedRequest<'a, CopyMessage, Self::Err>; ) -> ErasedRequest<'a, CopyMessage, Self::Err>;
fn copy_messages(
&self,
chat_id: Recipient,
from_chat_id: Recipient,
message_ids: Vec<MessageId>,
) -> ErasedRequest<'a, CopyMessages, Self::Err>;
fn send_photo( fn send_photo(
&self, &self,
chat_id: Recipient, chat_id: Recipient,
@ -816,6 +836,12 @@ trait ErasableRequester<'a> {
message_id: MessageId, message_id: MessageId,
) -> ErasedRequest<'a, DeleteMessage, Self::Err>; ) -> ErasedRequest<'a, DeleteMessage, Self::Err>;
fn delete_messages(
&self,
chat_id: Recipient,
message_ids: Vec<MessageId>,
) -> ErasedRequest<'a, DeleteMessages, Self::Err>;
fn send_sticker( fn send_sticker(
&self, &self,
chat_id: Recipient, chat_id: Recipient,
@ -1019,6 +1045,15 @@ where
Requester::forward_message(self, chat_id, from_chat_id, message_id).erase() Requester::forward_message(self, chat_id, from_chat_id, message_id).erase()
} }
fn forward_messages(
&self,
chat_id: Recipient,
from_chat_id: Recipient,
message_ids: Vec<MessageId>,
) -> ErasedRequest<'a, ForwardMessages, Self::Err> {
Requester::forward_messages(self, chat_id, from_chat_id, message_ids).erase()
}
fn copy_message( fn copy_message(
&self, &self,
chat_id: Recipient, chat_id: Recipient,
@ -1028,6 +1063,15 @@ where
Requester::copy_message(self, chat_id, from_chat_id, message_id).erase() Requester::copy_message(self, chat_id, from_chat_id, message_id).erase()
} }
fn copy_messages(
&self,
chat_id: Recipient,
from_chat_id: Recipient,
message_ids: Vec<MessageId>,
) -> ErasedRequest<'a, CopyMessages, Self::Err> {
Requester::copy_messages(self, chat_id, from_chat_id, message_ids).erase()
}
fn send_photo( fn send_photo(
&self, &self,
chat_id: Recipient, chat_id: Recipient,
@ -1676,6 +1720,14 @@ where
Requester::delete_message(self, chat_id, message_id).erase() Requester::delete_message(self, chat_id, message_id).erase()
} }
fn delete_messages(
&self,
chat_id: Recipient,
message_ids: Vec<MessageId>,
) -> ErasedRequest<'a, DeleteMessages, Self::Err> {
Requester::delete_messages(self, chat_id, message_ids).erase()
}
fn send_sticker( fn send_sticker(
&self, &self,
chat_id: Recipient, chat_id: Recipient,

View file

@ -185,6 +185,8 @@ where
delete_webhook, delete_webhook,
get_webhook_info, get_webhook_info,
forward_message, forward_message,
forward_messages,
copy_messages,
send_video_note, send_video_note,
send_location, send_location,
edit_message_live_location, edit_message_live_location,
@ -256,6 +258,7 @@ where
edit_message_reply_markup_inline, edit_message_reply_markup_inline,
stop_poll, stop_poll,
delete_message, delete_message,
delete_messages,
send_sticker, send_sticker,
get_sticker_set, get_sticker_set,
get_custom_emoji_stickers, get_custom_emoji_stickers,

View file

@ -92,6 +92,8 @@ where
set_webhook, set_webhook,
delete_webhook, delete_webhook,
get_webhook_info, get_webhook_info,
forward_messages,
copy_messages,
edit_message_live_location, edit_message_live_location,
edit_message_live_location_inline, edit_message_live_location_inline,
stop_message_live_location, stop_message_live_location,
@ -166,6 +168,7 @@ where
edit_message_reply_markup_inline, edit_message_reply_markup_inline,
stop_poll, stop_poll,
delete_message, delete_message,
delete_messages,
get_sticker_set, get_sticker_set,
get_custom_emoji_stickers, get_custom_emoji_stickers,
upload_sticker_file, upload_sticker_file,

View file

@ -123,7 +123,9 @@ where
delete_webhook, delete_webhook,
get_webhook_info, get_webhook_info,
forward_message, forward_message,
forward_messages,
copy_message, copy_message,
copy_messages,
send_message, send_message,
send_photo, send_photo,
send_audio, send_audio,
@ -212,6 +214,7 @@ where
edit_message_reply_markup_inline, edit_message_reply_markup_inline,
stop_poll, stop_poll,
delete_message, delete_message,
delete_messages,
send_sticker, send_sticker,
get_sticker_set, get_sticker_set,
get_custom_emoji_stickers, get_custom_emoji_stickers,

View file

@ -72,6 +72,24 @@ impl Requester for Bot {
) )
} }
type ForwardMessages = JsonRequest<payloads::ForwardMessages>;
fn forward_messages<C, F, M>(
&self,
chat_id: C,
from_chat_id: F,
message_ids: M,
) -> Self::ForwardMessages
where
C: Into<Recipient>,
F: Into<Recipient>,
M: IntoIterator<Item = MessageId>,
{
Self::ForwardMessages::new(
self.clone(),
payloads::ForwardMessages::new(chat_id, from_chat_id, message_ids),
)
}
type SendPhoto = MultipartRequest<payloads::SendPhoto>; type SendPhoto = MultipartRequest<payloads::SendPhoto>;
fn send_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SendPhoto fn send_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SendPhoto
@ -1086,6 +1104,15 @@ impl Requester for Bot {
Self::DeleteMessage::new(self.clone(), payloads::DeleteMessage::new(chat_id, message_id)) Self::DeleteMessage::new(self.clone(), payloads::DeleteMessage::new(chat_id, message_id))
} }
type DeleteMessages = JsonRequest<payloads::DeleteMessages>;
fn delete_messages<C, M>(&self, chat_id: C, message_ids: M) -> Self::DeleteMessages
where
C: Into<Recipient>,
M: IntoIterator<Item = MessageId>,
{
Self::DeleteMessages::new(self.clone(), payloads::DeleteMessages::new(chat_id, message_ids))
}
type SendSticker = MultipartRequest<payloads::SendSticker>; type SendSticker = MultipartRequest<payloads::SendSticker>;
fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker
@ -1465,6 +1492,24 @@ impl Requester for Bot {
) )
} }
type CopyMessages = JsonRequest<payloads::CopyMessages>;
fn copy_messages<C, F, M>(
&self,
chat_id: C,
from_chat_id: F,
message_ids: M,
) -> Self::CopyMessages
where
C: Into<Recipient>,
F: Into<Recipient>,
M: IntoIterator<Item = MessageId>,
{
Self::CopyMessages::new(
self.clone(),
payloads::CopyMessages::new(chat_id, from_chat_id, message_ids),
)
}
type UnpinAllChatMessages = JsonRequest<payloads::UnpinAllChatMessages>; type UnpinAllChatMessages = JsonRequest<payloads::UnpinAllChatMessages>;
fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessages fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessages

View file

@ -487,6 +487,16 @@ macro_rules! requester_forward {
$body!(forward_message this (chat_id: C, from_chat_id: F, message_id: MessageId)) $body!(forward_message this (chat_id: C, from_chat_id: F, message_id: MessageId))
} }
}; };
(@method forward_messages $body:ident $ty:ident) => {
type ForwardMessages = $ty![ForwardMessages];
fn forward_messages<C, F, M>(&self, chat_id: C, from_chat_id: F, message_ids: M) -> Self::ForwardMessages where C: Into<Recipient>,
F: Into<Recipient>,
M: IntoIterator<Item = MessageId> {
let this = self;
$body!(forward_messages this (chat_id: C, from_chat_id: F, message_ids: M))
}
};
(@method copy_message $body:ident $ty:ident) => { (@method copy_message $body:ident $ty:ident) => {
type CopyMessage = $ty![CopyMessage]; type CopyMessage = $ty![CopyMessage];
@ -496,6 +506,16 @@ macro_rules! requester_forward {
$body!(copy_message this (chat_id: C, from_chat_id: F, message_id: MessageId)) $body!(copy_message this (chat_id: C, from_chat_id: F, message_id: MessageId))
} }
}; };
(@method copy_messages $body:ident $ty:ident) => {
type CopyMessages = $ty![CopyMessages];
fn copy_messages<C, F, M>(&self, chat_id: C, from_chat_id: F, message_ids: M) -> Self::CopyMessages where C: Into<Recipient>,
F: Into<Recipient>,
M: IntoIterator<Item = MessageId> {
let this = self;
$body!(copy_messages this (chat_id: C, from_chat_id: F, message_ids: M))
}
};
(@method send_photo $body:ident $ty:ident) => { (@method send_photo $body:ident $ty:ident) => {
type SendPhoto = $ty![SendPhoto]; type SendPhoto = $ty![SendPhoto];
@ -1228,6 +1248,15 @@ macro_rules! requester_forward {
$body!(delete_message this (chat_id: C, message_id: MessageId)) $body!(delete_message this (chat_id: C, message_id: MessageId))
} }
}; };
(@method delete_messages $body:ident $ty:ident) => {
type DeleteMessages = $ty![DeleteMessages];
fn delete_messages<C, M>(&self, chat_id: C, message_ids: M) -> Self::DeleteMessages where C: Into<Recipient>,
M: IntoIterator<Item = MessageId> {
let this = self;
$body!(delete_messages this (chat_id: C, message_ids: M))
}
};
(@method send_sticker $body:ident $ty:ident) => { (@method send_sticker $body:ident $ty:ident) => {
type SendSticker = $ty![SendSticker]; type SendSticker = $ty![SendSticker];

View file

@ -28,6 +28,7 @@ mod close;
mod close_forum_topic; mod close_forum_topic;
mod close_general_forum_topic; mod close_general_forum_topic;
mod copy_message; mod copy_message;
mod copy_messages;
mod create_chat_invite_link; mod create_chat_invite_link;
mod create_forum_topic; mod create_forum_topic;
mod create_invoice_link; mod create_invoice_link;
@ -37,6 +38,7 @@ mod delete_chat_photo;
mod delete_chat_sticker_set; mod delete_chat_sticker_set;
mod delete_forum_topic; mod delete_forum_topic;
mod delete_message; mod delete_message;
mod delete_messages;
mod delete_my_commands; mod delete_my_commands;
mod delete_sticker_from_set; mod delete_sticker_from_set;
mod delete_sticker_set; mod delete_sticker_set;
@ -56,6 +58,7 @@ mod edit_message_text;
mod edit_message_text_inline; mod edit_message_text_inline;
mod export_chat_invite_link; mod export_chat_invite_link;
mod forward_message; mod forward_message;
mod forward_messages;
mod get_chat; mod get_chat;
mod get_chat_administrators; mod get_chat_administrators;
mod get_chat_member; mod get_chat_member;
@ -152,6 +155,7 @@ pub use close::{Close, CloseSetters};
pub use close_forum_topic::{CloseForumTopic, CloseForumTopicSetters}; pub use close_forum_topic::{CloseForumTopic, CloseForumTopicSetters};
pub use close_general_forum_topic::{CloseGeneralForumTopic, CloseGeneralForumTopicSetters}; pub use close_general_forum_topic::{CloseGeneralForumTopic, CloseGeneralForumTopicSetters};
pub use copy_message::{CopyMessage, CopyMessageSetters}; pub use copy_message::{CopyMessage, CopyMessageSetters};
pub use copy_messages::{CopyMessages, CopyMessagesSetters};
pub use create_chat_invite_link::{CreateChatInviteLink, CreateChatInviteLinkSetters}; pub use create_chat_invite_link::{CreateChatInviteLink, CreateChatInviteLinkSetters};
pub use create_forum_topic::{CreateForumTopic, CreateForumTopicSetters}; pub use create_forum_topic::{CreateForumTopic, CreateForumTopicSetters};
pub use create_invoice_link::{CreateInvoiceLink, CreateInvoiceLinkSetters}; pub use create_invoice_link::{CreateInvoiceLink, CreateInvoiceLinkSetters};
@ -161,6 +165,7 @@ pub use delete_chat_photo::{DeleteChatPhoto, DeleteChatPhotoSetters};
pub use delete_chat_sticker_set::{DeleteChatStickerSet, DeleteChatStickerSetSetters}; pub use delete_chat_sticker_set::{DeleteChatStickerSet, DeleteChatStickerSetSetters};
pub use delete_forum_topic::{DeleteForumTopic, DeleteForumTopicSetters}; pub use delete_forum_topic::{DeleteForumTopic, DeleteForumTopicSetters};
pub use delete_message::{DeleteMessage, DeleteMessageSetters}; pub use delete_message::{DeleteMessage, DeleteMessageSetters};
pub use delete_messages::{DeleteMessages, DeleteMessagesSetters};
pub use delete_my_commands::{DeleteMyCommands, DeleteMyCommandsSetters}; pub use delete_my_commands::{DeleteMyCommands, DeleteMyCommandsSetters};
pub use delete_sticker_from_set::{DeleteStickerFromSet, DeleteStickerFromSetSetters}; pub use delete_sticker_from_set::{DeleteStickerFromSet, DeleteStickerFromSetSetters};
pub use delete_sticker_set::{DeleteStickerSet, DeleteStickerSetSetters}; pub use delete_sticker_set::{DeleteStickerSet, DeleteStickerSetSetters};
@ -184,6 +189,7 @@ pub use edit_message_text::{EditMessageText, EditMessageTextSetters};
pub use edit_message_text_inline::{EditMessageTextInline, EditMessageTextInlineSetters}; pub use edit_message_text_inline::{EditMessageTextInline, EditMessageTextInlineSetters};
pub use export_chat_invite_link::{ExportChatInviteLink, ExportChatInviteLinkSetters}; pub use export_chat_invite_link::{ExportChatInviteLink, ExportChatInviteLinkSetters};
pub use forward_message::{ForwardMessage, ForwardMessageSetters}; pub use forward_message::{ForwardMessage, ForwardMessageSetters};
pub use forward_messages::{ForwardMessages, ForwardMessagesSetters};
pub use get_chat::{GetChat, GetChatSetters}; pub use get_chat::{GetChat, GetChatSetters};
pub use get_chat_administrators::{GetChatAdministrators, GetChatAdministratorsSetters}; pub use get_chat_administrators::{GetChatAdministrators, GetChatAdministratorsSetters};
pub use get_chat_member::{GetChatMember, GetChatMemberSetters}; pub use get_chat_member::{GetChatMember, GetChatMemberSetters};

View file

@ -0,0 +1,36 @@
//! Generated by `codegen_payloads`, do not edit by hand.
use serde::Serialize;
use crate::types::{MessageId, Recipient, ThreadId};
impl_payload! {
/// Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz [`Poll`] can be copied only if the value of the field _correct\_option\_id_ is known to the bot. The method is analogous to the method [`ForwardMessages`], but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array of [`MessageId`] of the sent messages is returned.
///
/// [`MessageId`]: crate::types::MessageId
/// [`Poll`]: crate::payloads::Poll
/// [`ForwardMessages`]: crate::payloads::ForwardMessages
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub CopyMessages (CopyMessagesSetters) => Vec<MessageId> {
required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Recipient [into],
/// Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)
pub from_chat_id: Recipient [into],
/// Identifiers of 1-100 messages in the chat _from\_chat\_id_ to copy. The identifiers must be specified in a strictly increasing order.
pub message_ids: Vec<MessageId> [collect],
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId,
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// Protects the contents of sent messages from forwarding and saving
pub protect_content: bool,
/// Pass _True_ to copy the messages without their captions
pub remove_caption: bool,
}
}
}

View file

@ -0,0 +1,20 @@
//! Generated by `codegen_payloads`, do not edit by hand.
use serde::Serialize;
use crate::types::{MessageId, Recipient, True};
impl_payload! {
/// Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns _True_ on success.
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub DeleteMessages (DeleteMessagesSetters) => True {
required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`).
pub chat_id: Recipient [into],
/// Identifiers of 1-100 messages to delete. See [`DeleteMessage`] for limitations on which messages can be deleted
///
/// [`DeleteMessage`]: crate::payloads::DeleteMessage
pub message_ids: Vec<MessageId> [collect],
}
}
}

View file

@ -0,0 +1,32 @@
//! Generated by `codegen_payloads`, do not edit by hand.
use serde::Serialize;
use crate::types::{MessageId, Recipient, ThreadId};
impl_payload! {
/// Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages. On success, an array of [`MessageId`] of the sent messages is returned.
///
/// [`MessageId`]: crate::types::MessageId
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub ForwardMessages (ForwardMessagesSetters) => Vec<MessageId> {
required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: Recipient [into],
/// Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)
pub from_chat_id: Recipient [into],
/// A JSON-serialized list of 1-100 identifiers of messages in the chat _from\_chat\_id_ to forward. The identifiers must be specified in a strictly increasing order.
pub message_ids: Vec<MessageId> [collect],
}
optional {
/// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
pub message_thread_id: ThreadId,
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// Protects the contents of sent messages from forwarding and saving
pub protect_content: bool,
}
}
}

View file

@ -6,18 +6,19 @@ pub use crate::payloads::{
AnswerPreCheckoutQuerySetters as _, AnswerShippingQuerySetters as _, AnswerPreCheckoutQuerySetters as _, AnswerShippingQuerySetters as _,
AnswerWebAppQuerySetters as _, ApproveChatJoinRequestSetters as _, BanChatMemberSetters as _, AnswerWebAppQuerySetters as _, ApproveChatJoinRequestSetters as _, BanChatMemberSetters as _,
BanChatSenderChatSetters as _, CloseForumTopicSetters as _, CloseGeneralForumTopicSetters as _, BanChatSenderChatSetters as _, CloseForumTopicSetters as _, CloseGeneralForumTopicSetters as _,
CloseSetters as _, CopyMessageSetters as _, CreateChatInviteLinkSetters as _, CloseSetters as _, CopyMessageSetters as _, CopyMessagesSetters as _,
CreateForumTopicSetters as _, CreateInvoiceLinkSetters as _, CreateNewStickerSetSetters as _, CreateChatInviteLinkSetters as _, CreateForumTopicSetters as _, CreateInvoiceLinkSetters as _,
DeclineChatJoinRequestSetters as _, DeleteChatPhotoSetters as _, CreateNewStickerSetSetters as _, DeclineChatJoinRequestSetters as _,
DeleteChatStickerSetSetters as _, DeleteForumTopicSetters as _, DeleteMessageSetters as _, DeleteChatPhotoSetters as _, DeleteChatStickerSetSetters as _, DeleteForumTopicSetters as _,
DeleteMyCommandsSetters as _, DeleteStickerFromSetSetters as _, DeleteStickerSetSetters as _, DeleteMessageSetters as _, DeleteMessagesSetters as _, DeleteMyCommandsSetters as _,
DeleteWebhookSetters as _, EditChatInviteLinkSetters as _, EditForumTopicSetters as _, DeleteStickerFromSetSetters as _, DeleteStickerSetSetters as _, DeleteWebhookSetters as _,
EditGeneralForumTopicSetters as _, EditMessageCaptionInlineSetters as _, EditChatInviteLinkSetters as _, EditForumTopicSetters as _, EditGeneralForumTopicSetters as _,
EditMessageCaptionSetters as _, EditMessageLiveLocationInlineSetters as _, EditMessageCaptionInlineSetters as _, EditMessageCaptionSetters as _,
EditMessageLiveLocationSetters as _, EditMessageMediaInlineSetters as _, EditMessageLiveLocationInlineSetters as _, EditMessageLiveLocationSetters as _,
EditMessageMediaSetters as _, EditMessageReplyMarkupInlineSetters as _, EditMessageMediaInlineSetters as _, EditMessageMediaSetters as _,
EditMessageReplyMarkupSetters as _, EditMessageTextInlineSetters as _, EditMessageReplyMarkupInlineSetters as _, EditMessageReplyMarkupSetters as _,
EditMessageTextSetters as _, ExportChatInviteLinkSetters as _, ForwardMessageSetters as _, EditMessageTextInlineSetters as _, EditMessageTextSetters as _,
ExportChatInviteLinkSetters as _, ForwardMessageSetters as _, ForwardMessagesSetters as _,
GetChatAdministratorsSetters as _, GetChatMemberCountSetters as _, GetChatMemberSetters as _, GetChatAdministratorsSetters as _, GetChatMemberCountSetters as _, GetChatMemberSetters as _,
GetChatMembersCountSetters as _, GetChatMenuButtonSetters as _, GetChatSetters as _, GetChatMembersCountSetters as _, GetChatMenuButtonSetters as _, GetChatSetters as _,
GetCustomEmojiStickersSetters as _, GetFileSetters as _, GetForumTopicIconStickersSetters as _, GetCustomEmojiStickersSetters as _, GetFileSetters as _, GetForumTopicIconStickersSetters as _,

View file

@ -203,6 +203,20 @@ pub trait Requester {
C: Into<Recipient>, C: Into<Recipient>,
F: Into<Recipient>; F: Into<Recipient>;
type ForwardMessages: Request<Payload = ForwardMessages, Err = Self::Err>;
/// For Telegram documentation see [`ForwardMessages`].
fn forward_messages<C, F, M>(
&self,
chat_id: C,
from_chat_id: F,
message_ids: M,
) -> Self::ForwardMessages
where
C: Into<Recipient>,
F: Into<Recipient>,
M: IntoIterator<Item = MessageId>;
type CopyMessage: Request<Payload = CopyMessage, Err = Self::Err>; type CopyMessage: Request<Payload = CopyMessage, Err = Self::Err>;
/// For Telegram documentation see [`CopyMessage`]. /// For Telegram documentation see [`CopyMessage`].
@ -216,6 +230,20 @@ pub trait Requester {
C: Into<Recipient>, C: Into<Recipient>,
F: Into<Recipient>; F: Into<Recipient>;
type CopyMessages: Request<Payload = CopyMessages, Err = Self::Err>;
/// For Telegram documentation see [`CopyMessages`].
fn copy_messages<C, F, M>(
&self,
chat_id: C,
from_chat_id: F,
message_ids: M,
) -> Self::CopyMessages
where
C: Into<Recipient>,
F: Into<Recipient>,
M: IntoIterator<Item = MessageId>;
type SendPhoto: Request<Payload = SendPhoto, Err = Self::Err>; type SendPhoto: Request<Payload = SendPhoto, Err = Self::Err>;
/// For Telegram documentation see [`SendPhoto`]. /// For Telegram documentation see [`SendPhoto`].
@ -977,6 +1005,14 @@ pub trait Requester {
where where
C: Into<Recipient>; C: Into<Recipient>;
type DeleteMessages: Request<Payload = DeleteMessages, Err = Self::Err>;
/// For Telegram documentation see [`DeleteMessages`].
fn delete_messages<C, M>(&self, chat_id: C, message_ids: M) -> Self::DeleteMessages
where
C: Into<Recipient>,
M: IntoIterator<Item = MessageId>;
type SendSticker: Request<Payload = SendSticker, Err = Self::Err>; type SendSticker: Request<Payload = SendSticker, Err = Self::Err>;
/// For Telegram documentation see [`SendSticker`]. /// For Telegram documentation see [`SendSticker`].
@ -1249,7 +1285,9 @@ macro_rules! forward_all {
delete_webhook, delete_webhook,
get_webhook_info, get_webhook_info,
forward_message, forward_message,
forward_messages,
copy_message, copy_message,
copy_messages,
send_message, send_message,
send_photo, send_photo,
send_audio, send_audio,
@ -1338,6 +1376,7 @@ macro_rules! forward_all {
edit_message_reply_markup_inline, edit_message_reply_markup_inline,
stop_poll, stop_poll,
delete_message, delete_message,
delete_messages,
send_sticker, send_sticker,
get_sticker_set, get_sticker_set,
get_custom_emoji_stickers, get_custom_emoji_stickers,