diff --git a/src/core/requests/forward_message.rs b/src/core/requests/forward_message.rs index 41e6bc0f..141d3338 100644 --- a/src/core/requests/forward_message.rs +++ b/src/core/requests/forward_message.rs @@ -28,14 +28,14 @@ impl<'a> Request<'a> for ForwardMessage<'a> { type ReturnValue = Message; fn send(self) -> RequestFuture<'a, ResponseResult> { - Box::pin(async move { + Box::pin( network::request_json( - &self.ctx.client, - &self.ctx.token, + self.ctx.client, + self.ctx.token, "forwardMessage", &self, - ).await - }) + ) + ) } } diff --git a/src/core/requests/get_me.rs b/src/core/requests/get_me.rs index a837cde5..aa92a589 100644 --- a/src/core/requests/get_me.rs +++ b/src/core/requests/get_me.rs @@ -8,22 +8,26 @@ use crate::core::types::User; /// A simple method for testing your bot's auth token. Requires no parameters. /// Returns basic information about the bot in form of a [`User`] object. pub struct GetMe<'a> { - info: RequestContext<'a>, + ctx: RequestContext<'a>, } impl<'a> Request<'a> for GetMe<'a> { type ReturnValue = User; fn send(self) -> RequestFuture<'a, ResponseResult> { - Box::pin(async move { - network::request_multipart(self.info.client, self.info.token, "getMe", None) - .await - }) + Box::pin( + network::request_multipart( + self.ctx.client, + self.ctx.token, + "getMe", + None + ) + ) } } impl<'a> GetMe<'a> { - pub(crate) fn new(info: RequestContext<'a>) -> Self { - GetMe { info } + pub(crate) fn new(ctx: RequestContext<'a>) -> Self { + GetMe { ctx } } } diff --git a/src/core/requests/send_message.rs b/src/core/requests/send_message.rs index 9796ed7c..dc91377f 100644 --- a/src/core/requests/send_message.rs +++ b/src/core/requests/send_message.rs @@ -2,7 +2,6 @@ use crate::core::requests::form_builder::FormBuilder; use crate::core::requests::{ ChatId, Request, RequestFuture, RequestContext, ResponseResult, }; -use crate::core::{network, types::Message, types::ParseMode}; #[derive(Debug, Clone, Serialize)] @@ -44,15 +43,14 @@ impl<'a> Request<'a> for SendMessage<'a> { type ReturnValue = Message; fn send(self) -> RequestFuture<'a, ResponseResult> { - Box::pin(async move { + Box::pin( network::request_json( - &self.ctx.client, - &self.ctx.token, + self.ctx.client, + self.ctx.token, "sendMessage", &self, ) - .await - }) + ) } }