diff --git a/src/bot/api.rs b/src/bot/api.rs index ff529396..936331d0 100644 --- a/src/bot/api.rs +++ b/src/bot/api.rs @@ -10,7 +10,8 @@ use crate::{ SendVenue, SendVideo, SendVideoNote, SendVoice, SetChatDescription, SetChatStickerSet, StopMessageLiveLocation, UnbanChatMember, UnpinChatMessage, SetChatTitle, DeleteChatPhoto, SetChatPhoto, - ExportCharInviteLink, SetChatPermissions + ExportCharInviteLink, SetChatPermissions, LeaveChat, GetChatAdministrators, + GetChat, }, types::{ChatAction, ChatId, ChatPermissions, InputFile, InputMedia}, }; @@ -119,6 +120,13 @@ impl Bot { AnswerPreCheckoutQuery::new(self, pre_checkout_query_id, ok) } + pub fn get_chat(&self, chat_id: I) -> GetChat + where + I: Into, + { + GetChat::new(self, chat_id) + } + pub fn answer_shipping_query( &self, shipping_query_id: I, @@ -322,6 +330,13 @@ impl Bot { GetChatMember::new(self, chat_id, user_id) } + pub fn get_chat_administrators(&self, chat_id: C) -> GetChatAdministrators + where + C: Into, + { + GetChatAdministrators::new(self, chat_id) + } + pub fn get_chat_members_count(&self, chat_id: C) -> GetChatMembersCount where C: Into, @@ -375,6 +390,16 @@ impl Bot { DeleteChatPhoto::new(self, chat_id) } + pub fn leave_chat( + &self, + chat_id: C, + ) -> LeaveChat + where + C: Into, + { + LeaveChat::new(self, chat_id) + } + pub fn set_chat_photo( &self, chat_id: C, diff --git a/src/requests/get_chat.rs b/src/requests/get_chat.rs index c8fb74a8..aa8e3ca4 100644 --- a/src/requests/get_chat.rs +++ b/src/requests/get_chat.rs @@ -42,6 +42,16 @@ impl GetChat<'_> { } impl<'a> GetChat<'a> { + pub(crate) fn new(bot: &'a Bot, value: F) -> Self + where + F: Into, + { + Self { + bot, + chat_id: value.into(), + } + } + pub fn chat_id(mut self, value: C) -> Self where C: Into, diff --git a/src/requests/leave_chat.rs b/src/requests/leave_chat.rs index 2433dec2..88ad3fd6 100644 --- a/src/requests/leave_chat.rs +++ b/src/requests/leave_chat.rs @@ -40,6 +40,15 @@ impl LeaveChat<'_> { } impl<'a> LeaveChat<'a> { + pub(crate) fn new(bot: &'a Bot, value: F) -> Self + where + F: Into, + { + Self { + bot, + chat_id: value.into(), + } + } pub fn chat_id(mut self, value: C) -> Self where C: Into,