api.rs changed

This commit is contained in:
RustemB 2019-10-20 16:01:32 +05:00
parent 5916460ca1
commit 0a1d032e14
3 changed files with 45 additions and 1 deletions

View file

@ -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<I>(&self, chat_id: I) -> GetChat
where
I: Into<ChatId>,
{
GetChat::new(self, chat_id)
}
pub fn answer_shipping_query<I, O>(
&self,
shipping_query_id: I,
@ -322,6 +330,13 @@ impl Bot {
GetChatMember::new(self, chat_id, user_id)
}
pub fn get_chat_administrators<C, I>(&self, chat_id: C) -> GetChatAdministrators
where
C: Into<ChatId>,
{
GetChatAdministrators::new(self, chat_id)
}
pub fn get_chat_members_count<C>(&self, chat_id: C) -> GetChatMembersCount
where
C: Into<ChatId>,
@ -375,6 +390,16 @@ impl Bot {
DeleteChatPhoto::new(self, chat_id)
}
pub fn leave_chat<C>(
&self,
chat_id: C,
) -> LeaveChat
where
C: Into<ChatId>,
{
LeaveChat::new(self, chat_id)
}
pub fn set_chat_photo<C, P>(
&self,
chat_id: C,

View file

@ -42,6 +42,16 @@ impl GetChat<'_> {
}
impl<'a> GetChat<'a> {
pub(crate) fn new<F>(bot: &'a Bot, value: F) -> Self
where
F: Into<ChatId>,
{
Self {
bot,
chat_id: value.into(),
}
}
pub fn chat_id<C>(mut self, value: C) -> Self
where
C: Into<ChatId>,

View file

@ -40,6 +40,15 @@ impl LeaveChat<'_> {
}
impl<'a> LeaveChat<'a> {
pub(crate) fn new<F>(bot: &'a Bot, value: F) -> Self
where
F: Into<ChatId>,
{
Self {
bot,
chat_id: value.into(),
}
}
pub fn chat_id<C>(mut self, value: C) -> Self
where
C: Into<ChatId>,