Provide &self instead of &&self (bot/api.h)

This commit is contained in:
Temirkhan Myrzamadi 2019-10-17 13:33:26 +06:00
parent d0f8852533
commit a3825d612d

View file

@ -14,11 +14,11 @@ use crate::{
/// Telegram functions
impl Bot {
pub fn get_me(&self) -> GetMe {
GetMe::new(&self)
GetMe::new(self)
}
pub fn get_updates(&self) -> GetUpdates {
GetUpdates::new(&self)
GetUpdates::new(self)
}
pub fn send_message<C, T>(&self, chat_id: C, text: T) -> SendMessage
@ -26,7 +26,7 @@ impl Bot {
C: Into<ChatId>,
T: Into<String>,
{
SendMessage::new(&self, chat_id, text)
SendMessage::new(self, chat_id, text)
}
pub fn edit_message_live_location<Lt, Lg>(
@ -38,7 +38,7 @@ impl Bot {
Lt: Into<f64>,
Lg: Into<f64>,
{
EditMessageLiveLocation::new(&self, latitude, longitude)
EditMessageLiveLocation::new(self, latitude, longitude)
}
pub fn forward_message<C, F, M>(
@ -52,7 +52,7 @@ impl Bot {
F: Into<ChatId>,
M: Into<i32>,
{
ForwardMessage::new(&self, chat_id, from_chat_id, message_id)
ForwardMessage::new(self, chat_id, from_chat_id, message_id)
}
pub fn send_audio<C, A>(&self, chat_id: C, audio: A) -> SendAudio
@ -60,7 +60,7 @@ impl Bot {
C: Into<ChatId>,
A: Into<InputFile>,
{
SendAudio::new(&self, chat_id, audio)
SendAudio::new(self, chat_id, audio)
}
pub fn send_location<C, Lt, Lg>(
@ -74,7 +74,7 @@ impl Bot {
Lt: Into<f64>,
Lg: Into<f64>,
{
SendLocation::new(&self, chat_id, latitude, longitude)
SendLocation::new(self, chat_id, latitude, longitude)
}
pub fn send_media_group<C, M>(&self, chat_id: C, media: M) -> SendMediaGroup
@ -82,7 +82,7 @@ impl Bot {
C: Into<ChatId>,
M: Into<Vec<InputMedia>>,
{
SendMediaGroup::new(&self, chat_id, media)
SendMediaGroup::new(self, chat_id, media)
}
pub fn send_photo<C, P>(&self, chat_id: C, photo: P) -> SendPhoto
@ -90,18 +90,18 @@ impl Bot {
C: Into<ChatId>,
P: Into<InputFile>,
{
SendPhoto::new(&self, chat_id, photo)
SendPhoto::new(self, chat_id, photo)
}
pub fn stop_message_live_location(&self) -> StopMessageLiveLocation {
StopMessageLiveLocation::new(&self)
StopMessageLiveLocation::new(self)
}
pub fn get_file<F>(&self, file_id: F) -> GetFile
where
F: Into<String>,
{
GetFile::new(&self, file_id)
GetFile::new(self, file_id)
}
pub fn answer_pre_checkout_query<I, O>(
@ -113,7 +113,7 @@ impl Bot {
I: Into<String>,
O: Into<bool>,
{
AnswerPreCheckoutQuery::new(&self, pre_checkout_query_id, ok)
AnswerPreCheckoutQuery::new(self, pre_checkout_query_id, ok)
}
pub fn answer_shipping_query<I, O>(
@ -125,7 +125,7 @@ impl Bot {
I: Into<String>,
O: Into<bool>,
{
AnswerShippingQuery::new(&self, shipping_query_id, ok)
AnswerShippingQuery::new(self, shipping_query_id, ok)
}
pub fn kick_chat_member<C, U>(
@ -137,7 +137,7 @@ impl Bot {
C: Into<ChatId>,
U: Into<i32>,
{
KickChatMember::new(&self, chat_id, user_id)
KickChatMember::new(self, chat_id, user_id)
}
pub fn pin_chat_message<C, M>(
@ -149,7 +149,7 @@ impl Bot {
C: Into<ChatId>,
M: Into<i32>,
{
PinChatMessage::new(&self, chat_id, message_id)
PinChatMessage::new(self, chat_id, message_id)
}
pub fn promote_chat_member<C, U>(
@ -161,7 +161,7 @@ impl Bot {
C: Into<ChatId>,
U: Into<i32>,
{
PromoteChatMember::new(&self, chat_id, user_id)
PromoteChatMember::new(self, chat_id, user_id)
}
pub fn restrict_chat_member<C, U, P>(
@ -175,7 +175,7 @@ impl Bot {
U: Into<i32>,
P: Into<ChatPermissions>,
{
RestrictChatMember::new(&self, chat_id, user_id, permissions)
RestrictChatMember::new(self, chat_id, user_id, permissions)
}
pub fn send_chat_action<C, A>(
@ -187,7 +187,7 @@ impl Bot {
C: Into<ChatId>,
A: Into<ChatAction>,
{
SendChatAction::new(&self, chat_id, action)
SendChatAction::new(self, chat_id, action)
}
pub fn send_contact<C, P, F>(
@ -201,7 +201,7 @@ impl Bot {
P: Into<String>,
F: Into<String>,
{
SendContact::new(&self, chat_id, phone_number, first_name)
SendContact::new(self, chat_id, phone_number, first_name)
}
pub fn send_poll<C, Q, O>(
@ -215,7 +215,7 @@ impl Bot {
Q: Into<String>,
O: Into<Vec<String>>,
{
SendPoll::new(&self, chat_id, question, options)
SendPoll::new(self, chat_id, question, options)
}
pub fn send_venue<C, Lt, Lg, T, A>(
@ -233,7 +233,7 @@ impl Bot {
T: Into<String>,
A: Into<String>,
{
SendVenue::new(&self, chat_id, latitude, longitude, title, address)
SendVenue::new(self, chat_id, latitude, longitude, title, address)
}
pub fn send_video_note<C, V>(
@ -245,7 +245,7 @@ impl Bot {
C: Into<ChatId>,
V: Into<String>, // TODO: InputFile
{
SendVideoNote::new(&self, chat_id, video_note)
SendVideoNote::new(self, chat_id, video_note)
}
pub fn send_voice<C, V>(&self, chat_id: C, voice: V) -> SendVoice
@ -253,7 +253,7 @@ impl Bot {
C: Into<ChatId>,
V: Into<String>, // TODO: InputFile
{
SendVoice::new(&self, chat_id, voice)
SendVoice::new(self, chat_id, voice)
}
pub fn unban_chat_member<C, U>(
@ -265,13 +265,13 @@ impl Bot {
C: Into<ChatId>,
U: Into<i32>,
{
UnbanChatMember::new(&self, chat_id, user_id)
UnbanChatMember::new(self, chat_id, user_id)
}
pub fn unpin_chat_message<C>(&self, chat_id: C) -> UnpinChatMessage
where
C: Into<ChatId>,
{
UnpinChatMessage::new(&self, chat_id)
UnpinChatMessage::new(self, chat_id)
}
}