mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-24 09:16:12 +01:00
Merge pull request #27 from teloxide/requester_add_all_methods
Add all tba methods to Requester trait
This commit is contained in:
commit
df7aac88a9
7 changed files with 2378 additions and 50 deletions
|
@ -28,7 +28,7 @@ serde = { version = "1.0.114", features = ["derive"] }
|
|||
serde_json = "1.0.55"
|
||||
serde_with_macros = "1.1.0"
|
||||
uuid = { version = "0.8.1", features = ["v4"] } # for attaching input files
|
||||
|
||||
|
||||
derive_more = "0.99.9"
|
||||
mime = "0.3.16"
|
||||
thiserror = "1.0.20"
|
||||
|
|
|
@ -8,7 +8,7 @@ use futures::future::FusedFuture;
|
|||
|
||||
use crate::{
|
||||
requests::{HasPayload, Output, Request, Requester},
|
||||
types::ChatId,
|
||||
types::*,
|
||||
};
|
||||
|
||||
/// Send requests automatically.
|
||||
|
@ -62,23 +62,37 @@ impl<B> AutoSend<B> {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! f {
|
||||
($m:ident $this:ident ($($arg:ident : $T:ty),*)) => {
|
||||
AutoRequest::new($this.inner().$m($($arg),*))
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! fty {
|
||||
($T:ident) => {
|
||||
AutoRequest<B::$T>
|
||||
};
|
||||
}
|
||||
|
||||
impl<B: Requester> Requester for AutoSend<B> {
|
||||
type Err = B::Err;
|
||||
|
||||
type GetMe = AutoRequest<B::GetMe>;
|
||||
|
||||
fn get_me(&self) -> Self::GetMe {
|
||||
AutoRequest::new(self.bot.get_me())
|
||||
}
|
||||
|
||||
type SendMessage = AutoRequest<B::SendMessage>;
|
||||
|
||||
fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>,
|
||||
{
|
||||
AutoRequest::new(self.bot.send_message(chat_id, text))
|
||||
requester_forward! {
|
||||
get_me, send_message, get_updates, set_webhook, delete_webhook, get_webhook_info,
|
||||
forward_message, send_photo, send_audio, send_document, send_video,
|
||||
send_animation, send_voice, send_video_note, send_media_group, send_location,
|
||||
edit_message_live_location, edit_message_live_location_inline, stop_message_live_location,
|
||||
stop_message_live_location_inline, send_venue, send_contact, send_poll, send_dice,
|
||||
send_chat_action, get_user_profile_photos, get_file, kick_chat_member, unban_chat_member,
|
||||
restrict_chat_member, promote_chat_member, set_chat_administrator_custom_title, set_chat_permissions,
|
||||
export_chat_invite_link, set_chat_photo, delete_chat_photo, set_chat_title, set_chat_description,
|
||||
pin_chat_message, unpin_chat_message, leave_chat, get_chat, get_chat_administrators, get_chat_members_count,
|
||||
get_chat_member, set_chat_sticker_set, delete_chat_sticker_set, answer_callback_query, set_my_commands,
|
||||
get_my_commands, answer_inline_query, edit_message_text, edit_message_text_inline, edit_message_caption,
|
||||
edit_message_caption_inline, edit_message_media, edit_message_media_inline, edit_message_reply_markup,
|
||||
edit_message_reply_markup_inline, stop_poll, delete_message, send_sticker, get_sticker_set, upload_sticker_file,
|
||||
create_new_sticker_set, add_sticker_to_set, set_sticker_position_in_set, delete_sticker_from_set,
|
||||
set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors => f, fty
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use once_cell::sync::OnceCell;
|
|||
use crate::{
|
||||
payloads::GetMe,
|
||||
requests::{HasPayload, Request, Requester},
|
||||
types::{ChatId, User},
|
||||
types::{ChatId, User, *},
|
||||
};
|
||||
|
||||
/// `get_me` cache.
|
||||
|
@ -54,6 +54,18 @@ impl<B> CacheMe<B> {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! f {
|
||||
($m:ident $this:ident ($($arg:ident : $T:ty),*)) => {
|
||||
$this.inner().$m($($arg),*)
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! fty {
|
||||
($T:ident) => {
|
||||
B::$T
|
||||
};
|
||||
}
|
||||
|
||||
impl<B> Requester for CacheMe<B>
|
||||
where
|
||||
B: Requester,
|
||||
|
@ -81,6 +93,24 @@ where
|
|||
{
|
||||
self.bot.send_message(chat_id, text)
|
||||
}
|
||||
|
||||
requester_forward! {
|
||||
get_updates, set_webhook, delete_webhook, get_webhook_info,
|
||||
forward_message, send_photo, send_audio, send_document, send_video,
|
||||
send_animation, send_voice, send_video_note, send_media_group, send_location,
|
||||
edit_message_live_location, edit_message_live_location_inline, stop_message_live_location,
|
||||
stop_message_live_location_inline, send_venue, send_contact, send_poll, send_dice,
|
||||
send_chat_action, get_user_profile_photos, get_file, kick_chat_member, unban_chat_member,
|
||||
restrict_chat_member, promote_chat_member, set_chat_administrator_custom_title, set_chat_permissions,
|
||||
export_chat_invite_link, set_chat_photo, delete_chat_photo, set_chat_title, set_chat_description,
|
||||
pin_chat_message, unpin_chat_message, leave_chat, get_chat, get_chat_administrators, get_chat_members_count,
|
||||
get_chat_member, set_chat_sticker_set, delete_chat_sticker_set, answer_callback_query, set_my_commands,
|
||||
get_my_commands, answer_inline_query, edit_message_text, edit_message_text_inline, edit_message_caption,
|
||||
edit_message_caption_inline, edit_message_media, edit_message_media_inline, edit_message_reply_markup,
|
||||
edit_message_reply_markup_inline, stop_poll, delete_message, send_sticker, get_sticker_set, upload_sticker_file,
|
||||
create_new_sticker_set, add_sticker_to_set, set_sticker_position_in_set, delete_sticker_from_set,
|
||||
set_sticker_set_thumb, send_invoice, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors => f, fty
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CachedMeRequest<R: Request<Payload = GetMe>>(Inner<R>, GetMe);
|
||||
|
|
|
@ -19,9 +19,8 @@ use vecrem::VecExt;
|
|||
|
||||
use crate::{
|
||||
adaptors::throttle::chan_send::{ChanSend, SendTy},
|
||||
payloads::SendMessage,
|
||||
requests::{HasPayload, Output, Request, Requester},
|
||||
types::ChatId,
|
||||
types::*,
|
||||
};
|
||||
|
||||
// Throttling is quite complicated this comment describes the algorithm of
|
||||
|
@ -348,26 +347,113 @@ impl<B> Throttle<B> {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! f {
|
||||
($m:ident $this:ident ($($arg:ident : $T:ty),*)) => {
|
||||
ThrottlingRequest(
|
||||
$this.inner().$m($($arg),*),
|
||||
$this.queue.clone(),
|
||||
|p| (&p.payload_ref().chat_id).into(),
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! fty {
|
||||
($T:ident) => {
|
||||
ThrottlingRequest<B::$T>
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! fid {
|
||||
($m:ident $this:ident ($($arg:ident : $T:ty),*)) => {
|
||||
$this.inner().$m($($arg),*)
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! ftyid {
|
||||
($T:ident) => {
|
||||
B::$T
|
||||
};
|
||||
}
|
||||
|
||||
impl<B: Requester> Requester for Throttle<B>
|
||||
where
|
||||
B::SendMessage: Send,
|
||||
B::ForwardMessage: Send,
|
||||
B::SendPhoto: Send,
|
||||
B::SendAudio: Send,
|
||||
B::SendDocument: Send,
|
||||
B::SendVideo: Send,
|
||||
B::SendAnimation: Send,
|
||||
B::SendVoice: Send,
|
||||
B::SendVideoNote: Send,
|
||||
B::SendMediaGroup: Send,
|
||||
B::SendLocation: Send,
|
||||
B::SendVenue: Send,
|
||||
B::SendContact: Send,
|
||||
B::SendPoll: Send,
|
||||
B::SendDice: Send,
|
||||
B::SendSticker: Send,
|
||||
B::SendInvoice: Send,
|
||||
{
|
||||
type Err = B::Err;
|
||||
|
||||
type GetMe = B::GetMe;
|
||||
|
||||
fn get_me(&self) -> Self::GetMe {
|
||||
self.bot.get_me()
|
||||
requester_forward! {
|
||||
send_message,
|
||||
forward_message, send_photo, send_audio, send_document, send_video,
|
||||
send_animation, send_voice, send_video_note, send_media_group, send_location,
|
||||
send_venue, send_contact, send_poll, send_dice, send_sticker, => f, fty
|
||||
}
|
||||
|
||||
type SendMessage = ThrottlingRequest<B::SendMessage>;
|
||||
type SendInvoice = ThrottlingRequest<B::SendInvoice>;
|
||||
|
||||
fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage
|
||||
fn send_invoice<T, D, Pa, P, S, C, Pri>(
|
||||
&self,
|
||||
chat_id: i32,
|
||||
title: T,
|
||||
description: D,
|
||||
payload: Pa,
|
||||
provider_token: P,
|
||||
start_parameter: S,
|
||||
currency: C,
|
||||
prices: Pri,
|
||||
) -> Self::SendInvoice
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>,
|
||||
D: Into<String>,
|
||||
Pa: Into<String>,
|
||||
P: Into<String>,
|
||||
S: Into<String>,
|
||||
C: Into<String>,
|
||||
Pri: IntoIterator<Item = LabeledPrice>,
|
||||
{
|
||||
ThrottlingRequest(self.bot.send_message(chat_id, text), self.queue.clone())
|
||||
ThrottlingRequest(
|
||||
self.inner().send_invoice(
|
||||
chat_id,
|
||||
title,
|
||||
description,
|
||||
payload,
|
||||
provider_token,
|
||||
start_parameter,
|
||||
currency,
|
||||
prices,
|
||||
),
|
||||
self.queue.clone(),
|
||||
|p| Id::Id(p.payload_ref().chat_id as _),
|
||||
)
|
||||
}
|
||||
|
||||
requester_forward! {
|
||||
get_me, get_updates, set_webhook, delete_webhook, get_webhook_info, edit_message_live_location, edit_message_live_location_inline, stop_message_live_location,
|
||||
stop_message_live_location_inline, send_chat_action, get_user_profile_photos, get_file, kick_chat_member, unban_chat_member,
|
||||
restrict_chat_member, promote_chat_member, set_chat_administrator_custom_title, set_chat_permissions,
|
||||
export_chat_invite_link, set_chat_photo, delete_chat_photo, set_chat_title, set_chat_description,
|
||||
pin_chat_message, unpin_chat_message, leave_chat, get_chat, get_chat_administrators, get_chat_members_count,
|
||||
get_chat_member, set_chat_sticker_set, delete_chat_sticker_set, answer_callback_query, set_my_commands,
|
||||
get_my_commands, answer_inline_query, edit_message_text, edit_message_text_inline, edit_message_caption,
|
||||
edit_message_caption_inline, edit_message_media, edit_message_media_inline, edit_message_reply_markup,
|
||||
edit_message_reply_markup_inline, stop_poll, delete_message, get_sticker_set, upload_sticker_file,
|
||||
create_new_sticker_set, add_sticker_to_set, set_sticker_position_in_set, delete_sticker_from_set,
|
||||
set_sticker_set_thumb, answer_shipping_query, answer_pre_checkout_query, set_passport_data_errors => fid, ftyid
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -395,17 +481,11 @@ impl From<&ChatId> for Id {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait GetChatId {
|
||||
fn get_chat_id(&self) -> &ChatId;
|
||||
}
|
||||
|
||||
impl GetChatId for SendMessage {
|
||||
fn get_chat_id(&self) -> &ChatId {
|
||||
&self.chat_id
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ThrottlingRequest<R>(R, mpsc::Sender<(Id, Sender<Never>)>);
|
||||
pub struct ThrottlingRequest<R: HasPayload>(
|
||||
R,
|
||||
mpsc::Sender<(Id, Sender<Never>)>,
|
||||
fn(&R::Payload) -> Id,
|
||||
);
|
||||
|
||||
impl<R: HasPayload> HasPayload for ThrottlingRequest<R> {
|
||||
type Payload = R::Payload;
|
||||
|
@ -422,7 +502,6 @@ impl<R: HasPayload> HasPayload for ThrottlingRequest<R> {
|
|||
impl<R> Request for ThrottlingRequest<R>
|
||||
where
|
||||
R: Request + Send,
|
||||
<R as HasPayload>::Payload: GetChatId,
|
||||
{
|
||||
type Err = R::Err;
|
||||
type Send = ThrottlingSend<R>;
|
||||
|
@ -430,13 +509,14 @@ where
|
|||
|
||||
fn send(self) -> Self::Send {
|
||||
let (tx, rx) = channel();
|
||||
let send = self.1.send_t((self.0.payload_ref().get_chat_id().into(), tx));
|
||||
let id = self.2(self.payload_ref());
|
||||
let send = self.1.send_t((id, tx));
|
||||
ThrottlingSend(ThrottlingSendInner::Registering { request: self.0, send, wait: rx })
|
||||
}
|
||||
|
||||
fn send_ref(&self) -> Self::SendRef {
|
||||
let (tx, rx) = channel();
|
||||
let send = self.1.clone().send_t((self.0.payload_ref().get_chat_id().into(), tx));
|
||||
let send = self.1.clone().send_t((self.2(self.payload_ref()), tx));
|
||||
|
||||
// As we can't move self.0 (request) out, as we do in `send` we are
|
||||
// forced to call `send_ref()`. This may have overhead and/or lead to
|
||||
|
|
910
src/bot/api.rs
910
src/bot/api.rs
|
@ -9,8 +9,8 @@ use crate::{
|
|||
EditMessageReplyMarkup, EditMessageText, ExportChatInviteLink, ForwardMessage, GetChat,
|
||||
GetChatAdministrators, GetChatMember, GetChatMembersCount, GetFile, GetGameHighScores,
|
||||
GetMe, GetMyCommands, GetStickerSet, GetUpdates, GetUpdatesNonStrict, GetUserProfilePhotos,
|
||||
GetWebhookInfo, JsonRequest, KickChatMember, LeaveChat, PinChatMessage, PromoteChatMember,
|
||||
Requester, RestrictChatMember, SendAnimation, SendAudio, SendChatAction,
|
||||
GetWebhookInfo, JsonRequest, KickChatMember, LeaveChat, MultipartRequest, PinChatMessage,
|
||||
PromoteChatMember, Requester, RestrictChatMember, SendAnimation, SendAudio, SendChatAction,
|
||||
SendChatActionKind, SendContact, SendDice, SendDocument, SendGame, SendInvoice,
|
||||
SendLocation, SendMediaGroup, SendMessage, SendPhoto, SendPoll, SendSticker, SendVenue,
|
||||
SendVideo, SendVideoNote, SendVoice, SetChatAdministratorCustomTitle, SetChatDescription,
|
||||
|
@ -1707,19 +1707,921 @@ impl Bot {
|
|||
impl Requester for Bot {
|
||||
type Err = crate::errors::RequestError;
|
||||
|
||||
type GetUpdates = JsonRequest<payloads::GetUpdates>;
|
||||
|
||||
fn get_updates(&self) -> Self::GetUpdates {
|
||||
Self::GetUpdates::new(self.clone(), payloads::GetUpdates::new())
|
||||
}
|
||||
|
||||
type SetWebhook = JsonRequest<payloads::SetWebhook>;
|
||||
|
||||
fn set_webhook<U, A>(&self, url: U, allowed_updates: A) -> Self::SetWebhook
|
||||
where
|
||||
U: Into<String>,
|
||||
A: IntoIterator<Item = crate::types::AllowedUpdate>,
|
||||
{
|
||||
Self::SetWebhook::new(self.clone(), payloads::SetWebhook::new(url, allowed_updates))
|
||||
}
|
||||
|
||||
type DeleteWebhook = JsonRequest<payloads::DeleteWebhook>;
|
||||
|
||||
fn delete_webhook(&self) -> Self::DeleteWebhook {
|
||||
Self::DeleteWebhook::new(self.clone(), payloads::DeleteWebhook::new())
|
||||
}
|
||||
|
||||
type GetWebhookInfo = JsonRequest<payloads::GetWebhookInfo>;
|
||||
|
||||
fn get_webhook_info(&self) -> Self::GetWebhookInfo {
|
||||
Self::GetWebhookInfo::new(self.clone(), payloads::GetWebhookInfo::new())
|
||||
}
|
||||
|
||||
type GetMe = JsonRequest<payloads::GetMe>;
|
||||
|
||||
fn get_me(&self) -> JsonRequest<payloads::GetMe> {
|
||||
fn get_me(&self) -> Self::GetMe {
|
||||
Self::GetMe::new(self.clone(), payloads::GetMe::new())
|
||||
}
|
||||
|
||||
type SendMessage = JsonRequest<payloads::SendMessage>;
|
||||
|
||||
fn send_message<C, T>(&self, chat_id: C, text: T) -> JsonRequest<payloads::SendMessage>
|
||||
fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>,
|
||||
{
|
||||
Self::SendMessage::new(self.clone(), payloads::SendMessage::new(chat_id, text))
|
||||
}
|
||||
|
||||
type ForwardMessage = JsonRequest<payloads::ForwardMessage>;
|
||||
|
||||
fn forward_message<C, F>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
from_chat_id: F,
|
||||
message_id: i32,
|
||||
) -> Self::ForwardMessage
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
F: Into<ChatId>,
|
||||
{
|
||||
Self::ForwardMessage::new(
|
||||
self.clone(),
|
||||
payloads::ForwardMessage::new(chat_id, from_chat_id, message_id),
|
||||
)
|
||||
}
|
||||
|
||||
type SendPhoto = MultipartRequest<payloads::SendPhoto>;
|
||||
|
||||
fn send_photo<Ch, Ca>(&self, chat_id: Ch, photo: InputFile, caption: Ca) -> Self::SendPhoto
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>,
|
||||
{
|
||||
Self::SendPhoto::new(self.clone(), payloads::SendPhoto::new(chat_id, photo, caption))
|
||||
}
|
||||
|
||||
type SendAudio = MultipartRequest<payloads::SendAudio>;
|
||||
|
||||
fn send_audio<Ch, Ca>(&self, chat_id: Ch, audio: InputFile, caption: Ca) -> Self::SendAudio
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>,
|
||||
{
|
||||
Self::SendAudio::new(self.clone(), payloads::SendAudio::new(chat_id, audio, caption))
|
||||
}
|
||||
|
||||
type SendDocument = MultipartRequest<payloads::SendDocument>;
|
||||
|
||||
fn send_document<Ch, Ca>(
|
||||
&self,
|
||||
chat_id: Ch,
|
||||
document: InputFile,
|
||||
caption: Ca,
|
||||
) -> Self::SendDocument
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>,
|
||||
{
|
||||
Self::SendDocument::new(
|
||||
self.clone(),
|
||||
payloads::SendDocument::new(chat_id, document, caption),
|
||||
)
|
||||
}
|
||||
|
||||
type SendVideo = MultipartRequest<payloads::SendVideo>;
|
||||
|
||||
fn send_video<Ch, Ca>(&self, chat_id: Ch, video: InputFile, caption: Ca) -> Self::SendVideo
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>,
|
||||
{
|
||||
Self::SendVideo::new(self.clone(), payloads::SendVideo::new(chat_id, video, caption))
|
||||
}
|
||||
|
||||
type SendAnimation = MultipartRequest<payloads::SendAnimation>;
|
||||
|
||||
fn send_animation<Ch, Ca>(
|
||||
&self,
|
||||
chat_id: Ch,
|
||||
animation: InputFile,
|
||||
caption: Ca,
|
||||
) -> Self::SendAnimation
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>,
|
||||
{
|
||||
Self::SendAnimation::new(
|
||||
self.clone(),
|
||||
payloads::SendAnimation::new(chat_id, animation, caption),
|
||||
)
|
||||
}
|
||||
|
||||
type SendVoice = MultipartRequest<payloads::SendVoice>;
|
||||
|
||||
fn send_voice<Ch, Ca>(&self, chat_id: Ch, voice: InputFile, caption: Ca) -> Self::SendVoice
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>,
|
||||
{
|
||||
Self::SendVoice::new(self.clone(), payloads::SendVoice::new(chat_id, voice, caption))
|
||||
}
|
||||
|
||||
type SendVideoNote = MultipartRequest<payloads::SendVideoNote>;
|
||||
|
||||
fn send_video_note<C>(&self, chat_id: C, video_note: InputFile) -> Self::SendVideoNote
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SendVideoNote::new(self.clone(), payloads::SendVideoNote::new(chat_id, video_note))
|
||||
}
|
||||
|
||||
type SendMediaGroup = MultipartRequest<payloads::SendMediaGroup>;
|
||||
|
||||
fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroup
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
M: IntoIterator<Item = InputMedia>,
|
||||
{
|
||||
Self::SendMediaGroup::new(self.clone(), payloads::SendMediaGroup::new(chat_id, media))
|
||||
}
|
||||
|
||||
type SendLocation = JsonRequest<payloads::SendLocation>;
|
||||
|
||||
fn send_location<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
live_period: u32,
|
||||
) -> Self::SendLocation
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SendLocation::new(
|
||||
self.clone(),
|
||||
payloads::SendLocation::new(chat_id, latitude, longitude, live_period),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageLiveLocation = JsonRequest<payloads::EditMessageLiveLocation>;
|
||||
|
||||
fn edit_message_live_location<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> Self::EditMessageLiveLocation
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::EditMessageLiveLocation::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageLiveLocation::new(chat_id, message_id, latitude, longitude),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageLiveLocationInline = JsonRequest<payloads::EditMessageLiveLocationInline>;
|
||||
|
||||
fn edit_message_live_location_inline<I>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> Self::EditMessageLiveLocationInline
|
||||
where
|
||||
I: Into<String>,
|
||||
{
|
||||
Self::EditMessageLiveLocationInline::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageLiveLocationInline::new(inline_message_id, latitude, longitude),
|
||||
)
|
||||
}
|
||||
|
||||
type StopMessageLiveLocation = JsonRequest<payloads::StopMessageLiveLocation>;
|
||||
|
||||
fn stop_message_live_location<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> Self::StopMessageLiveLocation
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::StopMessageLiveLocation::new(
|
||||
self.clone(),
|
||||
payloads::StopMessageLiveLocation::new(chat_id, message_id, latitude, longitude),
|
||||
)
|
||||
}
|
||||
|
||||
type StopMessageLiveLocationInline = JsonRequest<payloads::StopMessageLiveLocationInline>;
|
||||
|
||||
fn stop_message_live_location_inline<I>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> Self::StopMessageLiveLocationInline
|
||||
where
|
||||
I: Into<String>,
|
||||
{
|
||||
Self::StopMessageLiveLocationInline::new(
|
||||
self.clone(),
|
||||
payloads::StopMessageLiveLocationInline::new(inline_message_id, latitude, longitude),
|
||||
)
|
||||
}
|
||||
|
||||
type SendVenue = JsonRequest<payloads::SendVenue>;
|
||||
|
||||
fn send_venue<C, T, A>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
title: T,
|
||||
address: A,
|
||||
) -> Self::SendVenue
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>,
|
||||
A: Into<String>,
|
||||
{
|
||||
Self::SendVenue::new(
|
||||
self.clone(),
|
||||
payloads::SendVenue::new(chat_id, latitude, longitude, title, address),
|
||||
)
|
||||
}
|
||||
|
||||
type SendContact = JsonRequest<payloads::SendContact>;
|
||||
|
||||
fn send_contact<C>(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SendContact::new(
|
||||
self.clone(),
|
||||
payloads::SendContact::new(chat_id, phone_number, first_name),
|
||||
)
|
||||
}
|
||||
|
||||
type SendPoll = JsonRequest<payloads::SendPoll>;
|
||||
|
||||
fn send_poll<C, Q, O>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
question: Q,
|
||||
options: O,
|
||||
type_: crate::types::PollType,
|
||||
) -> Self::SendPoll
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
Q: Into<String>,
|
||||
O: IntoIterator<Item = String>,
|
||||
{
|
||||
Self::SendPoll::new(
|
||||
self.clone(),
|
||||
payloads::SendPoll::new(chat_id, question, options, type_),
|
||||
)
|
||||
}
|
||||
|
||||
type SendDice = JsonRequest<payloads::SendDice>;
|
||||
|
||||
fn send_dice<C>(&self, chat_id: C, emoji: crate::types::DiceEmoji) -> Self::SendDice
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SendDice::new(self.clone(), payloads::SendDice::new(chat_id, emoji))
|
||||
}
|
||||
|
||||
type SendChatAction = JsonRequest<payloads::SendChatAction>;
|
||||
|
||||
fn send_chat_action<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
action: crate::types::ChatAction,
|
||||
) -> Self::SendChatAction
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SendChatAction::new(self.clone(), payloads::SendChatAction::new(chat_id, action))
|
||||
}
|
||||
|
||||
type GetUserProfilePhotos = JsonRequest<payloads::GetUserProfilePhotos>;
|
||||
|
||||
fn get_user_profile_photos(&self, user_id: i32) -> Self::GetUserProfilePhotos {
|
||||
Self::GetUserProfilePhotos::new(self.clone(), payloads::GetUserProfilePhotos::new(user_id))
|
||||
}
|
||||
|
||||
type GetFile = JsonRequest<payloads::GetFile>;
|
||||
|
||||
fn get_file<F>(&self, file_id: F) -> Self::GetFile
|
||||
where
|
||||
F: Into<String>,
|
||||
{
|
||||
Self::GetFile::new(self.clone(), payloads::GetFile::new(file_id))
|
||||
}
|
||||
|
||||
type KickChatMember = JsonRequest<payloads::KickChatMember>;
|
||||
|
||||
fn kick_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::KickChatMember
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::KickChatMember::new(self.clone(), payloads::KickChatMember::new(chat_id, user_id))
|
||||
}
|
||||
|
||||
type UnbanChatMember = JsonRequest<payloads::UnbanChatMember>;
|
||||
|
||||
fn unban_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::UnbanChatMember
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::UnbanChatMember::new(self.clone(), payloads::UnbanChatMember::new(chat_id, user_id))
|
||||
}
|
||||
|
||||
type RestrictChatMember = JsonRequest<payloads::RestrictChatMember>;
|
||||
|
||||
fn restrict_chat_member<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
user_id: i32,
|
||||
permissions: ChatPermissions,
|
||||
) -> Self::RestrictChatMember
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::RestrictChatMember::new(
|
||||
self.clone(),
|
||||
payloads::RestrictChatMember::new(chat_id, user_id, permissions),
|
||||
)
|
||||
}
|
||||
|
||||
type PromoteChatMember = JsonRequest<payloads::PromoteChatMember>;
|
||||
|
||||
fn promote_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::PromoteChatMember
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::PromoteChatMember::new(
|
||||
self.clone(),
|
||||
payloads::PromoteChatMember::new(chat_id, user_id),
|
||||
)
|
||||
}
|
||||
|
||||
type SetChatAdministratorCustomTitle = JsonRequest<payloads::SetChatAdministratorCustomTitle>;
|
||||
|
||||
fn set_chat_administrator_custom_title<Ch, Cu>(
|
||||
&self,
|
||||
chat_id: Ch,
|
||||
user_id: i32,
|
||||
custom_title: Cu,
|
||||
) -> Self::SetChatAdministratorCustomTitle
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Cu: Into<String>,
|
||||
{
|
||||
Self::SetChatAdministratorCustomTitle::new(
|
||||
self.clone(),
|
||||
payloads::SetChatAdministratorCustomTitle::new(chat_id, user_id, custom_title),
|
||||
)
|
||||
}
|
||||
|
||||
type SetChatPermissions = JsonRequest<payloads::SetChatPermissions>;
|
||||
|
||||
fn set_chat_permissions<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
permissions: ChatPermissions,
|
||||
) -> Self::SetChatPermissions
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SetChatPermissions::new(
|
||||
self.clone(),
|
||||
payloads::SetChatPermissions::new(chat_id, permissions),
|
||||
)
|
||||
}
|
||||
|
||||
type ExportChatInviteLink = JsonRequest<payloads::ExportChatInviteLink>;
|
||||
|
||||
fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLink
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::ExportChatInviteLink::new(self.clone(), payloads::ExportChatInviteLink::new(chat_id))
|
||||
}
|
||||
|
||||
type SetChatPhoto = MultipartRequest<payloads::SetChatPhoto>;
|
||||
|
||||
fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SetChatPhoto::new(self.clone(), payloads::SetChatPhoto::new(chat_id, photo))
|
||||
}
|
||||
|
||||
type DeleteChatPhoto = JsonRequest<payloads::DeleteChatPhoto>;
|
||||
|
||||
fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhoto
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::DeleteChatPhoto::new(self.clone(), payloads::DeleteChatPhoto::new(chat_id))
|
||||
}
|
||||
|
||||
type SetChatTitle = JsonRequest<payloads::SetChatTitle>;
|
||||
|
||||
fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitle
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>,
|
||||
{
|
||||
Self::SetChatTitle::new(self.clone(), payloads::SetChatTitle::new(chat_id, title))
|
||||
}
|
||||
|
||||
type SetChatDescription = JsonRequest<payloads::SetChatDescription>;
|
||||
|
||||
fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescription
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SetChatDescription::new(self.clone(), payloads::SetChatDescription::new(chat_id))
|
||||
}
|
||||
|
||||
type PinChatMessage = JsonRequest<payloads::PinChatMessage>;
|
||||
|
||||
fn pin_chat_message<C>(&self, chat_id: C, message_id: i32) -> Self::PinChatMessage
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::PinChatMessage::new(self.clone(), payloads::PinChatMessage::new(chat_id, message_id))
|
||||
}
|
||||
|
||||
type UnpinChatMessage = JsonRequest<payloads::UnpinChatMessage>;
|
||||
|
||||
fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessage
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::UnpinChatMessage::new(self.clone(), payloads::UnpinChatMessage::new(chat_id))
|
||||
}
|
||||
|
||||
type LeaveChat = JsonRequest<payloads::LeaveChat>;
|
||||
|
||||
fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChat
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::LeaveChat::new(self.clone(), payloads::LeaveChat::new(chat_id))
|
||||
}
|
||||
|
||||
type GetChat = JsonRequest<payloads::GetChat>;
|
||||
|
||||
fn get_chat<C>(&self, chat_id: C) -> Self::GetChat
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::GetChat::new(self.clone(), payloads::GetChat::new(chat_id))
|
||||
}
|
||||
|
||||
type GetChatAdministrators = JsonRequest<payloads::GetChatAdministrators>;
|
||||
|
||||
fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministrators
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::GetChatAdministrators::new(
|
||||
self.clone(),
|
||||
payloads::GetChatAdministrators::new(chat_id),
|
||||
)
|
||||
}
|
||||
|
||||
type GetChatMembersCount = JsonRequest<payloads::GetChatMembersCount>;
|
||||
|
||||
fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCount
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::GetChatMembersCount::new(self.clone(), payloads::GetChatMembersCount::new(chat_id))
|
||||
}
|
||||
|
||||
type GetChatMember = JsonRequest<payloads::GetChatMember>;
|
||||
|
||||
fn get_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::GetChatMember
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::GetChatMember::new(self.clone(), payloads::GetChatMember::new(chat_id, user_id))
|
||||
}
|
||||
|
||||
type SetChatStickerSet = JsonRequest<payloads::SetChatStickerSet>;
|
||||
|
||||
fn set_chat_sticker_set<C, S>(&self, chat_id: C, sticker_set_name: S) -> Self::SetChatStickerSet
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
S: Into<String>,
|
||||
{
|
||||
Self::SetChatStickerSet::new(
|
||||
self.clone(),
|
||||
payloads::SetChatStickerSet::new(chat_id, sticker_set_name),
|
||||
)
|
||||
}
|
||||
|
||||
type DeleteChatStickerSet = JsonRequest<payloads::DeleteChatStickerSet>;
|
||||
|
||||
fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSet
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::DeleteChatStickerSet::new(self.clone(), payloads::DeleteChatStickerSet::new(chat_id))
|
||||
}
|
||||
|
||||
type AnswerCallbackQuery = JsonRequest<payloads::AnswerCallbackQuery>;
|
||||
|
||||
fn answer_callback_query<C>(&self, callback_query_id: C) -> Self::AnswerCallbackQuery
|
||||
where
|
||||
C: Into<String>,
|
||||
{
|
||||
Self::AnswerCallbackQuery::new(
|
||||
self.clone(),
|
||||
payloads::AnswerCallbackQuery::new(callback_query_id),
|
||||
)
|
||||
}
|
||||
|
||||
type SetMyCommands = JsonRequest<payloads::SetMyCommands>;
|
||||
|
||||
fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands
|
||||
where
|
||||
C: IntoIterator<Item = BotCommand>,
|
||||
{
|
||||
Self::SetMyCommands::new(self.clone(), payloads::SetMyCommands::new(commands))
|
||||
}
|
||||
|
||||
type GetMyCommands = JsonRequest<payloads::GetMyCommands>;
|
||||
|
||||
fn get_my_commands(&self) -> Self::GetMyCommands {
|
||||
Self::GetMyCommands::new(self.clone(), payloads::GetMyCommands::new())
|
||||
}
|
||||
|
||||
type AnswerInlineQuery = JsonRequest<payloads::AnswerInlineQuery>;
|
||||
|
||||
fn answer_inline_query<I, R>(&self, inline_query_id: I, results: R) -> Self::AnswerInlineQuery
|
||||
where
|
||||
I: Into<String>,
|
||||
R: IntoIterator<Item = InlineQueryResult>,
|
||||
{
|
||||
Self::AnswerInlineQuery::new(
|
||||
self.clone(),
|
||||
payloads::AnswerInlineQuery::new(inline_query_id, results),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageText = JsonRequest<payloads::EditMessageText>;
|
||||
|
||||
fn edit_message_text<C, T>(&self, chat_id: C, message_id: i32, text: T) -> Self::EditMessageText
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>,
|
||||
{
|
||||
Self::EditMessageText::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageText::new(chat_id, message_id, text),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageTextInline = JsonRequest<payloads::EditMessageTextInline>;
|
||||
|
||||
fn edit_message_text_inline<I, T>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
text: T,
|
||||
) -> Self::EditMessageTextInline
|
||||
where
|
||||
I: Into<String>,
|
||||
T: Into<String>,
|
||||
{
|
||||
Self::EditMessageTextInline::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageTextInline::new(inline_message_id, text),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageCaption = JsonRequest<payloads::EditMessageCaption>;
|
||||
|
||||
fn edit_message_caption<Ch, Ca>(
|
||||
&self,
|
||||
chat_id: Ch,
|
||||
message_id: i32,
|
||||
caption: Ca,
|
||||
) -> Self::EditMessageCaption
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>,
|
||||
{
|
||||
Self::EditMessageCaption::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageCaption::new(chat_id, message_id, caption),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageCaptionInline = JsonRequest<payloads::EditMessageCaptionInline>;
|
||||
|
||||
fn edit_message_caption_inline<I, C>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
caption: C,
|
||||
) -> Self::EditMessageCaptionInline
|
||||
where
|
||||
I: Into<String>,
|
||||
C: Into<String>,
|
||||
{
|
||||
Self::EditMessageCaptionInline::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageCaptionInline::new(inline_message_id, caption),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageMedia = MultipartRequest<payloads::EditMessageMedia>;
|
||||
|
||||
fn edit_message_media<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
media: InputMedia,
|
||||
) -> Self::EditMessageMedia
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::EditMessageMedia::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageMedia::new(chat_id, message_id, media),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageMediaInline = MultipartRequest<payloads::EditMessageMediaInline>;
|
||||
|
||||
fn edit_message_media_inline<I>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
media: InputMedia,
|
||||
) -> Self::EditMessageMediaInline
|
||||
where
|
||||
I: Into<String>,
|
||||
{
|
||||
Self::EditMessageMediaInline::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageMediaInline::new(inline_message_id, media),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageReplyMarkup = JsonRequest<payloads::EditMessageReplyMarkup>;
|
||||
|
||||
fn edit_message_reply_markup<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
) -> Self::EditMessageReplyMarkup
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::EditMessageReplyMarkup::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageReplyMarkup::new(chat_id, message_id),
|
||||
)
|
||||
}
|
||||
|
||||
type EditMessageReplyMarkupInline = JsonRequest<payloads::EditMessageReplyMarkupInline>;
|
||||
|
||||
fn edit_message_reply_markup_inline<I>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
) -> Self::EditMessageReplyMarkupInline
|
||||
where
|
||||
I: Into<String>,
|
||||
{
|
||||
Self::EditMessageReplyMarkupInline::new(
|
||||
self.clone(),
|
||||
payloads::EditMessageReplyMarkupInline::new(inline_message_id),
|
||||
)
|
||||
}
|
||||
|
||||
type StopPoll = JsonRequest<payloads::StopPoll>;
|
||||
|
||||
fn stop_poll<C>(&self, chat_id: C, message_id: i32) -> Self::StopPoll
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::StopPoll::new(self.clone(), payloads::StopPoll::new(chat_id, message_id))
|
||||
}
|
||||
|
||||
type DeleteMessage = JsonRequest<payloads::DeleteMessage>;
|
||||
|
||||
fn delete_message<C>(&self, chat_id: C, message_id: i32) -> Self::DeleteMessage
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::DeleteMessage::new(self.clone(), payloads::DeleteMessage::new(chat_id, message_id))
|
||||
}
|
||||
|
||||
type SendSticker = MultipartRequest<payloads::SendSticker>;
|
||||
|
||||
fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
{
|
||||
Self::SendSticker::new(self.clone(), payloads::SendSticker::new(chat_id, sticker))
|
||||
}
|
||||
|
||||
type GetStickerSet = JsonRequest<payloads::GetStickerSet>;
|
||||
|
||||
fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSet
|
||||
where
|
||||
N: Into<String>,
|
||||
{
|
||||
Self::GetStickerSet::new(self.clone(), payloads::GetStickerSet::new(name))
|
||||
}
|
||||
|
||||
type UploadStickerFile = MultipartRequest<payloads::UploadStickerFile>;
|
||||
|
||||
fn upload_sticker_file(&self, user_id: i32, png_sticker: InputFile) -> Self::UploadStickerFile where
|
||||
{
|
||||
Self::UploadStickerFile::new(
|
||||
self.clone(),
|
||||
payloads::UploadStickerFile::new(user_id, png_sticker),
|
||||
)
|
||||
}
|
||||
|
||||
type CreateNewStickerSet = JsonRequest<payloads::CreateNewStickerSet>;
|
||||
|
||||
fn create_new_sticker_set<N, T, E>(
|
||||
&self,
|
||||
user_id: i32,
|
||||
name: N,
|
||||
title: T,
|
||||
emojis: E,
|
||||
) -> Self::CreateNewStickerSet
|
||||
where
|
||||
N: Into<String>,
|
||||
T: Into<String>,
|
||||
E: Into<String>,
|
||||
{
|
||||
Self::CreateNewStickerSet::new(
|
||||
self.clone(),
|
||||
payloads::CreateNewStickerSet::new(user_id, name, title, emojis),
|
||||
)
|
||||
}
|
||||
|
||||
type AddStickerToSet = MultipartRequest<payloads::AddStickerToSet>;
|
||||
|
||||
fn add_sticker_to_set<N, E>(
|
||||
&self,
|
||||
user_id: i32,
|
||||
name: N,
|
||||
sticker: InputSticker,
|
||||
emojis: E,
|
||||
) -> Self::AddStickerToSet
|
||||
where
|
||||
N: Into<String>,
|
||||
E: Into<String>,
|
||||
{
|
||||
Self::AddStickerToSet::new(
|
||||
self.clone(),
|
||||
payloads::AddStickerToSet::new(user_id, name, sticker, emojis),
|
||||
)
|
||||
}
|
||||
|
||||
type SetStickerPositionInSet = JsonRequest<payloads::SetStickerPositionInSet>;
|
||||
|
||||
fn set_sticker_position_in_set<S>(
|
||||
&self,
|
||||
sticker: S,
|
||||
position: u32,
|
||||
) -> Self::SetStickerPositionInSet
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self::SetStickerPositionInSet::new(
|
||||
self.clone(),
|
||||
payloads::SetStickerPositionInSet::new(sticker, position),
|
||||
)
|
||||
}
|
||||
|
||||
type DeleteStickerFromSet = JsonRequest<payloads::DeleteStickerFromSet>;
|
||||
|
||||
fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSet
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self::DeleteStickerFromSet::new(self.clone(), payloads::DeleteStickerFromSet::new(sticker))
|
||||
}
|
||||
|
||||
type SetStickerSetThumb = MultipartRequest<payloads::SetStickerSetThumb>;
|
||||
|
||||
fn set_sticker_set_thumb<N>(&self, name: N, user_id: i32) -> Self::SetStickerSetThumb
|
||||
where
|
||||
N: Into<String>,
|
||||
{
|
||||
Self::SetStickerSetThumb::new(
|
||||
self.clone(),
|
||||
payloads::SetStickerSetThumb::new(name, user_id),
|
||||
)
|
||||
}
|
||||
|
||||
type SendInvoice = JsonRequest<payloads::SendInvoice>;
|
||||
|
||||
fn send_invoice<T, D, Pa, P, S, C, Pri>(
|
||||
&self,
|
||||
chat_id: i32,
|
||||
title: T,
|
||||
description: D,
|
||||
payload: Pa,
|
||||
provider_token: P,
|
||||
start_parameter: S,
|
||||
currency: C,
|
||||
prices: Pri,
|
||||
) -> Self::SendInvoice
|
||||
where
|
||||
T: Into<String>,
|
||||
D: Into<String>,
|
||||
Pa: Into<String>,
|
||||
P: Into<String>,
|
||||
S: Into<String>,
|
||||
C: Into<String>,
|
||||
Pri: IntoIterator<Item = LabeledPrice>,
|
||||
{
|
||||
Self::SendInvoice::new(
|
||||
self.clone(),
|
||||
payloads::SendInvoice::new(
|
||||
chat_id,
|
||||
title,
|
||||
description,
|
||||
payload,
|
||||
provider_token,
|
||||
start_parameter,
|
||||
currency,
|
||||
prices,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
type AnswerShippingQuery = JsonRequest<payloads::AnswerShippingQuery>;
|
||||
|
||||
fn answer_shipping_query<S>(&self, shipping_query_id: S, ok: bool) -> Self::AnswerShippingQuery
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self::AnswerShippingQuery::new(
|
||||
self.clone(),
|
||||
payloads::AnswerShippingQuery::new(shipping_query_id, ok),
|
||||
)
|
||||
}
|
||||
|
||||
type AnswerPreCheckoutQuery = JsonRequest<payloads::AnswerPreCheckoutQuery>;
|
||||
|
||||
fn answer_pre_checkout_query<P>(
|
||||
&self,
|
||||
pre_checkout_query_id: P,
|
||||
ok: bool,
|
||||
) -> Self::AnswerPreCheckoutQuery
|
||||
where
|
||||
P: Into<String>,
|
||||
{
|
||||
Self::AnswerPreCheckoutQuery::new(
|
||||
self.clone(),
|
||||
payloads::AnswerPreCheckoutQuery::new(pre_checkout_query_id, ok),
|
||||
)
|
||||
}
|
||||
|
||||
type SetPassportDataErrors = JsonRequest<payloads::SetPassportDataErrors>;
|
||||
|
||||
fn set_passport_data_errors<E>(&self, user_id: i32, errors: E) -> Self::SetPassportDataErrors
|
||||
where
|
||||
E: IntoIterator<Item = crate::types::PassportElementError>,
|
||||
{
|
||||
Self::SetPassportDataErrors::new(
|
||||
self.clone(),
|
||||
payloads::SetPassportDataErrors::new(user_id, errors),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -365,3 +365,633 @@ macro_rules! impl_payload {
|
|||
$e
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_use]
|
||||
// This macro is auto generated by `cg` <https://github.com/teloxide/cg> (a8fa55a).
|
||||
// **DO NOT EDIT THIS MACRO**,
|
||||
// edit `cg` instead.
|
||||
macro_rules! requester_forward {
|
||||
($i:ident $(, $rest:ident )* $(,)? => $body:ident, $ty:ident ) => {
|
||||
requester_forward!(@method $i $body $ty);
|
||||
$(
|
||||
requester_forward!(@method $rest $body $ty);
|
||||
)*
|
||||
};
|
||||
|
||||
|
||||
(@method get_updates $body:ident $ty:ident) => {
|
||||
type GetUpdates = $ty![GetUpdates];
|
||||
|
||||
fn get_updates(&self) -> Self::GetUpdates {
|
||||
let this = self;
|
||||
$body!(get_updates this ())
|
||||
}
|
||||
};
|
||||
(@method set_webhook $body:ident $ty:ident) => {
|
||||
type SetWebhook = $ty![SetWebhook];
|
||||
|
||||
fn set_webhook<U, A>(&self, url: U, allowed_updates: A) -> Self::SetWebhook where U: Into<String>,
|
||||
A: IntoIterator<Item = AllowedUpdate> {
|
||||
let this = self;
|
||||
$body!(set_webhook this (url: U, allowed_updates: A))
|
||||
}
|
||||
};
|
||||
(@method delete_webhook $body:ident $ty:ident) => {
|
||||
type DeleteWebhook = $ty![DeleteWebhook];
|
||||
|
||||
fn delete_webhook(&self) -> Self::DeleteWebhook {
|
||||
let this = self;
|
||||
$body!(delete_webhook this ())
|
||||
}
|
||||
};
|
||||
(@method get_webhook_info $body:ident $ty:ident) => {
|
||||
type GetWebhookInfo = $ty![GetWebhookInfo];
|
||||
|
||||
fn get_webhook_info(&self) -> Self::GetWebhookInfo {
|
||||
let this = self;
|
||||
$body!(get_webhook_info this ())
|
||||
}
|
||||
};
|
||||
(@method get_me $body:ident $ty:ident) => {
|
||||
type GetMe = $ty![GetMe];
|
||||
|
||||
fn get_me(&self) -> Self::GetMe {
|
||||
let this = self;
|
||||
$body!(get_me this ())
|
||||
}
|
||||
};
|
||||
(@method send_message $body:ident $ty:ident) => {
|
||||
type SendMessage = $ty![SendMessage];
|
||||
|
||||
fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage where C: Into<ChatId>,
|
||||
T: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_message this (chat_id: C, text: T))
|
||||
}
|
||||
};
|
||||
(@method forward_message $body:ident $ty:ident) => {
|
||||
type ForwardMessage = $ty![ForwardMessage];
|
||||
|
||||
fn forward_message<C, F>(&self, chat_id: C, from_chat_id: F, message_id: i32) -> Self::ForwardMessage where C: Into<ChatId>,
|
||||
F: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(forward_message this (chat_id: C, from_chat_id: F, message_id: i32))
|
||||
}
|
||||
};
|
||||
(@method send_photo $body:ident $ty:ident) => {
|
||||
type SendPhoto = $ty![SendPhoto];
|
||||
|
||||
fn send_photo<Ch, Ca>(&self, chat_id: Ch, photo: InputFile, caption: Ca) -> Self::SendPhoto where Ch: Into<ChatId>,
|
||||
Ca: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_photo this (chat_id: Ch, photo: InputFile, caption: Ca))
|
||||
}
|
||||
};
|
||||
(@method send_audio $body:ident $ty:ident) => {
|
||||
type SendAudio = $ty![SendAudio];
|
||||
|
||||
fn send_audio<Ch, Ca>(&self, chat_id: Ch, audio: InputFile, caption: Ca) -> Self::SendAudio where Ch: Into<ChatId>,
|
||||
Ca: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_audio this (chat_id: Ch, audio: InputFile, caption: Ca))
|
||||
}
|
||||
};
|
||||
(@method send_document $body:ident $ty:ident) => {
|
||||
type SendDocument = $ty![SendDocument];
|
||||
|
||||
fn send_document<Ch, Ca>(&self, chat_id: Ch, document: InputFile, caption: Ca) -> Self::SendDocument where Ch: Into<ChatId>,
|
||||
Ca: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_document this (chat_id: Ch, document: InputFile, caption: Ca))
|
||||
}
|
||||
};
|
||||
(@method send_video $body:ident $ty:ident) => {
|
||||
type SendVideo = $ty![SendVideo];
|
||||
|
||||
fn send_video<Ch, Ca>(&self, chat_id: Ch, video: InputFile, caption: Ca) -> Self::SendVideo where Ch: Into<ChatId>,
|
||||
Ca: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_video this (chat_id: Ch, video: InputFile, caption: Ca))
|
||||
}
|
||||
};
|
||||
(@method send_animation $body:ident $ty:ident) => {
|
||||
type SendAnimation = $ty![SendAnimation];
|
||||
|
||||
fn send_animation<Ch, Ca>(&self, chat_id: Ch, animation: InputFile, caption: Ca) -> Self::SendAnimation where Ch: Into<ChatId>,
|
||||
Ca: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_animation this (chat_id: Ch, animation: InputFile, caption: Ca))
|
||||
}
|
||||
};
|
||||
(@method send_voice $body:ident $ty:ident) => {
|
||||
type SendVoice = $ty![SendVoice];
|
||||
|
||||
fn send_voice<Ch, Ca>(&self, chat_id: Ch, voice: InputFile, caption: Ca) -> Self::SendVoice where Ch: Into<ChatId>,
|
||||
Ca: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_voice this (chat_id: Ch, voice: InputFile, caption: Ca))
|
||||
}
|
||||
};
|
||||
(@method send_video_note $body:ident $ty:ident) => {
|
||||
type SendVideoNote = $ty![SendVideoNote];
|
||||
|
||||
fn send_video_note<C>(&self, chat_id: C, video_note: InputFile) -> Self::SendVideoNote where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(send_video_note this (chat_id: C, video_note: InputFile))
|
||||
}
|
||||
};
|
||||
(@method send_media_group $body:ident $ty:ident) => {
|
||||
type SendMediaGroup = $ty![SendMediaGroup];
|
||||
|
||||
fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroup where C: Into<ChatId>,
|
||||
M: IntoIterator<Item = InputMedia> {
|
||||
let this = self;
|
||||
$body!(send_media_group this (chat_id: C, media: M))
|
||||
}
|
||||
};
|
||||
(@method send_location $body:ident $ty:ident) => {
|
||||
type SendLocation = $ty![SendLocation];
|
||||
|
||||
fn send_location<C>(&self, chat_id: C, latitude: f64, longitude: f64, live_period: u32) -> Self::SendLocation where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(send_location this (chat_id: C, latitude: f64, longitude: f64, live_period: u32))
|
||||
}
|
||||
};
|
||||
(@method edit_message_live_location $body:ident $ty:ident) => {
|
||||
type EditMessageLiveLocation = $ty![EditMessageLiveLocation];
|
||||
|
||||
fn edit_message_live_location<C>(&self, chat_id: C, message_id: i32, latitude: f64, longitude: f64) -> Self::EditMessageLiveLocation where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(edit_message_live_location this (chat_id: C, message_id: i32, latitude: f64, longitude: f64))
|
||||
}
|
||||
};
|
||||
(@method edit_message_live_location_inline $body:ident $ty:ident) => {
|
||||
type EditMessageLiveLocationInline = $ty![EditMessageLiveLocationInline];
|
||||
|
||||
fn edit_message_live_location_inline<I>(&self, inline_message_id: I, latitude: f64, longitude: f64) -> Self::EditMessageLiveLocationInline where I: Into<String> {
|
||||
let this = self;
|
||||
$body!(edit_message_live_location_inline this (inline_message_id: I, latitude: f64, longitude: f64))
|
||||
}
|
||||
};
|
||||
(@method stop_message_live_location $body:ident $ty:ident) => {
|
||||
type StopMessageLiveLocation = $ty![StopMessageLiveLocation];
|
||||
|
||||
fn stop_message_live_location<C>(&self, chat_id: C, message_id: i32, latitude: f64, longitude: f64) -> Self::StopMessageLiveLocation where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(stop_message_live_location this (chat_id: C, message_id: i32, latitude: f64, longitude: f64))
|
||||
}
|
||||
};
|
||||
(@method stop_message_live_location_inline $body:ident $ty:ident) => {
|
||||
type StopMessageLiveLocationInline = $ty![StopMessageLiveLocationInline];
|
||||
|
||||
fn stop_message_live_location_inline<I>(&self, inline_message_id: I, latitude: f64, longitude: f64) -> Self::StopMessageLiveLocationInline where I: Into<String> {
|
||||
let this = self;
|
||||
$body!(stop_message_live_location_inline this (inline_message_id: I, latitude: f64, longitude: f64))
|
||||
}
|
||||
};
|
||||
(@method send_venue $body:ident $ty:ident) => {
|
||||
type SendVenue = $ty![SendVenue];
|
||||
|
||||
fn send_venue<C, T, A>(&self, chat_id: C, latitude: f64, longitude: f64, title: T, address: A) -> Self::SendVenue where C: Into<ChatId>,
|
||||
T: Into<String>,
|
||||
A: Into<String> {
|
||||
let this = self;
|
||||
$body!(send_venue this (chat_id: C, latitude: f64, longitude: f64, title: T, address: A))
|
||||
}
|
||||
};
|
||||
(@method send_contact $body:ident $ty:ident) => {
|
||||
type SendContact = $ty![SendContact];
|
||||
|
||||
fn send_contact<C>(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(send_contact this (chat_id: C, phone_number: f64, first_name: f64))
|
||||
}
|
||||
};
|
||||
(@method send_poll $body:ident $ty:ident) => {
|
||||
type SendPoll = $ty![SendPoll];
|
||||
|
||||
fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O, type_: PollType) -> Self::SendPoll where C: Into<ChatId>,
|
||||
Q: Into<String>,
|
||||
O: IntoIterator<Item = String> {
|
||||
let this = self;
|
||||
$body!(send_poll this (chat_id: C, question: Q, options: O, type_: PollType))
|
||||
}
|
||||
};
|
||||
(@method send_dice $body:ident $ty:ident) => {
|
||||
type SendDice = $ty![SendDice];
|
||||
|
||||
fn send_dice<C>(&self, chat_id: C, emoji: DiceEmoji) -> Self::SendDice where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(send_dice this (chat_id: C, emoji: DiceEmoji))
|
||||
}
|
||||
};
|
||||
(@method send_chat_action $body:ident $ty:ident) => {
|
||||
type SendChatAction = $ty![SendChatAction];
|
||||
|
||||
fn send_chat_action<C>(&self, chat_id: C, action: ChatAction) -> Self::SendChatAction where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(send_chat_action this (chat_id: C, action: ChatAction))
|
||||
}
|
||||
};
|
||||
(@method get_user_profile_photos $body:ident $ty:ident) => {
|
||||
type GetUserProfilePhotos = $ty![GetUserProfilePhotos];
|
||||
|
||||
fn get_user_profile_photos(&self, user_id: i32) -> Self::GetUserProfilePhotos {
|
||||
let this = self;
|
||||
$body!(get_user_profile_photos this (user_id: i32))
|
||||
}
|
||||
};
|
||||
(@method get_file $body:ident $ty:ident) => {
|
||||
type GetFile = $ty![GetFile];
|
||||
|
||||
fn get_file<F>(&self, file_id: F) -> Self::GetFile where F: Into<String> {
|
||||
let this = self;
|
||||
$body!(get_file this (file_id: F))
|
||||
}
|
||||
};
|
||||
(@method kick_chat_member $body:ident $ty:ident) => {
|
||||
type KickChatMember = $ty![KickChatMember];
|
||||
|
||||
fn kick_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::KickChatMember where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(kick_chat_member this (chat_id: C, user_id: i32))
|
||||
}
|
||||
};
|
||||
(@method unban_chat_member $body:ident $ty:ident) => {
|
||||
type UnbanChatMember = $ty![UnbanChatMember];
|
||||
|
||||
fn unban_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::UnbanChatMember where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(unban_chat_member this (chat_id: C, user_id: i32))
|
||||
}
|
||||
};
|
||||
(@method restrict_chat_member $body:ident $ty:ident) => {
|
||||
type RestrictChatMember = $ty![RestrictChatMember];
|
||||
|
||||
fn restrict_chat_member<C>(&self, chat_id: C, user_id: i32, permissions: ChatPermissions) -> Self::RestrictChatMember where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(restrict_chat_member this (chat_id: C, user_id: i32, permissions: ChatPermissions))
|
||||
}
|
||||
};
|
||||
(@method promote_chat_member $body:ident $ty:ident) => {
|
||||
type PromoteChatMember = $ty![PromoteChatMember];
|
||||
|
||||
fn promote_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::PromoteChatMember where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(promote_chat_member this (chat_id: C, user_id: i32))
|
||||
}
|
||||
};
|
||||
(@method set_chat_administrator_custom_title $body:ident $ty:ident) => {
|
||||
type SetChatAdministratorCustomTitle = $ty![SetChatAdministratorCustomTitle];
|
||||
|
||||
fn set_chat_administrator_custom_title<Ch, Cu>(&self, chat_id: Ch, user_id: i32, custom_title: Cu) -> Self::SetChatAdministratorCustomTitle where Ch: Into<ChatId>,
|
||||
Cu: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_chat_administrator_custom_title this (chat_id: Ch, user_id: i32, custom_title: Cu))
|
||||
}
|
||||
};
|
||||
(@method set_chat_permissions $body:ident $ty:ident) => {
|
||||
type SetChatPermissions = $ty![SetChatPermissions];
|
||||
|
||||
fn set_chat_permissions<C>(&self, chat_id: C, permissions: ChatPermissions) -> Self::SetChatPermissions where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(set_chat_permissions this (chat_id: C, permissions: ChatPermissions))
|
||||
}
|
||||
};
|
||||
(@method export_chat_invite_link $body:ident $ty:ident) => {
|
||||
type ExportChatInviteLink = $ty![ExportChatInviteLink];
|
||||
|
||||
fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLink where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(export_chat_invite_link this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method set_chat_photo $body:ident $ty:ident) => {
|
||||
type SetChatPhoto = $ty![SetChatPhoto];
|
||||
|
||||
fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(set_chat_photo this (chat_id: C, photo: InputFile))
|
||||
}
|
||||
};
|
||||
(@method delete_chat_photo $body:ident $ty:ident) => {
|
||||
type DeleteChatPhoto = $ty![DeleteChatPhoto];
|
||||
|
||||
fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhoto where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(delete_chat_photo this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method set_chat_title $body:ident $ty:ident) => {
|
||||
type SetChatTitle = $ty![SetChatTitle];
|
||||
|
||||
fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitle where C: Into<ChatId>,
|
||||
T: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_chat_title this (chat_id: C, title: T))
|
||||
}
|
||||
};
|
||||
(@method set_chat_description $body:ident $ty:ident) => {
|
||||
type SetChatDescription = $ty![SetChatDescription];
|
||||
|
||||
fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescription where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(set_chat_description this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method pin_chat_message $body:ident $ty:ident) => {
|
||||
type PinChatMessage = $ty![PinChatMessage];
|
||||
|
||||
fn pin_chat_message<C>(&self, chat_id: C, message_id: i32) -> Self::PinChatMessage where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(pin_chat_message this (chat_id: C, message_id: i32))
|
||||
}
|
||||
};
|
||||
(@method unpin_chat_message $body:ident $ty:ident) => {
|
||||
type UnpinChatMessage = $ty![UnpinChatMessage];
|
||||
|
||||
fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessage where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(unpin_chat_message this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method leave_chat $body:ident $ty:ident) => {
|
||||
type LeaveChat = $ty![LeaveChat];
|
||||
|
||||
fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChat where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(leave_chat this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method get_chat $body:ident $ty:ident) => {
|
||||
type GetChat = $ty![GetChat];
|
||||
|
||||
fn get_chat<C>(&self, chat_id: C) -> Self::GetChat where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(get_chat this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method get_chat_administrators $body:ident $ty:ident) => {
|
||||
type GetChatAdministrators = $ty![GetChatAdministrators];
|
||||
|
||||
fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministrators where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(get_chat_administrators this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method get_chat_members_count $body:ident $ty:ident) => {
|
||||
type GetChatMembersCount = $ty![GetChatMembersCount];
|
||||
|
||||
fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCount where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(get_chat_members_count this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method get_chat_member $body:ident $ty:ident) => {
|
||||
type GetChatMember = $ty![GetChatMember];
|
||||
|
||||
fn get_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::GetChatMember where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(get_chat_member this (chat_id: C, user_id: i32))
|
||||
}
|
||||
};
|
||||
(@method set_chat_sticker_set $body:ident $ty:ident) => {
|
||||
type SetChatStickerSet = $ty![SetChatStickerSet];
|
||||
|
||||
fn set_chat_sticker_set<C, S>(&self, chat_id: C, sticker_set_name: S) -> Self::SetChatStickerSet where C: Into<ChatId>,
|
||||
S: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_chat_sticker_set this (chat_id: C, sticker_set_name: S))
|
||||
}
|
||||
};
|
||||
(@method delete_chat_sticker_set $body:ident $ty:ident) => {
|
||||
type DeleteChatStickerSet = $ty![DeleteChatStickerSet];
|
||||
|
||||
fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSet where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(delete_chat_sticker_set this (chat_id: C))
|
||||
}
|
||||
};
|
||||
(@method answer_callback_query $body:ident $ty:ident) => {
|
||||
type AnswerCallbackQuery = $ty![AnswerCallbackQuery];
|
||||
|
||||
fn answer_callback_query<C>(&self, callback_query_id: C) -> Self::AnswerCallbackQuery where C: Into<String> {
|
||||
let this = self;
|
||||
$body!(answer_callback_query this (callback_query_id: C))
|
||||
}
|
||||
};
|
||||
(@method set_my_commands $body:ident $ty:ident) => {
|
||||
type SetMyCommands = $ty![SetMyCommands];
|
||||
|
||||
fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands where C: IntoIterator<Item = BotCommand> {
|
||||
let this = self;
|
||||
$body!(set_my_commands this (commands: C))
|
||||
}
|
||||
};
|
||||
(@method get_my_commands $body:ident $ty:ident) => {
|
||||
type GetMyCommands = $ty![GetMyCommands];
|
||||
|
||||
fn get_my_commands(&self) -> Self::GetMyCommands {
|
||||
let this = self;
|
||||
$body!(get_my_commands this ())
|
||||
}
|
||||
};
|
||||
(@method answer_inline_query $body:ident $ty:ident) => {
|
||||
type AnswerInlineQuery = $ty![AnswerInlineQuery];
|
||||
|
||||
fn answer_inline_query<I, R>(&self, inline_query_id: I, results: R) -> Self::AnswerInlineQuery where I: Into<String>,
|
||||
R: IntoIterator<Item = InlineQueryResult> {
|
||||
let this = self;
|
||||
$body!(answer_inline_query this (inline_query_id: I, results: R))
|
||||
}
|
||||
};
|
||||
(@method edit_message_text $body:ident $ty:ident) => {
|
||||
type EditMessageText = $ty![EditMessageText];
|
||||
|
||||
fn edit_message_text<C, T>(&self, chat_id: C, message_id: i32, text: T) -> Self::EditMessageText where C: Into<ChatId>,
|
||||
T: Into<String> {
|
||||
let this = self;
|
||||
$body!(edit_message_text this (chat_id: C, message_id: i32, text: T))
|
||||
}
|
||||
};
|
||||
(@method edit_message_text_inline $body:ident $ty:ident) => {
|
||||
type EditMessageTextInline = $ty![EditMessageTextInline];
|
||||
|
||||
fn edit_message_text_inline<I, T>(&self, inline_message_id: I, text: T) -> Self::EditMessageTextInline where I: Into<String>,
|
||||
T: Into<String> {
|
||||
let this = self;
|
||||
$body!(edit_message_text_inline this (inline_message_id: I, text: T))
|
||||
}
|
||||
};
|
||||
(@method edit_message_caption $body:ident $ty:ident) => {
|
||||
type EditMessageCaption = $ty![EditMessageCaption];
|
||||
|
||||
fn edit_message_caption<Ch, Ca>(&self, chat_id: Ch, message_id: i32, caption: Ca) -> Self::EditMessageCaption where Ch: Into<ChatId>,
|
||||
Ca: Into<String> {
|
||||
let this = self;
|
||||
$body!(edit_message_caption this (chat_id: Ch, message_id: i32, caption: Ca))
|
||||
}
|
||||
};
|
||||
(@method edit_message_caption_inline $body:ident $ty:ident) => {
|
||||
type EditMessageCaptionInline = $ty![EditMessageCaptionInline];
|
||||
|
||||
fn edit_message_caption_inline<I, C>(&self, inline_message_id: I, caption: C) -> Self::EditMessageCaptionInline where I: Into<String>,
|
||||
C: Into<String> {
|
||||
let this = self;
|
||||
$body!(edit_message_caption_inline this (inline_message_id: I, caption: C))
|
||||
}
|
||||
};
|
||||
(@method edit_message_media $body:ident $ty:ident) => {
|
||||
type EditMessageMedia = $ty![EditMessageMedia];
|
||||
|
||||
fn edit_message_media<C>(&self, chat_id: C, message_id: i32, media: InputMedia) -> Self::EditMessageMedia where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(edit_message_media this (chat_id: C, message_id: i32, media: InputMedia))
|
||||
}
|
||||
};
|
||||
(@method edit_message_media_inline $body:ident $ty:ident) => {
|
||||
type EditMessageMediaInline = $ty![EditMessageMediaInline];
|
||||
|
||||
fn edit_message_media_inline<I>(&self, inline_message_id: I, media: InputMedia) -> Self::EditMessageMediaInline where I: Into<String> {
|
||||
let this = self;
|
||||
$body!(edit_message_media_inline this (inline_message_id: I, media: InputMedia))
|
||||
}
|
||||
};
|
||||
(@method edit_message_reply_markup $body:ident $ty:ident) => {
|
||||
type EditMessageReplyMarkup = $ty![EditMessageReplyMarkup];
|
||||
|
||||
fn edit_message_reply_markup<C>(&self, chat_id: C, message_id: i32) -> Self::EditMessageReplyMarkup where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(edit_message_reply_markup this (chat_id: C, message_id: i32))
|
||||
}
|
||||
};
|
||||
(@method edit_message_reply_markup_inline $body:ident $ty:ident) => {
|
||||
type EditMessageReplyMarkupInline = $ty![EditMessageReplyMarkupInline];
|
||||
|
||||
fn edit_message_reply_markup_inline<I>(&self, inline_message_id: I) -> Self::EditMessageReplyMarkupInline where I: Into<String> {
|
||||
let this = self;
|
||||
$body!(edit_message_reply_markup_inline this (inline_message_id: I))
|
||||
}
|
||||
};
|
||||
(@method stop_poll $body:ident $ty:ident) => {
|
||||
type StopPoll = $ty![StopPoll];
|
||||
|
||||
fn stop_poll<C>(&self, chat_id: C, message_id: i32) -> Self::StopPoll where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(stop_poll this (chat_id: C, message_id: i32))
|
||||
}
|
||||
};
|
||||
(@method delete_message $body:ident $ty:ident) => {
|
||||
type DeleteMessage = $ty![DeleteMessage];
|
||||
|
||||
fn delete_message<C>(&self, chat_id: C, message_id: i32) -> Self::DeleteMessage where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(delete_message this (chat_id: C, message_id: i32))
|
||||
}
|
||||
};
|
||||
(@method send_sticker $body:ident $ty:ident) => {
|
||||
type SendSticker = $ty![SendSticker];
|
||||
|
||||
fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker where C: Into<ChatId> {
|
||||
let this = self;
|
||||
$body!(send_sticker this (chat_id: C, sticker: InputFile))
|
||||
}
|
||||
};
|
||||
(@method get_sticker_set $body:ident $ty:ident) => {
|
||||
type GetStickerSet = $ty![GetStickerSet];
|
||||
|
||||
fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSet where N: Into<String> {
|
||||
let this = self;
|
||||
$body!(get_sticker_set this (name: N))
|
||||
}
|
||||
};
|
||||
(@method upload_sticker_file $body:ident $ty:ident) => {
|
||||
type UploadStickerFile = $ty![UploadStickerFile];
|
||||
|
||||
fn upload_sticker_file(&self, user_id: i32, png_sticker: InputFile) -> Self::UploadStickerFile {
|
||||
let this = self;
|
||||
$body!(upload_sticker_file this (user_id: i32, png_sticker: InputFile))
|
||||
}
|
||||
};
|
||||
(@method create_new_sticker_set $body:ident $ty:ident) => {
|
||||
type CreateNewStickerSet = $ty![CreateNewStickerSet];
|
||||
|
||||
fn create_new_sticker_set<N, T, E>(&self, user_id: i32, name: N, title: T, emojis: E) -> Self::CreateNewStickerSet where N: Into<String>,
|
||||
T: Into<String>,
|
||||
E: Into<String> {
|
||||
let this = self;
|
||||
$body!(create_new_sticker_set this (user_id: i32, name: N, title: T, emojis: E))
|
||||
}
|
||||
};
|
||||
(@method add_sticker_to_set $body:ident $ty:ident) => {
|
||||
type AddStickerToSet = $ty![AddStickerToSet];
|
||||
|
||||
fn add_sticker_to_set<N, E>(&self, user_id: i32, name: N, sticker: InputSticker, emojis: E) -> Self::AddStickerToSet where N: Into<String>,
|
||||
E: Into<String> {
|
||||
let this = self;
|
||||
$body!(add_sticker_to_set this (user_id: i32, name: N, sticker: InputSticker, emojis: E))
|
||||
}
|
||||
};
|
||||
(@method set_sticker_position_in_set $body:ident $ty:ident) => {
|
||||
type SetStickerPositionInSet = $ty![SetStickerPositionInSet];
|
||||
|
||||
fn set_sticker_position_in_set<S>(&self, sticker: S, position: u32) -> Self::SetStickerPositionInSet where S: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_sticker_position_in_set this (sticker: S, position: u32))
|
||||
}
|
||||
};
|
||||
(@method delete_sticker_from_set $body:ident $ty:ident) => {
|
||||
type DeleteStickerFromSet = $ty![DeleteStickerFromSet];
|
||||
|
||||
fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSet where S: Into<String> {
|
||||
let this = self;
|
||||
$body!(delete_sticker_from_set this (sticker: S))
|
||||
}
|
||||
};
|
||||
(@method set_sticker_set_thumb $body:ident $ty:ident) => {
|
||||
type SetStickerSetThumb = $ty![SetStickerSetThumb];
|
||||
|
||||
fn set_sticker_set_thumb<N>(&self, name: N, user_id: i32) -> Self::SetStickerSetThumb where N: Into<String> {
|
||||
let this = self;
|
||||
$body!(set_sticker_set_thumb this (name: N, user_id: i32))
|
||||
}
|
||||
};
|
||||
(@method send_invoice $body:ident $ty:ident) => {
|
||||
type SendInvoice = $ty![SendInvoice];
|
||||
|
||||
fn send_invoice<T, D, Pa, P, S, C, Pri>(&self, chat_id: i32, title: T, description: D, payload: Pa, provider_token: P, start_parameter: S, currency: C, prices: Pri) -> Self::SendInvoice where T: Into<String>,
|
||||
D: Into<String>,
|
||||
Pa: Into<String>,
|
||||
P: Into<String>,
|
||||
S: Into<String>,
|
||||
C: Into<String>,
|
||||
Pri: IntoIterator<Item = LabeledPrice> {
|
||||
let this = self;
|
||||
$body!(send_invoice this (chat_id: i32, title: T, description: D, payload: Pa, provider_token: P, start_parameter: S, currency: C, prices: Pri))
|
||||
}
|
||||
};
|
||||
(@method answer_shipping_query $body:ident $ty:ident) => {
|
||||
type AnswerShippingQuery = $ty![AnswerShippingQuery];
|
||||
|
||||
fn answer_shipping_query<S>(&self, shipping_query_id: S, ok: bool) -> Self::AnswerShippingQuery where S: Into<String> {
|
||||
let this = self;
|
||||
$body!(answer_shipping_query this (shipping_query_id: S, ok: bool))
|
||||
}
|
||||
};
|
||||
(@method answer_pre_checkout_query $body:ident $ty:ident) => {
|
||||
type AnswerPreCheckoutQuery = $ty![AnswerPreCheckoutQuery];
|
||||
|
||||
fn answer_pre_checkout_query<P>(&self, pre_checkout_query_id: P, ok: bool) -> Self::AnswerPreCheckoutQuery where P: Into<String> {
|
||||
let this = self;
|
||||
$body!(answer_pre_checkout_query this (pre_checkout_query_id: P, ok: bool))
|
||||
}
|
||||
};
|
||||
(@method set_passport_data_errors $body:ident $ty:ident) => {
|
||||
type SetPassportDataErrors = $ty![SetPassportDataErrors];
|
||||
|
||||
fn set_passport_data_errors<E>(&self, user_id: i32, errors: E) -> Self::SetPassportDataErrors where E: IntoIterator<Item = PassportElementError> {
|
||||
let this = self;
|
||||
$body!(set_passport_data_errors this (user_id: i32, errors: E))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
use crate::{
|
||||
payloads::{GetMe, SendMessage},
|
||||
payloads::{GetMe, SendMessage, *},
|
||||
requests::Request,
|
||||
types::ChatId,
|
||||
types::{
|
||||
AllowedUpdate, BotCommand, ChatAction, ChatId, ChatPermissions, DiceEmoji,
|
||||
InlineQueryResult, InputFile, InputMedia, InputSticker, LabeledPrice, PassportElementError,
|
||||
PollType,
|
||||
},
|
||||
};
|
||||
|
||||
/// The trait implemented by all bots & bot adaptors.
|
||||
|
@ -12,18 +16,686 @@ use crate::{
|
|||
pub trait Requester {
|
||||
type Err: std::error::Error + Send;
|
||||
|
||||
// This block is auto generated by `cg` <https://github.com/teloxide/cg> (a8fa55a).
|
||||
// **DO NOT EDIT THIS BLOCK**,
|
||||
// edit `cg` instead.
|
||||
|
||||
type GetUpdates: Request<Payload = GetUpdates, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetUpdates`]
|
||||
fn get_updates(&self) -> Self::GetUpdates;
|
||||
|
||||
type SetWebhook: Request<Payload = SetWebhook, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetWebhook`]
|
||||
fn set_webhook<U, A>(&self, url: U, allowed_updates: A) -> Self::SetWebhook
|
||||
where
|
||||
U: Into<String>,
|
||||
A: IntoIterator<Item = AllowedUpdate>;
|
||||
|
||||
type DeleteWebhook: Request<Payload = DeleteWebhook, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`DeleteWebhook`]
|
||||
fn delete_webhook(&self) -> Self::DeleteWebhook;
|
||||
|
||||
type GetWebhookInfo: Request<Payload = GetWebhookInfo, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetWebhookInfo`]
|
||||
fn get_webhook_info(&self) -> Self::GetWebhookInfo;
|
||||
|
||||
type GetMe: Request<Payload = GetMe, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation of the method see [`GetMe`].
|
||||
/// For telegram documentation see [`GetMe`]
|
||||
fn get_me(&self) -> Self::GetMe;
|
||||
|
||||
type SendMessage: Request<Payload = SendMessage, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation of the method see [`SendMessage`].
|
||||
/// For telegram documentation see [`SendMessage`]
|
||||
fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>;
|
||||
|
||||
// FIXME(waffle): add remaining 68 methods
|
||||
type ForwardMessage: Request<Payload = ForwardMessage, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`ForwardMessage`]
|
||||
fn forward_message<C, F>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
from_chat_id: F,
|
||||
message_id: i32,
|
||||
) -> Self::ForwardMessage
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
F: Into<ChatId>;
|
||||
|
||||
type SendPhoto: Request<Payload = SendPhoto, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendPhoto`]
|
||||
fn send_photo<Ch, Ca>(&self, chat_id: Ch, photo: InputFile, caption: Ca) -> Self::SendPhoto
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>;
|
||||
|
||||
type SendAudio: Request<Payload = SendAudio, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendAudio`]
|
||||
fn send_audio<Ch, Ca>(&self, chat_id: Ch, audio: InputFile, caption: Ca) -> Self::SendAudio
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>;
|
||||
|
||||
type SendDocument: Request<Payload = SendDocument, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendDocument`]
|
||||
fn send_document<Ch, Ca>(
|
||||
&self,
|
||||
chat_id: Ch,
|
||||
document: InputFile,
|
||||
caption: Ca,
|
||||
) -> Self::SendDocument
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>;
|
||||
|
||||
type SendVideo: Request<Payload = SendVideo, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendVideo`]
|
||||
fn send_video<Ch, Ca>(&self, chat_id: Ch, video: InputFile, caption: Ca) -> Self::SendVideo
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>;
|
||||
|
||||
type SendAnimation: Request<Payload = SendAnimation, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendAnimation`]
|
||||
fn send_animation<Ch, Ca>(
|
||||
&self,
|
||||
chat_id: Ch,
|
||||
animation: InputFile,
|
||||
caption: Ca,
|
||||
) -> Self::SendAnimation
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>;
|
||||
|
||||
type SendVoice: Request<Payload = SendVoice, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendVoice`]
|
||||
fn send_voice<Ch, Ca>(&self, chat_id: Ch, voice: InputFile, caption: Ca) -> Self::SendVoice
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>;
|
||||
|
||||
type SendVideoNote: Request<Payload = SendVideoNote, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendVideoNote`]
|
||||
fn send_video_note<C>(&self, chat_id: C, video_note: InputFile) -> Self::SendVideoNote
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SendMediaGroup: Request<Payload = SendMediaGroup, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendMediaGroup`]
|
||||
fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroup
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
M: IntoIterator<Item = InputMedia>;
|
||||
|
||||
type SendLocation: Request<Payload = SendLocation, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendLocation`]
|
||||
fn send_location<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
live_period: u32,
|
||||
) -> Self::SendLocation
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type EditMessageLiveLocation: Request<Payload = EditMessageLiveLocation, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageLiveLocation`]
|
||||
fn edit_message_live_location<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> Self::EditMessageLiveLocation
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type EditMessageLiveLocationInline: Request<
|
||||
Payload = EditMessageLiveLocationInline,
|
||||
Err = Self::Err,
|
||||
>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageLiveLocationInline`]
|
||||
fn edit_message_live_location_inline<I>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> Self::EditMessageLiveLocationInline
|
||||
where
|
||||
I: Into<String>;
|
||||
|
||||
type StopMessageLiveLocation: Request<Payload = StopMessageLiveLocation, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`StopMessageLiveLocation`]
|
||||
fn stop_message_live_location<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> Self::StopMessageLiveLocation
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type StopMessageLiveLocationInline: Request<
|
||||
Payload = StopMessageLiveLocationInline,
|
||||
Err = Self::Err,
|
||||
>;
|
||||
|
||||
/// For telegram documentation see [`StopMessageLiveLocationInline`]
|
||||
fn stop_message_live_location_inline<I>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
) -> Self::StopMessageLiveLocationInline
|
||||
where
|
||||
I: Into<String>;
|
||||
|
||||
type SendVenue: Request<Payload = SendVenue, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendVenue`]
|
||||
fn send_venue<C, T, A>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
latitude: f64,
|
||||
longitude: f64,
|
||||
title: T,
|
||||
address: A,
|
||||
) -> Self::SendVenue
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>,
|
||||
A: Into<String>;
|
||||
|
||||
type SendContact: Request<Payload = SendContact, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendContact`]
|
||||
fn send_contact<C>(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SendPoll: Request<Payload = SendPoll, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendPoll`]
|
||||
fn send_poll<C, Q, O>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
question: Q,
|
||||
options: O,
|
||||
type_: PollType,
|
||||
) -> Self::SendPoll
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
Q: Into<String>,
|
||||
O: IntoIterator<Item = String>;
|
||||
|
||||
type SendDice: Request<Payload = SendDice, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendDice`]
|
||||
fn send_dice<C>(&self, chat_id: C, emoji: DiceEmoji) -> Self::SendDice
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SendChatAction: Request<Payload = SendChatAction, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendChatAction`]
|
||||
fn send_chat_action<C>(&self, chat_id: C, action: ChatAction) -> Self::SendChatAction
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type GetUserProfilePhotos: Request<Payload = GetUserProfilePhotos, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetUserProfilePhotos`]
|
||||
fn get_user_profile_photos(&self, user_id: i32) -> Self::GetUserProfilePhotos;
|
||||
|
||||
type GetFile: Request<Payload = GetFile, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetFile`]
|
||||
fn get_file<F>(&self, file_id: F) -> Self::GetFile
|
||||
where
|
||||
F: Into<String>;
|
||||
|
||||
type KickChatMember: Request<Payload = KickChatMember, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`KickChatMember`]
|
||||
fn kick_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::KickChatMember
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type UnbanChatMember: Request<Payload = UnbanChatMember, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`UnbanChatMember`]
|
||||
fn unban_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::UnbanChatMember
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type RestrictChatMember: Request<Payload = RestrictChatMember, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`RestrictChatMember`]
|
||||
fn restrict_chat_member<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
user_id: i32,
|
||||
permissions: ChatPermissions,
|
||||
) -> Self::RestrictChatMember
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type PromoteChatMember: Request<Payload = PromoteChatMember, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`PromoteChatMember`]
|
||||
fn promote_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::PromoteChatMember
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SetChatAdministratorCustomTitle: Request<
|
||||
Payload = SetChatAdministratorCustomTitle,
|
||||
Err = Self::Err,
|
||||
>;
|
||||
|
||||
/// For telegram documentation see [`SetChatAdministratorCustomTitle`]
|
||||
fn set_chat_administrator_custom_title<Ch, Cu>(
|
||||
&self,
|
||||
chat_id: Ch,
|
||||
user_id: i32,
|
||||
custom_title: Cu,
|
||||
) -> Self::SetChatAdministratorCustomTitle
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Cu: Into<String>;
|
||||
|
||||
type SetChatPermissions: Request<Payload = SetChatPermissions, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetChatPermissions`]
|
||||
fn set_chat_permissions<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
permissions: ChatPermissions,
|
||||
) -> Self::SetChatPermissions
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type ExportChatInviteLink: Request<Payload = ExportChatInviteLink, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`ExportChatInviteLink`]
|
||||
fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLink
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SetChatPhoto: Request<Payload = SetChatPhoto, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetChatPhoto`]
|
||||
fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type DeleteChatPhoto: Request<Payload = DeleteChatPhoto, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`DeleteChatPhoto`]
|
||||
fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhoto
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SetChatTitle: Request<Payload = SetChatTitle, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetChatTitle`]
|
||||
fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitle
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>;
|
||||
|
||||
type SetChatDescription: Request<Payload = SetChatDescription, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetChatDescription`]
|
||||
fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescription
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type PinChatMessage: Request<Payload = PinChatMessage, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`PinChatMessage`]
|
||||
fn pin_chat_message<C>(&self, chat_id: C, message_id: i32) -> Self::PinChatMessage
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type UnpinChatMessage: Request<Payload = UnpinChatMessage, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`UnpinChatMessage`]
|
||||
fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessage
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type LeaveChat: Request<Payload = LeaveChat, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`LeaveChat`]
|
||||
fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChat
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type GetChat: Request<Payload = GetChat, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetChat`]
|
||||
fn get_chat<C>(&self, chat_id: C) -> Self::GetChat
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type GetChatAdministrators: Request<Payload = GetChatAdministrators, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetChatAdministrators`]
|
||||
fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministrators
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type GetChatMembersCount: Request<Payload = GetChatMembersCount, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetChatMembersCount`]
|
||||
fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCount
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type GetChatMember: Request<Payload = GetChatMember, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetChatMember`]
|
||||
fn get_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::GetChatMember
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SetChatStickerSet: Request<Payload = SetChatStickerSet, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetChatStickerSet`]
|
||||
fn set_chat_sticker_set<C, S>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
sticker_set_name: S,
|
||||
) -> Self::SetChatStickerSet
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
S: Into<String>;
|
||||
|
||||
type DeleteChatStickerSet: Request<Payload = DeleteChatStickerSet, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`DeleteChatStickerSet`]
|
||||
fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSet
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type AnswerCallbackQuery: Request<Payload = AnswerCallbackQuery, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`AnswerCallbackQuery`]
|
||||
fn answer_callback_query<C>(&self, callback_query_id: C) -> Self::AnswerCallbackQuery
|
||||
where
|
||||
C: Into<String>;
|
||||
|
||||
type SetMyCommands: Request<Payload = SetMyCommands, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetMyCommands`]
|
||||
fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands
|
||||
where
|
||||
C: IntoIterator<Item = BotCommand>;
|
||||
|
||||
type GetMyCommands: Request<Payload = GetMyCommands, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetMyCommands`]
|
||||
fn get_my_commands(&self) -> Self::GetMyCommands;
|
||||
|
||||
type AnswerInlineQuery: Request<Payload = AnswerInlineQuery, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`AnswerInlineQuery`]
|
||||
fn answer_inline_query<I, R>(&self, inline_query_id: I, results: R) -> Self::AnswerInlineQuery
|
||||
where
|
||||
I: Into<String>,
|
||||
R: IntoIterator<Item = InlineQueryResult>;
|
||||
|
||||
type EditMessageText: Request<Payload = EditMessageText, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageText`]
|
||||
fn edit_message_text<C, T>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
text: T,
|
||||
) -> Self::EditMessageText
|
||||
where
|
||||
C: Into<ChatId>,
|
||||
T: Into<String>;
|
||||
|
||||
type EditMessageTextInline: Request<Payload = EditMessageTextInline, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageTextInline`]
|
||||
fn edit_message_text_inline<I, T>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
text: T,
|
||||
) -> Self::EditMessageTextInline
|
||||
where
|
||||
I: Into<String>,
|
||||
T: Into<String>;
|
||||
|
||||
type EditMessageCaption: Request<Payload = EditMessageCaption, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageCaption`]
|
||||
fn edit_message_caption<Ch, Ca>(
|
||||
&self,
|
||||
chat_id: Ch,
|
||||
message_id: i32,
|
||||
caption: Ca,
|
||||
) -> Self::EditMessageCaption
|
||||
where
|
||||
Ch: Into<ChatId>,
|
||||
Ca: Into<String>;
|
||||
|
||||
type EditMessageCaptionInline: Request<Payload = EditMessageCaptionInline, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageCaptionInline`]
|
||||
fn edit_message_caption_inline<I, C>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
caption: C,
|
||||
) -> Self::EditMessageCaptionInline
|
||||
where
|
||||
I: Into<String>,
|
||||
C: Into<String>;
|
||||
|
||||
type EditMessageMedia: Request<Payload = EditMessageMedia, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageMedia`]
|
||||
fn edit_message_media<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
media: InputMedia,
|
||||
) -> Self::EditMessageMedia
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type EditMessageMediaInline: Request<Payload = EditMessageMediaInline, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageMediaInline`]
|
||||
fn edit_message_media_inline<I>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
media: InputMedia,
|
||||
) -> Self::EditMessageMediaInline
|
||||
where
|
||||
I: Into<String>;
|
||||
|
||||
type EditMessageReplyMarkup: Request<Payload = EditMessageReplyMarkup, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageReplyMarkup`]
|
||||
fn edit_message_reply_markup<C>(
|
||||
&self,
|
||||
chat_id: C,
|
||||
message_id: i32,
|
||||
) -> Self::EditMessageReplyMarkup
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type EditMessageReplyMarkupInline: Request<
|
||||
Payload = EditMessageReplyMarkupInline,
|
||||
Err = Self::Err,
|
||||
>;
|
||||
|
||||
/// For telegram documentation see [`EditMessageReplyMarkupInline`]
|
||||
fn edit_message_reply_markup_inline<I>(
|
||||
&self,
|
||||
inline_message_id: I,
|
||||
) -> Self::EditMessageReplyMarkupInline
|
||||
where
|
||||
I: Into<String>;
|
||||
|
||||
type StopPoll: Request<Payload = StopPoll, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`StopPoll`]
|
||||
fn stop_poll<C>(&self, chat_id: C, message_id: i32) -> Self::StopPoll
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type DeleteMessage: Request<Payload = DeleteMessage, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`DeleteMessage`]
|
||||
fn delete_message<C>(&self, chat_id: C, message_id: i32) -> Self::DeleteMessage
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type SendSticker: Request<Payload = SendSticker, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendSticker`]
|
||||
fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker
|
||||
where
|
||||
C: Into<ChatId>;
|
||||
|
||||
type GetStickerSet: Request<Payload = GetStickerSet, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`GetStickerSet`]
|
||||
fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSet
|
||||
where
|
||||
N: Into<String>;
|
||||
|
||||
type UploadStickerFile: Request<Payload = UploadStickerFile, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`UploadStickerFile`]
|
||||
fn upload_sticker_file(&self, user_id: i32, png_sticker: InputFile) -> Self::UploadStickerFile;
|
||||
|
||||
type CreateNewStickerSet: Request<Payload = CreateNewStickerSet, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`CreateNewStickerSet`]
|
||||
fn create_new_sticker_set<N, T, E>(
|
||||
&self,
|
||||
user_id: i32,
|
||||
name: N,
|
||||
title: T,
|
||||
emojis: E,
|
||||
) -> Self::CreateNewStickerSet
|
||||
where
|
||||
N: Into<String>,
|
||||
T: Into<String>,
|
||||
E: Into<String>;
|
||||
|
||||
type AddStickerToSet: Request<Payload = AddStickerToSet, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`AddStickerToSet`]
|
||||
fn add_sticker_to_set<N, E>(
|
||||
&self,
|
||||
user_id: i32,
|
||||
name: N,
|
||||
sticker: InputSticker,
|
||||
emojis: E,
|
||||
) -> Self::AddStickerToSet
|
||||
where
|
||||
N: Into<String>,
|
||||
E: Into<String>;
|
||||
|
||||
type SetStickerPositionInSet: Request<Payload = SetStickerPositionInSet, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetStickerPositionInSet`]
|
||||
fn set_sticker_position_in_set<S>(
|
||||
&self,
|
||||
sticker: S,
|
||||
position: u32,
|
||||
) -> Self::SetStickerPositionInSet
|
||||
where
|
||||
S: Into<String>;
|
||||
|
||||
type DeleteStickerFromSet: Request<Payload = DeleteStickerFromSet, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`DeleteStickerFromSet`]
|
||||
fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSet
|
||||
where
|
||||
S: Into<String>;
|
||||
|
||||
type SetStickerSetThumb: Request<Payload = SetStickerSetThumb, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetStickerSetThumb`]
|
||||
fn set_sticker_set_thumb<N>(&self, name: N, user_id: i32) -> Self::SetStickerSetThumb
|
||||
where
|
||||
N: Into<String>;
|
||||
|
||||
type SendInvoice: Request<Payload = SendInvoice, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SendInvoice`]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn send_invoice<T, D, Pa, P, S, C, Pri>(
|
||||
&self,
|
||||
chat_id: i32,
|
||||
title: T,
|
||||
description: D,
|
||||
payload: Pa,
|
||||
provider_token: P,
|
||||
start_parameter: S,
|
||||
currency: C,
|
||||
prices: Pri,
|
||||
) -> Self::SendInvoice
|
||||
where
|
||||
T: Into<String>,
|
||||
D: Into<String>,
|
||||
Pa: Into<String>,
|
||||
P: Into<String>,
|
||||
S: Into<String>,
|
||||
C: Into<String>,
|
||||
Pri: IntoIterator<Item = LabeledPrice>;
|
||||
|
||||
type AnswerShippingQuery: Request<Payload = AnswerShippingQuery, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`AnswerShippingQuery`]
|
||||
fn answer_shipping_query<S>(&self, shipping_query_id: S, ok: bool) -> Self::AnswerShippingQuery
|
||||
where
|
||||
S: Into<String>;
|
||||
|
||||
type AnswerPreCheckoutQuery: Request<Payload = AnswerPreCheckoutQuery, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`AnswerPreCheckoutQuery`]
|
||||
fn answer_pre_checkout_query<P>(
|
||||
&self,
|
||||
pre_checkout_query_id: P,
|
||||
ok: bool,
|
||||
) -> Self::AnswerPreCheckoutQuery
|
||||
where
|
||||
P: Into<String>;
|
||||
|
||||
type SetPassportDataErrors: Request<Payload = SetPassportDataErrors, Err = Self::Err>;
|
||||
|
||||
/// For telegram documentation see [`SetPassportDataErrors`]
|
||||
fn set_passport_data_errors<E>(&self, user_id: i32, errors: E) -> Self::SetPassportDataErrors
|
||||
where
|
||||
E: IntoIterator<Item = PassportElementError>;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue