Update methods to tba 5.0

This commit is contained in:
Waffle 2021-03-14 22:44:33 +03:00
parent 20c67a18c5
commit fa5ab5aa7c
41 changed files with 376 additions and 79 deletions

View file

@ -82,17 +82,17 @@ where
type Err = B::Err;
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,
get_me, log_out, close, get_updates, set_webhook, delete_webhook, get_webhook_info,
forward_message, copy_message, send_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_description, pin_chat_message, unpin_chat_message, unpin_all_chat_messages,
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,

View file

@ -87,28 +87,18 @@ where
}
}
type SendMessage = B::SendMessage;
fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage
where
C: Into<ChatId>,
T: Into<String>,
{
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,
log_out, close, get_updates, set_webhook, delete_webhook, get_webhook_info,
forward_message, copy_message, send_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_description, pin_chat_message, unpin_chat_message, unpin_all_chat_messages,
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,

View file

@ -94,25 +94,26 @@ impl<B: Requester> Requester for DefaultParseMode<B> {
}
requester_forward! {
get_me, get_updates, set_webhook, delete_webhook, get_webhook_info,
forward_message, send_video_note, send_media_group, send_location,
get_me, log_out, close, get_updates, set_webhook, delete_webhook, get_webhook_info,
forward_message, copy_message, 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_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_description, pin_chat_message, unpin_chat_message, unpin_all_chat_messages,
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_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,
set_my_commands, get_my_commands, answer_inline_query,
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, send_game, set_game_score,
set_game_score_inline, get_game_high_scores, get_updates_fault_tolerant => fid, fty
answer_pre_checkout_query, set_passport_data_errors, send_game,
set_game_score, set_game_score_inline, get_game_high_scores,
get_updates_fault_tolerant => fid, fty
}
}

View file

@ -387,6 +387,7 @@ impl<B: Requester> Requester for Throttle<B>
where
B::SendMessage: Send,
B::ForwardMessage: Send,
B::CopyMessage: Send,
B::SendPhoto: Send,
B::SendAudio: Send,
B::SendDocument: Send,
@ -406,10 +407,10 @@ where
type Err = B::Err;
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
send_message, forward_message, copy_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 SendInvoice = ThrottlingRequest<B::SendInvoice>;
@ -451,15 +452,15 @@ where
}
requester_forward! {
get_me, get_updates, set_webhook, delete_webhook, get_webhook_info,
get_me, log_out, close, 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,
set_chat_description, pin_chat_message, unpin_chat_message, unpin_all_chat_messages,
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,

View file

@ -967,6 +967,40 @@ impl Requester for Bot {
)
}
type LogOut = JsonRequest<payloads::LogOut>;
fn log_out(&self) -> Self::LogOut {
Self::LogOut::new(self.clone(), payloads::LogOut::new())
}
type Close = JsonRequest<payloads::Close>;
fn close(&self) -> Self::Close {
Self::Close::new(self.clone(), payloads::Close::new())
}
type CopyMessage = JsonRequest<payloads::CopyMessage>;
fn copy_message<C, F>(&self, chat_id: C, from_chat_id: F, message_id: i32) -> Self::CopyMessage
where
C: Into<ChatId>,
F: Into<ChatId>,
{
Self::CopyMessage::new(
self.clone(),
payloads::CopyMessage::new(chat_id, from_chat_id, message_id),
)
}
type UnpinAllChatMessages = JsonRequest<payloads::UnpinAllChatMessages>;
fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessages
where
C: Into<ChatId>,
{
Self::UnpinAllChatMessages::new(self.clone(), payloads::UnpinAllChatMessages::new(chat_id))
}
type GetUpdatesFaultTolerant = JsonRequest<payloads::GetUpdatesFaultTolerant>;
fn get_updates_fault_tolerant(&self) -> Self::GetUpdatesFaultTolerant {

View file

@ -443,6 +443,22 @@ macro_rules! requester_forward {
$body!(get_me this ())
}
};
(@method log_out $body:ident $ty:ident) => {
type LogOut = $ty![LogOut];
fn log_out(&self) -> Self::LogOut {
let this = self;
$body!(log_out this ())
}
};
(@method close $body:ident $ty:ident) => {
type Close = $ty![Close];
fn close(&self) -> Self::Close {
let this = self;
$body!(close this ())
}
};
(@method send_message $body:ident $ty:ident) => {
type SendMessage = $ty![SendMessage];
@ -461,6 +477,15 @@ macro_rules! requester_forward {
$body!(forward_message this (chat_id: C, from_chat_id: F, message_id: i32))
}
};
(@method copy_message $body:ident $ty:ident) => {
type CopyMessage = $ty![CopyMessage];
fn copy_message<C, F>(&self, chat_id: C, from_chat_id: F, message_id: i32) -> Self::CopyMessage where C: Into<ChatId>,
F: Into<ChatId> {
let this = self;
$body!(copy_message this (chat_id: C, from_chat_id: F, message_id: i32))
}
};
(@method send_photo $body:ident $ty:ident) => {
type SendPhoto = $ty![SendPhoto];
@ -734,6 +759,14 @@ macro_rules! requester_forward {
$body!(unpin_chat_message this (chat_id: C))
}
};
(@method unpin_all_chat_messages $body:ident $ty:ident) => {
type UnpinAllChatMessages = $ty![UnpinAllChatMessages];
fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessages where C: Into<ChatId> {
let this = self;
$body!(unpin_all_chat_messages this (chat_id: C))
}
};
(@method leave_chat $body:ident $ty:ident) => {
type LeaveChat = $ty![LeaveChat];

View file

@ -12,7 +12,7 @@
/// namespace.
pub mod setters;
// This block is auto generated by `cg` <https://github.com/teloxide/cg> (9a82143).
// This block is auto generated by `cg` <https://github.com/teloxide/cg> (24572cd + local changes).
// **DO NOT EDIT THIS BLOCK**,
// edit `cg` instead.
mod add_sticker_to_set;
@ -20,6 +20,8 @@ mod answer_callback_query;
mod answer_inline_query;
mod answer_pre_checkout_query;
mod answer_shipping_query;
mod close;
mod copy_message;
mod create_new_sticker_set;
mod delete_chat_photo;
mod delete_chat_sticker_set;
@ -52,6 +54,7 @@ mod get_user_profile_photos;
mod get_webhook_info;
mod kick_chat_member;
mod leave_chat;
mod log_out;
mod pin_chat_message;
mod promote_chat_member;
mod restrict_chat_member;
@ -90,6 +93,7 @@ mod stop_message_live_location;
mod stop_message_live_location_inline;
mod stop_poll;
mod unban_chat_member;
mod unpin_all_chat_messages;
mod unpin_chat_message;
mod upload_sticker_file;
@ -98,6 +102,8 @@ pub use answer_callback_query::{AnswerCallbackQuery, AnswerCallbackQuerySetters}
pub use answer_inline_query::{AnswerInlineQuery, AnswerInlineQuerySetters};
pub use answer_pre_checkout_query::{AnswerPreCheckoutQuery, AnswerPreCheckoutQuerySetters};
pub use answer_shipping_query::{AnswerShippingQuery, AnswerShippingQuerySetters};
pub use close::{Close, CloseSetters};
pub use copy_message::{CopyMessage, CopyMessageSetters};
pub use create_new_sticker_set::{CreateNewStickerSet, CreateNewStickerSetSetters};
pub use delete_chat_photo::{DeleteChatPhoto, DeleteChatPhotoSetters};
pub use delete_chat_sticker_set::{DeleteChatStickerSet, DeleteChatStickerSetSetters};
@ -134,6 +140,7 @@ pub use get_user_profile_photos::{GetUserProfilePhotos, GetUserProfilePhotosSett
pub use get_webhook_info::{GetWebhookInfo, GetWebhookInfoSetters};
pub use kick_chat_member::{KickChatMember, KickChatMemberSetters};
pub use leave_chat::{LeaveChat, LeaveChatSetters};
pub use log_out::{LogOut, LogOutSetters};
pub use pin_chat_message::{PinChatMessage, PinChatMessageSetters};
pub use promote_chat_member::{PromoteChatMember, PromoteChatMemberSetters};
pub use restrict_chat_member::{RestrictChatMember, RestrictChatMemberSetters};
@ -176,6 +183,7 @@ pub use stop_message_live_location_inline::{
};
pub use stop_poll::{StopPoll, StopPollSetters};
pub use unban_chat_member::{UnbanChatMember, UnbanChatMemberSetters};
pub use unpin_all_chat_messages::{UnpinAllChatMessages, UnpinAllChatMessagesSetters};
pub use unpin_chat_message::{UnpinChatMessage, UnpinChatMessageSetters};
pub use upload_sticker_file::{UploadStickerFile, UploadStickerFileSetters};

14
src/payloads/close.rs Normal file
View file

@ -0,0 +1,14 @@
// This file is auto generated by `cg` <https://github.com/teloxide/cg> (24572cd + local changes).
// **DO NOT EDIT THIS FILE**,
// edit `cg` instead.
use serde::Serialize;
use crate::types::True;
impl_payload! {
/// Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. Returns _True_ on success. Requires no parameters.
#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)]
pub Close (CloseSetters) => True {
}
}

View file

@ -0,0 +1,46 @@
// This file is auto generated by `cg` <https://github.com/teloxide/cg> (24572cd + local changes).
// **DO NOT EDIT THIS FILE**,
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, Message, MessageEntity, ParseMode, ReplyMarkup};
impl_payload! {
/// Use this method to copy messages of any kind. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the [`MessageId`] of the sent message on success.
///
/// [`MessageId`]: crate::types::MessageId
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub CopyMessage (CopyMessageSetters) => Message {
required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: ChatId [into],
/// Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`)
pub from_chat_id: ChatId [into],
/// Message identifier in the chat specified in _from\_chat\_id_
pub message_id: i32,
}
optional {
/// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
pub caption: String [into],
/// Mode for parsing entities in the photo caption. See [formatting options] for more details.
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the new caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
/// [custom reply keyboard]: https://core.telegram.org/bots#keyboards
pub reply_markup: ReplyMarkup [into],
}
}
}

View file

@ -12,5 +12,9 @@ impl_payload! {
#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)]
pub DeleteWebhook (DeleteWebhookSetters) => True {
optional {
/// Pass _True_ to drop all pending updates
pub drop_pending_updates: bool,
}
}
}

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, InlineKeyboardMarkup, Message, ParseMode};
use crate::types::{ChatId, InlineKeyboardMarkup, Message, MessageEntity, ParseMode};
impl_payload! {
/// Use this method to edit captions of messages. On success, the edited Message is returned.
@ -24,6 +24,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// A JSON-serialized object for an [inline keyboard].
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{InlineKeyboardMarkup, ParseMode, True};
use crate::types::{InlineKeyboardMarkup, MessageEntity, ParseMode, True};
impl_payload! {
/// Use this method to edit captions of messages. On success, _True_ is returned.
@ -22,6 +22,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// A JSON-serialized object for an [inline keyboard].
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -24,6 +24,12 @@ impl_payload! {
pub longitude: f64,
}
optional {
/// The radius of uncertainty for the location, measured in meters; 0-1500
pub horizontal_accuracy: f64,
/// For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
pub heading: u16,
/// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
pub proximity_alert_radius: u32,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -22,6 +22,12 @@ impl_payload! {
pub longitude: f64,
}
optional {
/// The radius of uncertainty for the location, measured in meters; 0-1500
pub horizontal_accuracy: f64,
/// For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
pub heading: u16,
/// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
pub proximity_alert_radius: u32,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, InlineKeyboardMarkup, Message, ParseMode};
use crate::types::{ChatId, InlineKeyboardMarkup, Message, MessageEntity, ParseMode};
impl_payload! {
/// Use this method to edit text and [games] messages. On success, the edited Message is returned.
@ -26,6 +26,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in message text, which can be specified instead of _parse\_mode_
pub entities: Vec<MessageEntity> [collect],
/// Disables link previews for links in this message
pub disable_web_page_preview: bool,
/// A JSON-serialized object for an [inline keyboard].

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{InlineKeyboardMarkup, ParseMode, True};
use crate::types::{InlineKeyboardMarkup, MessageEntity, ParseMode, True};
impl_payload! {
/// Use this method to edit text and [games] messages. On success, _True_ is returned.
@ -24,6 +24,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in message text, which can be specified instead of _parse\_mode_
pub entities: Vec<MessageEntity> [collect],
/// Disables link previews for links in this message
pub disable_web_page_preview: bool,
/// A JSON-serialized object for an [inline keyboard].

14
src/payloads/log_out.rs Normal file
View file

@ -0,0 +1,14 @@
// This file is auto generated by `cg` <https://github.com/teloxide/cg> (24572cd + local changes).
// **DO NOT EDIT THIS FILE**,
// edit `cg` instead.
use serde::Serialize;
use crate::types::True;
impl_payload! {
/// Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. Returns _True_ on success. Requires no parameters.
#[derive(Debug, PartialEq, Eq, Hash, Default, Clone, Serialize)]
pub LogOut (LogOutSetters) => True {
}
}

View file

@ -16,6 +16,8 @@ impl_payload! {
pub user_id: i32,
}
optional {
/// Pass True, if the administrator's presence in the chat is hidden
pub is_anonymous: bool,
/// Pass True, if the administrator can change chat title, photo and other settings
pub can_change_info: bool,
/// Pass True, if the administrator can create channel posts, channels only

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup};
use crate::types::{ChatId, InputFile, Message, MessageEntity, ParseMode, ReplyMarkup};
impl_payload! {
@[multipart]
@ -37,12 +37,16 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the photo caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup};
use crate::types::{ChatId, InputFile, Message, MessageEntity, ParseMode, ReplyMarkup};
impl_payload! {
@[multipart]
@ -30,6 +30,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the photo caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// Duration of the audio in seconds
pub duration: u32,
/// Performer
@ -46,6 +48,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -32,6 +32,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -24,6 +24,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup};
use crate::types::{ChatId, InputFile, Message, MessageEntity, ParseMode, ReplyMarkup};
impl_payload! {
@[multipart]
@ -31,12 +31,18 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the photo caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// Disables automatic server-side content type detection for files uploaded using multipart/form-data.
pub disable_content_type_detection: bool,
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::Message;
use crate::types::{Message, ReplyMarkup};
impl_payload! {
/// Use this method to send a game. On success, the sent [`Message`] is returned.
@ -17,5 +17,19 @@ impl_payload! {
/// Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
pub game_short_name: String [into],
}
optional {
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// A JSON-serialized object for an [inline keyboard]. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
pub reply_markup: ReplyMarkup [into],
}
}
}

View file

@ -62,6 +62,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// A JSON-serialized object for an [inline keyboard]. If empty, one 'Pay `total price`' button will be shown. If not empty, the first button must be a Pay button.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -20,16 +20,24 @@ impl_payload! {
pub longitude: f64,
}
optional {
/// The radius of uncertainty for the location, measured in meters; 0-1500
pub horizontal_accuracy: f64,
/// Period in seconds for which the location will be updated (see [Live Locations], should be between 60 and 86400.
///
/// [Live Locations]: https://telegram.org/blog/live-locations
pub live_period: u32,
/// For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
pub heading: u16,
/// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
pub proximity_alert_radius: u32,
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -6,15 +6,15 @@ use serde::Serialize;
use crate::types::{ChatId, InputMedia, Message};
impl_payload! {
/// Use this method to send a group of photos or videos as an album. On success, an array of the sent [`Message`]s is returned.
/// Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of [`Messages`] that were sent is returned.
///
/// [`Message`]: crate::types::Message
/// [`Messages`]: crate::types::Messages
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub SendMediaGroup (SendMediaGroupSetters) => Vec<Message> {
required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: ChatId [into],
/// A JSON-serialized array describing photos and videos to be sent, must include 2-10 items
/// A JSON-serialized array describing messages to be sent, must include 2-10 items
pub media: Vec<InputMedia> [collect],
}
optional {
@ -24,6 +24,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
}
}
}

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, Message, ParseMode, ReplyMarkup};
use crate::types::{ChatId, Message, MessageEntity, ParseMode, ReplyMarkup};
impl_payload! {
/// Use this method to send text messages. On success, the sent [`Message`] is returned.
@ -22,6 +22,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the message text, which can be specified instead of _parse\_mode_
pub entities: Vec<MessageEntity> [collect],
/// Disables link previews for links in this message
pub disable_web_page_preview: bool,
/// Sends the message [silently]. Users will receive a notification with no sound.
@ -30,6 +32,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup};
use crate::types::{ChatId, InputFile, Message, MessageEntity, ParseMode, ReplyMarkup};
impl_payload! {
@[multipart]
@ -27,12 +27,16 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the photo caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, Message, ParseMode, PollType, ReplyMarkup};
use crate::types::{ChatId, Message, MessageEntity, ParseMode, PollType, ReplyMarkup};
impl_payload! {
/// Use this method to send phone contacts. On success, the sent [`Message`] is returned.
@ -14,7 +14,7 @@ impl_payload! {
required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: ChatId [into],
/// Poll question, 1-255 characters
/// Poll question, 1-300 characters
pub question: String [into],
/// A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
pub options: Vec<String> [collect],
@ -34,6 +34,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub explanation_parse_mode: ParseMode,
/// List of special entities that appear in the poll explanation, which can be specified instead of _parse\_mode_
pub explanation_entities: Vec<MessageEntity> [collect],
/// Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
pub open_period: u16,
/// Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
@ -46,6 +48,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -27,6 +27,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -28,12 +28,20 @@ impl_payload! {
pub foursquare_id: String [into],
/// Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
pub foursquare_type: String [into],
/// Google Places identifier of the venue
pub google_place_id: String [into],
/// Google Places type of the venue. (See [supported types].)
///
/// [supported types]: https://developers.google.com/places/web-service/supported_types
pub google_place_type: String [into],
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup};
use crate::types::{ChatId, InputFile, Message, MessageEntity, ParseMode, ReplyMarkup};
impl_payload! {
@[multipart]
@ -38,6 +38,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// Pass _True_, if the uploaded video is suitable for streaming
pub supports_streaming: bool,
/// Sends the message [silently]. Users will receive a notification with no sound.
@ -46,6 +48,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -36,6 +36,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -3,7 +3,7 @@
// edit `cg` instead.
use serde::Serialize;
use crate::types::{ChatId, InputFile, Message, ParseMode, ReplyMarkup};
use crate::types::{ChatId, InputFile, Message, MessageEntity, ParseMode, ReplyMarkup};
impl_payload! {
@[multipart]
@ -29,6 +29,8 @@ impl_payload! {
///
/// [formatting options]: https://core.telegram.org/bots/api#formatting-options
pub parse_mode: ParseMode,
/// List of special entities that appear in the photo caption, which can be specified instead of _parse\_mode_
pub caption_entities: Vec<MessageEntity> [collect],
/// Duration of the voice message in seconds
pub duration: u32,
/// Sends the message [silently]. Users will receive a notification with no sound.
@ -37,6 +39,8 @@ impl_payload! {
pub disable_notification: bool,
/// If the message is a reply, ID of the original message
pub reply_to_message_id: i32,
/// Pass _True_, if the message should be sent even if the specified replied-to message is not found
pub allow_sending_without_reply: bool,
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating

View file

@ -23,6 +23,8 @@ impl_payload! {
///
/// [self-signed guide]: https://core.telegram.org/bots/self-signed
pub certificate: InputFile,
/// The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
pub ip_address: String [into],
/// Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
pub max_connections: u8,
/// A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See [`Update`] for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.
@ -31,6 +33,8 @@ impl_payload! {
///
/// [`Update`]: crate::types::Update
pub allowed_updates: Vec<AllowedUpdate> [collect],
/// Pass _True_ to drop all pending updates
pub drop_pending_updates: bool,
}
}
}

View file

@ -1,27 +1,27 @@
// This file is auto generated by `cg` <https://github.com/teloxide/cg> (9a82143).
// This file is auto generated by `cg` <https://github.com/teloxide/cg> (24572cd + local changes).
// **DO NOT EDIT THIS FILE**,
// edit `cg` instead.
#[doc(no_inline)]
pub use crate::payloads::{
AddStickerToSetSetters as _, AnswerCallbackQuerySetters as _, AnswerInlineQuerySetters as _,
AnswerPreCheckoutQuerySetters as _, AnswerShippingQuerySetters as _,
CreateNewStickerSetSetters as _, DeleteChatPhotoSetters as _, DeleteChatStickerSetSetters as _,
DeleteMessageSetters as _, DeleteStickerFromSetSetters as _, DeleteWebhookSetters as _,
EditMessageCaptionInlineSetters as _, EditMessageCaptionSetters as _,
EditMessageLiveLocationInlineSetters as _, EditMessageLiveLocationSetters as _,
EditMessageMediaInlineSetters as _, EditMessageMediaSetters as _,
EditMessageReplyMarkupInlineSetters as _, EditMessageReplyMarkupSetters as _,
EditMessageTextInlineSetters as _, EditMessageTextSetters as _,
ExportChatInviteLinkSetters as _, ForwardMessageSetters as _,
AnswerPreCheckoutQuerySetters as _, AnswerShippingQuerySetters as _, CloseSetters as _,
CopyMessageSetters as _, CreateNewStickerSetSetters as _, DeleteChatPhotoSetters as _,
DeleteChatStickerSetSetters as _, DeleteMessageSetters as _, DeleteStickerFromSetSetters as _,
DeleteWebhookSetters as _, EditMessageCaptionInlineSetters as _,
EditMessageCaptionSetters as _, EditMessageLiveLocationInlineSetters as _,
EditMessageLiveLocationSetters as _, EditMessageMediaInlineSetters as _,
EditMessageMediaSetters as _, EditMessageReplyMarkupInlineSetters as _,
EditMessageReplyMarkupSetters as _, EditMessageTextInlineSetters as _,
EditMessageTextSetters as _, ExportChatInviteLinkSetters as _, ForwardMessageSetters as _,
GetChatAdministratorsSetters as _, GetChatMemberSetters as _, GetChatMembersCountSetters as _,
GetChatSetters as _, GetFileSetters as _, GetGameHighScoresSetters as _, GetMeSetters as _,
GetMyCommandsSetters as _, GetStickerSetSetters as _, GetUpdatesSetters as _,
GetUserProfilePhotosSetters as _, GetWebhookInfoSetters as _, KickChatMemberSetters as _,
LeaveChatSetters as _, PinChatMessageSetters as _, PromoteChatMemberSetters as _,
RestrictChatMemberSetters as _, SendAnimationSetters as _, SendAudioSetters as _,
SendChatActionSetters as _, SendContactSetters as _, SendDiceSetters as _,
SendDocumentSetters as _, SendGameSetters as _, SendInvoiceSetters as _,
LeaveChatSetters as _, LogOutSetters as _, PinChatMessageSetters as _,
PromoteChatMemberSetters as _, RestrictChatMemberSetters as _, SendAnimationSetters as _,
SendAudioSetters as _, SendChatActionSetters as _, SendContactSetters as _,
SendDiceSetters as _, SendDocumentSetters as _, SendGameSetters as _, SendInvoiceSetters as _,
SendLocationSetters as _, SendMediaGroupSetters as _, SendMessageSetters as _,
SendPhotoSetters as _, SendPollSetters as _, SendStickerSetters as _, SendVenueSetters as _,
SendVideoNoteSetters as _, SendVideoSetters as _, SendVoiceSetters as _,
@ -31,6 +31,6 @@ pub use crate::payloads::{
SetMyCommandsSetters as _, SetPassportDataErrorsSetters as _,
SetStickerPositionInSetSetters as _, SetStickerSetThumbSetters as _, SetWebhookSetters as _,
StopMessageLiveLocationInlineSetters as _, StopMessageLiveLocationSetters as _,
StopPollSetters as _, UnbanChatMemberSetters as _, UnpinChatMessageSetters as _,
UploadStickerFileSetters as _,
StopPollSetters as _, UnbanChatMemberSetters as _, UnpinAllChatMessagesSetters as _,
UnpinChatMessageSetters as _, UploadStickerFileSetters as _,
};

View file

@ -6,7 +6,7 @@ use serde::Serialize;
use crate::types::{ChatId, True};
impl_payload! {
/// Use this method to unban a previously kicked user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns _True_ on success.
/// Use this method to unban a previously kicked user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be **removed** from the chat. If you don't want this, use the parameter _only\_if\_banned_. Returns _True_ on success.
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub UnbanChatMember (UnbanChatMemberSetters) => True {
required {
@ -15,5 +15,9 @@ impl_payload! {
/// Unique identifier of the target user
pub user_id: i32,
}
optional {
/// Do nothing if the user is not banned
pub only_if_banned: bool,
}
}
}

View file

@ -0,0 +1,17 @@
// This file is auto generated by `cg` <https://github.com/teloxide/cg> (24572cd + local changes).
// **DO NOT EDIT THIS FILE**,
// edit `cg` instead.
use serde::Serialize;
use crate::types::ChatId;
impl_payload! {
/// Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns _True_ on success.
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub UnpinAllChatMessages (UnpinAllChatMessagesSetters) => String {
required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: ChatId [into],
}
}
}

View file

@ -6,12 +6,16 @@ use serde::Serialize;
use crate::types::ChatId;
impl_payload! {
/// Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in the supergroup or 'can_edit_messages' admin right in the channel. Returns _True_ on success.
/// Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in a supergroup or 'can_edit_messages' admin right in a channel. Returns _True_ on success.
#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub UnpinChatMessage (UnpinChatMessageSetters) => String {
required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
pub chat_id: ChatId [into],
}
optional {
/// Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned.
pub message_id: i32,
}
}
}

View file

@ -83,6 +83,16 @@ pub trait Requester {
/// For Telegram documentation see [`GetMe`].
fn get_me(&self) -> Self::GetMe;
type LogOut: Request<Payload = LogOut, Err = Self::Err>;
/// For Telegram documentation see [`LogOut`].
fn log_out(&self) -> Self::LogOut;
type Close: Request<Payload = Close, Err = Self::Err>;
/// For Telegram documentation see [`Close`].
fn close(&self) -> Self::Close;
type SendMessage: Request<Payload = SendMessage, Err = Self::Err>;
/// For Telegram documentation see [`SendMessage`].
@ -104,6 +114,14 @@ pub trait Requester {
C: Into<ChatId>,
F: Into<ChatId>;
type CopyMessage: Request<Payload = CopyMessage, Err = Self::Err>;
/// For Telegram documentation see [`CopyMessage`].
fn copy_message<C, F>(&self, chat_id: C, from_chat_id: F, message_id: i32) -> Self::CopyMessage
where
C: Into<ChatId>,
F: Into<ChatId>;
type SendPhoto: Request<Payload = SendPhoto, Err = Self::Err>;
/// For Telegram documentation see [`SendPhoto`].
@ -405,6 +423,13 @@ pub trait Requester {
where
C: Into<ChatId>;
type UnpinAllChatMessages: Request<Payload = UnpinAllChatMessages, Err = Self::Err>;
/// For Telegram documentation see [`UnpinAllChatMessages`].
fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessages
where
C: Into<ChatId>;
type LeaveChat: Request<Payload = LeaveChat, Err = Self::Err>;
/// For Telegram documentation see [`LeaveChat`].
@ -769,17 +794,17 @@ macro_rules! fwd_deref {
macro_rules! forward_all {
() => {
requester_forward! {
get_me, get_updates, set_webhook, delete_webhook, get_webhook_info,
forward_message, send_message, send_photo, send_audio, send_document, send_video,
send_animation, send_voice, send_video_note, send_media_group, send_location,
get_me, log_out, close, get_updates, set_webhook, delete_webhook, get_webhook_info,
forward_message, copy_message, send_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_description, pin_chat_message, unpin_chat_message, unpin_all_chat_messages,
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,