+PinChatMessage

This commit is contained in:
Mr-Andersen 2019-09-21 10:48:34 +03:00
parent ccbfee24b8
commit 8211838fe9
2 changed files with 33 additions and 0 deletions

View file

@ -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;

View file

@ -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<Self::ReturnValue>> {
Box::pin(async move {
network::request_json(
&self.ctx.client,
&self.ctx.token,
"pinChatMessage",
&self,
).await
})
}
}