diff --git a/src/bot/mod.rs b/src/bot/mod.rs index 9a305eb0..74ff89d4 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -1,7 +1,24 @@ use reqwest::r#async::Client; -use crate::core::requests::{ - get_me::GetMe, send_message::SendMessage, ChatId, RequestContext, +use crate::core::{ + types::{ + InputFile, + InputMedia, + }, + requests::{ + ChatId, + RequestContext, + + get_me::GetMe, + send_message::SendMessage, + edit_message_live_location::EditMessageLiveLocation, + forward_message::ForwardMessage, + send_audio::SendAudio, + send_location::SendLocation, + send_media_group::SendMediaGroup, + send_photo::SendPhoto, + stop_message_live_location::StopMessageLiveLocation, + } }; pub struct Bot { @@ -49,4 +66,100 @@ impl Bot { text.into(), ) } + + pub fn edit_message_live_location( + &self, + latitude: Lt, + longitude: Lg, + ) -> EditMessageLiveLocation + where + Lt: Into, + Lg: Into, + { + EditMessageLiveLocation::new( + self.ctx(), + latitude.into(), + longitude.into(), + ) + } + + pub fn forward_message( + &self, + chat_id: C, + from_chat_id: F, + message_id: M + ) -> ForwardMessage + where + C: Into, + F: Into, + M: Into, + { + ForwardMessage::new( + self.ctx(), + chat_id.into(), + from_chat_id.into(), + message_id.into(), + ) + } + + pub fn send_audio(&self, chat_id: C, audio: A) -> SendAudio + where + C: Into, + A: Into, + { + SendAudio::new( + self.ctx(), + chat_id.into(), + audio.into() + ) + } + + pub fn send_location( + &self, + chat_id: C, + latitude: Lt, + longitude: Lg, + ) -> SendLocation + where + C: Into, + Lt: Into, + Lg: Into, + { + SendLocation::new( + self.ctx(), + chat_id.into(), + latitude.into(), + longitude.into(), + ) + } + + pub fn send_media_group(&self, chat_id: C, media: M) -> SendMediaGroup + where + C: Into, + M: Into> + { + SendMediaGroup::new( + self.ctx(), + chat_id.into(), + media.into(), + ) + } + + pub fn send_photo(&self, chat_id: C, photo: P) -> SendPhoto + where + C: Into, + P: Into + { + SendPhoto::new( + self.ctx(), + chat_id.into(), + photo.into(), + ) + } + + pub fn stop_message_live_location(&self) -> StopMessageLiveLocation { + StopMessageLiveLocation::new( + self.ctx() + ) + } } diff --git a/src/core/requests/stop_message_live_location.rs b/src/core/requests/stop_message_live_location.rs index 9cae0ad6..c86ee1ed 100644 --- a/src/core/requests/stop_message_live_location.rs +++ b/src/core/requests/stop_message_live_location.rs @@ -53,7 +53,7 @@ impl<'a> Request<'a> for StopMessageLiveLocation<'a> { } impl<'a> StopMessageLiveLocation<'a> { - fn new(ctx: RequestContext<'a>) -> Self { + pub(crate) fn new(ctx: RequestContext<'a>) -> Self { Self { ctx, chat_id: None,