mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-20 15:54:53 +01:00
add method
This commit is contained in:
parent
142d65186f
commit
e75d40425b
2 changed files with 57 additions and 0 deletions
|
@ -22,6 +22,7 @@ pub use self::{
|
||||||
send_video_note::SendVideoNote, send_voice::SendVoice,
|
send_video_note::SendVideoNote, send_voice::SendVoice,
|
||||||
stop_message_live_location::StopMessageLiveLocation,
|
stop_message_live_location::StopMessageLiveLocation,
|
||||||
unban_chat_member::UnbanChatMember,
|
unban_chat_member::UnbanChatMember,
|
||||||
|
unpin_chat_message::UnpinChatMessage,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod form_builder;
|
mod form_builder;
|
||||||
|
@ -111,3 +112,4 @@ mod send_video_note;
|
||||||
mod send_voice;
|
mod send_voice;
|
||||||
mod stop_message_live_location;
|
mod stop_message_live_location;
|
||||||
mod unban_chat_member;
|
mod unban_chat_member;
|
||||||
|
mod unpin_chat_message;
|
||||||
|
|
55
src/requests/unpin_chat_message.rs
Normal file
55
src/requests/unpin_chat_message.rs
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
use async_trait::async_trait;
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
network,
|
||||||
|
requests::{Request, RequestContext, ResponseResult, ChatId},
|
||||||
|
types::True
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
pub struct UnpinChatMessage<'a> {
|
||||||
|
#[serde(skip_serializing)]
|
||||||
|
pub ctx: RequestContext<'a>,
|
||||||
|
|
||||||
|
pub chat_id: ChatId
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl Request for UnpinChatMessage<'_> {
|
||||||
|
type ReturnValue = True;
|
||||||
|
|
||||||
|
async fn send_boxed(self) -> ResponseResult<Self::ReturnValue> {
|
||||||
|
self.send().await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UnpinChatMessage<'_> {
|
||||||
|
pub async fn send(self) -> ResponseResult<True> {
|
||||||
|
network::request_json(
|
||||||
|
&self.ctx.client,
|
||||||
|
&self.ctx.token,
|
||||||
|
"unpinChatMessage",
|
||||||
|
&self
|
||||||
|
).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> UnpinChatMessage<'a> {
|
||||||
|
pub(crate) fn new(
|
||||||
|
ctx: RequestContext<'a>,
|
||||||
|
chat_id: ChatId,
|
||||||
|
) -> Self {
|
||||||
|
Self {
|
||||||
|
ctx,
|
||||||
|
chat_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn chat_id<T>(mut self, chat_id: T) -> Self
|
||||||
|
where
|
||||||
|
T: Into<ChatId>
|
||||||
|
{
|
||||||
|
self.chat_id = chat_id.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue