mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-31 16:40:37 +01:00
Fix the compilation errors
This commit is contained in:
parent
9a2c571b57
commit
142d65186f
8 changed files with 30 additions and 25 deletions
|
@ -26,7 +26,8 @@ impl Bot {
|
|||
/// let bot = Bot::new("TOKEN");
|
||||
/// let mut file = File::create("/home/waffle/Pictures/test.png").await?;
|
||||
///
|
||||
/// let TgFile { file_path, .. } = bot.get_file("*file_id*").send_boxed().await?;
|
||||
/// let TgFile { file_path, .. } =
|
||||
/// bot.get_file("*file_id*").send_boxed().await?;
|
||||
/// bot.download_file(&file_path, &mut file).await?;
|
||||
/// # Ok(()) }
|
||||
/// ```
|
||||
|
|
|
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||
use crate::{
|
||||
network,
|
||||
requests::{Request, RequestContext, ResponseResult},
|
||||
types::True
|
||||
types::True,
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize, Clone)]
|
||||
|
|
|
@ -2,7 +2,7 @@ use async_trait::async_trait;
|
|||
|
||||
use crate::{
|
||||
network,
|
||||
requests::{Request, RequestContext, ResponseResult, ChatId},
|
||||
requests::{ChatId, Request, RequestContext, ResponseResult},
|
||||
types::True,
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@ impl<'a> Request for KickChatMember<'a> {
|
|||
type ReturnValue = True;
|
||||
|
||||
async fn send_boxed(self) -> ResponseResult<Self::ReturnValue> {
|
||||
self.send().await
|
||||
self.send().await
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use std::{future::Future, pin::Pin};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use reqwest::r#async::Client;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
|
|
@ -2,8 +2,8 @@ use async_trait::async_trait;
|
|||
|
||||
use crate::{
|
||||
network,
|
||||
requests::{ChatId, RequestContext, ResponseResult, Request},
|
||||
types::True
|
||||
requests::{ChatId, Request, RequestContext, ResponseResult},
|
||||
types::True,
|
||||
};
|
||||
|
||||
/// Use this method to get up to date information about the chat
|
||||
|
@ -59,6 +59,7 @@ impl PinChatMessage<'_> {
|
|||
&self.ctx.token,
|
||||
"pinChatMessage",
|
||||
&self,
|
||||
).await
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use async_trait::async_trait;
|
||||
use crate::{
|
||||
network,
|
||||
requests::{ChatId, Request, RequestContext, ResponseResult},
|
||||
types::{ChatPermissions, True},
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
|
||||
/// Use this method to restrict a user in a supergroup. The bot must be an
|
||||
/// administrator in the supergroup for this to work and must have the
|
||||
|
|
|
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||
use crate::{
|
||||
network,
|
||||
requests::{ChatId, Request, RequestContext, ResponseResult},
|
||||
types::True
|
||||
types::True,
|
||||
};
|
||||
|
||||
///Use this method when you need to tell the user that something is happening
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
use crate::network;
|
||||
use crate::requests::{
|
||||
ChatId, Request, RequestContext, RequestFuture, ResponseResult,
|
||||
};
|
||||
use crate::requests::{ChatId, Request, RequestContext, ResponseResult};
|
||||
|
||||
/// Use this method to unban a previously kicked user in a supergroup or
|
||||
/// channel. The user will not return to the group or channel automatically, but
|
||||
|
@ -18,19 +18,24 @@ pub struct UnbanChatMember<'a> {
|
|||
pub user_id: i32,
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> for UnbanChatMember<'a> {
|
||||
#[async_trait]
|
||||
impl Request for UnbanChatMember<'_> {
|
||||
type ReturnValue = bool;
|
||||
|
||||
fn send(self) -> RequestFuture<'a, ResponseResult<Self::ReturnValue>> {
|
||||
Box::pin(async move {
|
||||
network::request_json(
|
||||
&self.ctx.client,
|
||||
&self.ctx.token,
|
||||
"unbanChatMember",
|
||||
&self,
|
||||
)
|
||||
.await
|
||||
})
|
||||
async fn send_boxed(self) -> ResponseResult<Self::ReturnValue> {
|
||||
self.send().await
|
||||
}
|
||||
}
|
||||
|
||||
impl UnbanChatMember<'_> {
|
||||
pub async fn send(self) -> ResponseResult<bool> {
|
||||
network::request_json(
|
||||
&self.ctx.client,
|
||||
&self.ctx.token,
|
||||
"unbanChatMember",
|
||||
&self,
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue