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, SendVenue, SendVideo, SendVideoNote, SendVoice, SetChatDescription,
SetChatStickerSet, StopMessageLiveLocation, UnbanChatMember, SetChatStickerSet, StopMessageLiveLocation, UnbanChatMember,
UnpinChatMessage, SetChatTitle, DeleteChatPhoto, SetChatPhoto, UnpinChatMessage, SetChatTitle, DeleteChatPhoto, SetChatPhoto,
ExportCharInviteLink, SetChatPermissions ExportCharInviteLink, SetChatPermissions, LeaveChat, GetChatAdministrators,
GetChat,
}, },
types::{ChatAction, ChatId, ChatPermissions, InputFile, InputMedia}, types::{ChatAction, ChatId, ChatPermissions, InputFile, InputMedia},
}; };
@ -119,6 +120,13 @@ impl Bot {
AnswerPreCheckoutQuery::new(self, pre_checkout_query_id, ok) 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>( pub fn answer_shipping_query<I, O>(
&self, &self,
shipping_query_id: I, shipping_query_id: I,
@ -322,6 +330,13 @@ impl Bot {
GetChatMember::new(self, chat_id, user_id) 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 pub fn get_chat_members_count<C>(&self, chat_id: C) -> GetChatMembersCount
where where
C: Into<ChatId>, C: Into<ChatId>,
@ -375,6 +390,16 @@ impl Bot {
DeleteChatPhoto::new(self, chat_id) 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>( pub fn set_chat_photo<C, P>(
&self, &self,
chat_id: C, chat_id: C,

View file

@ -42,6 +42,16 @@ impl GetChat<'_> {
} }
impl<'a> GetChat<'a> { 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 pub fn chat_id<C>(mut self, value: C) -> Self
where where
C: Into<ChatId>, C: Into<ChatId>,

View file

@ -40,6 +40,15 @@ impl LeaveChat<'_> {
} }
impl<'a> LeaveChat<'a> { 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 pub fn chat_id<C>(mut self, value: C) -> Self
where where
C: Into<ChatId>, C: Into<ChatId>,