diff --git a/src/core/requests/mod.rs b/src/core/requests/mod.rs index a1dfa82f..d04e113a 100644 --- a/src/core/requests/mod.rs +++ b/src/core/requests/mod.rs @@ -97,6 +97,7 @@ pub mod get_file; pub mod get_me; pub mod get_user_profile_photos; pub mod kick_chat_member; +pub mod pin_chat_message; pub mod restrict_chat_member; pub mod send_audio; pub mod send_chat_action; diff --git a/src/core/requests/pin_chat_message.rs b/src/core/requests/pin_chat_message.rs new file mode 100644 index 00000000..c1481d38 --- /dev/null +++ b/src/core/requests/pin_chat_message.rs @@ -0,0 +1,32 @@ +use crate::core::requests::{ChatId, RequestContext, RequestFuture, ResponseResult, Request}; +use crate::core::network; + +/// Use this method to get up to date information about the chat +/// (current name of the user for one-on-one conversations, +/// current username of a user, group or channel, etc.). +/// Returns a Chat object on success. +#[derive(Debug, Clone, Serialize)] +pub struct PinChatMessage<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, + /// Unique identifier for the target chat or username + /// of the target supergroup or channel (in the format @channelusername) + chat_id: ChatId, + message_id: i32, + disable_notification: bool +} + +impl<'a> Request<'a> for PinChatMessage<'a> { + type ReturnValue = bool; + + fn send(self) -> RequestFuture<'a, ResponseResult> { + Box::pin(async move { + network::request_json( + &self.ctx.client, + &self.ctx.token, + "pinChatMessage", + &self, + ).await + }) + } +}