diff --git a/src/api_params.rs b/src/api_params.rs index 6ec1e3c..0864a08 100644 --- a/src/api_params.rs +++ b/src/api_params.rs @@ -340,6 +340,29 @@ pub struct ForwardMessageParams { pub message_id: i32, } +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] +pub struct ForwardMessagesParams { + #[builder(setter(into))] + pub chat_id: ChatId, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub message_thread_id: Option, + + #[builder(setter(into))] + pub from_chat_id: ChatId, + + pub message_ids: Vec, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub disable_notification: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub protect_content: Option, +} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] pub struct CopyMessageParams { #[builder(setter(into))] @@ -383,6 +406,33 @@ pub struct CopyMessageParams { pub reply_markup: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] +pub struct CopyMessagesParams { + #[builder(setter(into))] + pub chat_id: ChatId, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub message_thread_id: Option, + + #[builder(setter(into))] + pub from_chat_id: ChatId, + + pub message_ids: Vec, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub disable_notification: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub protect_content: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + #[builder(setter(into, strip_option), default)] + pub remove_caption: Option, +} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] pub struct SendPhotoParams { #[builder(setter(into))] @@ -1787,6 +1837,14 @@ pub struct DeleteMessageParams { pub message_id: i32, } +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] +pub struct DeleteMessagesParams { + #[builder(setter(into))] + pub chat_id: ChatId, + + pub message_ids: Vec, +} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)] pub struct SendStickerParams { #[builder(setter(into))] diff --git a/src/api_traits/async_telegram_api.rs b/src/api_traits/async_telegram_api.rs index c1c5565..e2805d9 100644 --- a/src/api_traits/async_telegram_api.rs +++ b/src/api_traits/async_telegram_api.rs @@ -12,6 +12,7 @@ use crate::api_params::BanChatSenderChatParams; use crate::api_params::CloseForumTopicParams; use crate::api_params::CloseGeneralForumTopicParams; use crate::api_params::CopyMessageParams; +use crate::api_params::CopyMessagesParams; use crate::api_params::CreateChatInviteLinkParams; use crate::api_params::CreateForumTopicParams; use crate::api_params::CreateInvoiceLinkParams; @@ -21,6 +22,7 @@ use crate::api_params::DeleteChatPhotoParams; use crate::api_params::DeleteChatStickerSetParams; use crate::api_params::DeleteForumTopicParams; use crate::api_params::DeleteMessageParams; +use crate::api_params::DeleteMessagesParams; use crate::api_params::DeleteMyCommandsParams; use crate::api_params::DeleteStickerFromSetParams; use crate::api_params::DeleteStickerSetParams; @@ -36,6 +38,7 @@ use crate::api_params::EditMessageTextParams; use crate::api_params::ExportChatInviteLinkParams; use crate::api_params::FileUpload; use crate::api_params::ForwardMessageParams; +use crate::api_params::ForwardMessagesParams; use crate::api_params::GetChatAdministratorsParams; use crate::api_params::GetChatMemberCountParams; use crate::api_params::GetChatMemberParams; @@ -193,6 +196,13 @@ pub trait AsyncTelegramApi { self.request("forwardMessage", Some(params)).await } + async fn forward_messages( + &self, + params: &ForwardMessagesParams, + ) -> Result>, Self::Error> { + self.request("forwardMessages", Some(params)).await + } + async fn copy_message( &self, params: &CopyMessageParams, @@ -200,6 +210,13 @@ pub trait AsyncTelegramApi { self.request("copyMessage", Some(params)).await } + async fn copy_messages( + &self, + params: &CopyMessagesParams, + ) -> Result>, Self::Error> { + self.request("copyMessages", Some(params)).await + } + async fn send_photo( &self, params: &SendPhotoParams, @@ -1031,6 +1048,13 @@ pub trait AsyncTelegramApi { self.request("deleteMessage", Some(params)).await } + async fn delete_messages( + &self, + params: &DeleteMessagesParams, + ) -> Result, Self::Error> { + self.request("deleteMessages", Some(params)).await + } + async fn send_sticker( &self, params: &SendStickerParams, diff --git a/src/api_traits/telegram_api.rs b/src/api_traits/telegram_api.rs index c8a38d8..f82e787 100644 --- a/src/api_traits/telegram_api.rs +++ b/src/api_traits/telegram_api.rs @@ -12,6 +12,7 @@ use crate::api_params::BanChatSenderChatParams; use crate::api_params::CloseForumTopicParams; use crate::api_params::CloseGeneralForumTopicParams; use crate::api_params::CopyMessageParams; +use crate::api_params::CopyMessagesParams; use crate::api_params::CreateChatInviteLinkParams; use crate::api_params::CreateForumTopicParams; use crate::api_params::CreateInvoiceLinkParams; @@ -21,6 +22,7 @@ use crate::api_params::DeleteChatPhotoParams; use crate::api_params::DeleteChatStickerSetParams; use crate::api_params::DeleteForumTopicParams; use crate::api_params::DeleteMessageParams; +use crate::api_params::DeleteMessagesParams; use crate::api_params::DeleteMyCommandsParams; use crate::api_params::DeleteStickerFromSetParams; use crate::api_params::DeleteStickerSetParams; @@ -36,6 +38,7 @@ use crate::api_params::EditMessageTextParams; use crate::api_params::ExportChatInviteLinkParams; use crate::api_params::FileUpload; use crate::api_params::ForwardMessageParams; +use crate::api_params::ForwardMessagesParams; use crate::api_params::GetChatAdministratorsParams; use crate::api_params::GetChatMemberCountParams; use crate::api_params::GetChatMemberParams; @@ -188,6 +191,13 @@ pub trait TelegramApi { self.request("forwardMessage", Some(params)) } + fn forward_messages( + &self, + params: &ForwardMessagesParams, + ) -> Result>, Self::Error> { + self.request("forwardMessages", Some(params)) + } + fn copy_message( &self, params: &CopyMessageParams, @@ -195,6 +205,13 @@ pub trait TelegramApi { self.request("copyMessage", Some(params)) } + fn copy_messages( + &self, + params: &CopyMessagesParams, + ) -> Result>, Self::Error> { + self.request("copyMessages", Some(params)) + } + fn send_photo(&self, params: &SendPhotoParams) -> Result, Self::Error> { let method_name = "sendPhoto"; let mut files: Vec<(&str, PathBuf)> = vec![]; @@ -979,6 +996,13 @@ pub trait TelegramApi { self.request("deleteMessage", Some(params)) } + fn delete_messages( + &self, + params: &DeleteMessagesParams, + ) -> Result, Self::Error> { + self.request("deleteMessages", Some(params)) + } + fn send_sticker( &self, params: &SendStickerParams,