mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-08 19:33:53 +01:00
Merge pull request #94 from teloxide/doc_types
Fix the docs of the API types
This commit is contained in:
commit
d93330cd1a
82 changed files with 2037 additions and 417 deletions
|
@ -1,24 +1,33 @@
|
|||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
/// This object represents an animation file (GIF or H.264/MPEG-4 AVC video
|
||||
/// without sound).
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#animation).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Animation {
|
||||
/// Identifier for this file
|
||||
/// An identifier for this file.
|
||||
pub file_id: String,
|
||||
/// Video width as defined by sender
|
||||
|
||||
/// A video width as defined by a sender.
|
||||
pub width: u32,
|
||||
/// Video height as defined by sender
|
||||
|
||||
/// A video height as defined by a sender.
|
||||
pub height: u32,
|
||||
/// Duration of the video in seconds as defined by sender
|
||||
|
||||
/// A duration of the video in seconds as defined by a sender.
|
||||
pub duration: u32,
|
||||
/// Optional. Animation thumbnail as defined by sender
|
||||
|
||||
/// An animation thumbnail as defined by a sender.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
/// Optional. Original animation filename as defined by sender
|
||||
|
||||
/// An original animation filename as defined by a sender.
|
||||
pub file_name: Option<String>,
|
||||
/// Optional. MIME type of the file as defined by sender
|
||||
|
||||
/// A MIME type of the file as defined by a sender.
|
||||
pub mime_type: Option<String>,
|
||||
/// Optional. File size
|
||||
|
||||
/// A size of a file.
|
||||
pub file_size: Option<u32>,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone)]
|
||||
/// This object represents an audio file to be treated as music by the Telegram
|
||||
/// clients.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#audio).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Audio {
|
||||
/// An identifier for this file.
|
||||
pub file_id: String,
|
||||
|
||||
/// A duration of the audio in seconds as defined by a sender.
|
||||
pub duration: u32,
|
||||
|
||||
/// A performer of the audio as defined by a sender or by audio tags.
|
||||
pub performer: Option<String>,
|
||||
|
||||
/// A title of the audio as defined by sender or by audio tags.
|
||||
pub title: Option<String>,
|
||||
|
||||
/// A MIME type of the file as defined by a sender.
|
||||
pub mime_type: Option<String>,
|
||||
|
||||
/// A size of a file.
|
||||
pub file_size: Option<u32>,
|
||||
|
||||
/// A thumbnail of the album cover to which the music file belongs.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
/// A placeholder, currently holds no information. Use [BotFather](https://t.me/botfather) to set up your game.
|
||||
/// A placeholder, currently holds no information. Use [@BotFather](https://t.me/botfather) to set up your game.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#callbackgame).
|
||||
pub struct CallbackGame;
|
||||
|
|
|
@ -1,13 +1,46 @@
|
|||
use crate::types::{Message, User};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
/// This object represents an incoming callback query from a callback button in
|
||||
/// an [inline keyboard]. If the button that originated the query was attached
|
||||
/// to a message sent by the bot, the field message will be present. If the
|
||||
/// button was attached to a message sent via the bot (in [inline mode]), the
|
||||
/// field `inline_message_id` will be present. Exactly one of the fields data or
|
||||
/// `game_short_name` will be present.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#callbackquery).
|
||||
///
|
||||
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
/// [inline mode]: https://core.telegram.org/bots/api#inline-mode
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct CallbackQuery {
|
||||
/// An unique identifier for this query.
|
||||
pub id: String,
|
||||
|
||||
/// A sender.
|
||||
pub from: User,
|
||||
pub chat_instance: String,
|
||||
|
||||
/// A message with the callback button that originated the query. Note that
|
||||
/// message content and message date will not be available if the message
|
||||
/// is too old.
|
||||
pub message: Option<Message>,
|
||||
|
||||
/// An identifier of the message sent via the bot in inline mode, that
|
||||
/// originated the query.
|
||||
pub inline_message_id: Option<String>,
|
||||
|
||||
/// A global identifier, uniquely corresponding to the chat to which the
|
||||
/// message with the callback button was sent. Useful for high scores in
|
||||
/// [games].
|
||||
///
|
||||
/// [games]: https://core.telegram.org/bots/api#games
|
||||
pub chat_instance: String,
|
||||
|
||||
/// A data associated with the callback button. Be aware that a bad client
|
||||
/// can send arbitrary data in this field.
|
||||
pub data: Option<String>,
|
||||
|
||||
/// A short name of a Game to be returned, serves as the unique identifier
|
||||
/// for the game.
|
||||
pub game_short_name: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,49 +1,116 @@
|
|||
use crate::types::{ChatPermissions, ChatPhoto, Message};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
/// This object represents a chat.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#chat).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Chat {
|
||||
/// A unique identifier for this chat. This number may be greater than 32
|
||||
/// bits and some programming languages may have difficulty/silent defects
|
||||
/// in interpreting it. But it is smaller than 52 bits, so a signed 64 bit
|
||||
/// integer or double-precision float type are safe for storing this
|
||||
/// identifier.
|
||||
pub id: i64,
|
||||
|
||||
#[serde(flatten)]
|
||||
pub kind: ChatKind,
|
||||
|
||||
/// A chat photo. Returned only in [`Bot::get_chat`].
|
||||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
pub photo: Option<ChatPhoto>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ChatKind {
|
||||
NonPrivate {
|
||||
/// A title, for supergroups, channels and group chats.
|
||||
title: Option<String>,
|
||||
|
||||
#[serde(flatten)]
|
||||
kind: NonPrivateChatKind,
|
||||
|
||||
/// A description, for groups, supergroups and channel chats. Returned
|
||||
/// only in [`Bot::get_chat`].
|
||||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
description: Option<String>,
|
||||
|
||||
/// A chat invite link, for groups, supergroups and channel chats. Each
|
||||
/// administrator in a chat generates their own invite links, so the
|
||||
/// bot must first generate the link using
|
||||
/// [`Bot::export_chat_invite_link`]. Returned only in
|
||||
/// [`Bot::get_chat`].
|
||||
///
|
||||
/// [`Bot::export_chat_invite_link`]:
|
||||
/// crate::Bot::export_chat_invite_link
|
||||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
invite_link: Option<String>,
|
||||
|
||||
/// Pinned message, for groups, supergroups and channels. Returned only
|
||||
/// in [`Bot::get_chat`].
|
||||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
pinned_message: Option<Box<Message>>,
|
||||
},
|
||||
Private {
|
||||
/// Dummy field. Used to ensure that "type" field is equal to "private"
|
||||
/// A dummy field. Used to ensure that the `type` field is equal to
|
||||
/// `private`.
|
||||
#[serde(rename = "type")]
|
||||
#[serde(deserialize_with = "assert_private_field")]
|
||||
type_: (),
|
||||
|
||||
/// A username, for private chats, supergroups and channels if
|
||||
/// available.
|
||||
username: Option<String>,
|
||||
|
||||
/// A first name of the other party in a private chat.
|
||||
first_name: Option<String>,
|
||||
|
||||
/// A last name of the other party in a private chat.
|
||||
last_name: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[serde(tag = "type")]
|
||||
pub enum NonPrivateChatKind {
|
||||
Channel {
|
||||
/// A username, for private chats, supergroups and channels if
|
||||
/// available.
|
||||
username: Option<String>,
|
||||
},
|
||||
Group {
|
||||
/// A default chat member permissions, for groups and supergroups.
|
||||
/// Returned only in [`Bot::get_chat`].
|
||||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
permissions: Option<ChatPermissions>,
|
||||
},
|
||||
Supergroup {
|
||||
/// A username, for private chats, supergroups and channels if
|
||||
/// available.
|
||||
username: Option<String>,
|
||||
|
||||
/// For supergroups, name of group sticker set. Returned only in
|
||||
/// [`Bot::get_chat`].
|
||||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
sticker_set_name: Option<String>,
|
||||
|
||||
/// `true`, if the bot can change the group sticker set. Returned only
|
||||
/// in [`Bot::get_chat`].
|
||||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
can_set_sticker_set: Option<bool>,
|
||||
|
||||
/// A default chat member permissions, for groups and supergroups.
|
||||
/// Returned only in [`Bot::get_chat`].
|
||||
///
|
||||
/// [`Bot::get_chat`]: crate::Bot::get_chat
|
||||
permissions: Option<ChatPermissions>,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[derive(Debug, Serialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ChatAction {
|
||||
Typing,
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
/// Unique identifier for the target chat or username of the target channel (in
|
||||
/// the format `@channelusername`)
|
||||
/// A unique identifier for the target chat or username of the target channel
|
||||
/// (in the format `@channelusername`).
|
||||
#[derive(
|
||||
Debug, Display, PartialEq, Eq, Hash, Clone, Deserialize, Serialize, From,
|
||||
)]
|
||||
#[serde(untagged)]
|
||||
pub enum ChatId {
|
||||
/// chat identifier
|
||||
/// A chat identifier.
|
||||
#[display(fmt = "{}", _0)]
|
||||
Id(i64),
|
||||
/// _channel_ username (in the format @channelusername)
|
||||
|
||||
/// A channel username (in the format @channelusername).
|
||||
#[display(fmt = "{}", _0)]
|
||||
ChannelUsername(String),
|
||||
}
|
||||
|
|
|
@ -1,61 +1,76 @@
|
|||
use crate::types::User;
|
||||
|
||||
/// This object contains information about one member of the chat.
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#chatmember).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ChatMember {
|
||||
/// Information about the user.
|
||||
pub user: User,
|
||||
|
||||
/// The member's status in the chat.
|
||||
pub status: ChatMemberStatus,
|
||||
///Optional. Restricted and kicked only. Date when restrictions will be
|
||||
/// lifted for this user, unix time
|
||||
|
||||
/// Restricted and kicked only. Date when restrictions will be lifted for
|
||||
/// this user, unix time.
|
||||
pub until_date: Option<i32>,
|
||||
///Optional. Administrators only. True, if the bot is allowed to edit
|
||||
/// administrator privileges of that user
|
||||
|
||||
/// Administrators only. `true`, if the bot is allowed to edit
|
||||
/// administrator privileges of that user.
|
||||
pub can_be_edited: Option<bool>,
|
||||
///Optional. Administrators only. True, if the administrator can change
|
||||
/// the chat title, photo and other settings
|
||||
|
||||
/// Administrators only. `true`, if the administrator can change the chat
|
||||
/// title, photo and other settings.
|
||||
pub can_change_info: Option<bool>,
|
||||
///Optional. Administrators only. True, if the administrator can post in
|
||||
/// the channel, channels only
|
||||
|
||||
/// Administrators only. `true`, if the administrator can post in the
|
||||
/// channel, channels only.
|
||||
pub can_post_messages: Option<bool>,
|
||||
///Optional. Administrators only. True, if the administrator can edit
|
||||
/// messages of other users and can pin messages, channels only
|
||||
|
||||
/// Administrators only. `true`, if the administrator can edit messages of
|
||||
/// other users and can pin messages, channels only.
|
||||
pub can_edit_messages: Option<bool>,
|
||||
///Optional. Administrators only. True, if the administrator can delete
|
||||
/// messages of other users
|
||||
|
||||
/// Administrators only. `true`, if the administrator can delete messages
|
||||
/// of other users.
|
||||
pub can_delete_messages: Option<bool>,
|
||||
///Optional. Administrators only. True, if the administrator can invite
|
||||
/// new users to the chat
|
||||
|
||||
/// Administrators only. `true`, if the administrator can invite new users
|
||||
/// to the chat.
|
||||
pub can_invite_users: Option<bool>,
|
||||
///Optional. Administrators only. True, if the administrator can restrict,
|
||||
/// ban or unban chat members
|
||||
|
||||
/// Administrators only. `true`, if the administrator can restrict,
|
||||
/// ban or unban chat members.
|
||||
pub can_restrict_members: Option<bool>,
|
||||
///Optional. Administrators only. True, if the administrator can pin
|
||||
/// messages, supergroups only
|
||||
|
||||
/// Administrators only. `true`, if the administrator can pin messages,
|
||||
/// supergroups only.
|
||||
pub can_pin_messages: Option<bool>,
|
||||
///Optional. Administrators only. True, if the administrator can add new
|
||||
|
||||
/// Administrators only. `true`, if the administrator can add new
|
||||
/// administrators with a subset of his own privileges or demote
|
||||
/// administrators that he has promoted, directly or indirectly (promoted
|
||||
/// by administrators that were appointed by the user)
|
||||
/// by administrators that were appointed by the user).
|
||||
pub can_promote_members: Option<bool>,
|
||||
///Optional. Restricted only. True, if the user can send text messages,
|
||||
/// contacts, locations and venues
|
||||
|
||||
/// Restricted only. `true`, if the user can send text messages,
|
||||
/// contacts, locations and venues.
|
||||
pub can_send_messages: Option<bool>,
|
||||
///Optional. Restricted only. True, if the user can send audios,
|
||||
/// documents, photos, videos, video notes and voice notes, implies
|
||||
/// can_send_messages
|
||||
|
||||
/// Restricted only. `true`, if the user is allowed to send audios,
|
||||
/// documents, photos, videos, video notes and voice notes.
|
||||
pub can_send_media_messages: Option<bool>,
|
||||
///Optional. Restricted only. True, if the user can send animations,
|
||||
/// games, stickers and use inline bots, implies
|
||||
/// can_send_media_messages
|
||||
|
||||
/// Restricted only. `true`, if the user is allowed to send animations,
|
||||
/// games, stickers and use inline bots.
|
||||
pub can_send_other_messages: Option<bool>,
|
||||
///Optional. Restricted only. True, if user may add web page previews to
|
||||
/// his messages, implies can_send_media_messages
|
||||
|
||||
/// Restricted only. `true`, if the user is allowed to add web page
|
||||
/// previews to their messages.
|
||||
pub can_add_web_page_previews: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Hash, PartialEq, Eq, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ChatMemberStatus {
|
||||
Creator,
|
||||
|
|
|
@ -1,19 +1,46 @@
|
|||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Serialize, Clone)]
|
||||
/// Describes actions that a non-administrator user is allowed to take in a
|
||||
/// chat.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#chatpermissions).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ChatPermissions {
|
||||
/// `true`, if the user is allowed to send text messages, contacts,
|
||||
/// locations and venues.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub can_send_messages: Option<bool>,
|
||||
|
||||
/// `true`, if the user is allowed to send audios, documents,
|
||||
/// photos, videos, video notes and voice notes, implies
|
||||
/// `can_send_messages`.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub can_send_media_messages: Option<bool>,
|
||||
|
||||
/// `true`, if the user is allowed to send polls, implies
|
||||
/// `can_send_messages`.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub can_send_polls: Option<bool>,
|
||||
|
||||
/// `true`, if the user is allowed to send animations, games, stickers and
|
||||
/// use inline bots, implies `can_send_media_messages`.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub can_send_other_messages: Option<bool>,
|
||||
|
||||
/// `true`, if the user is allowed to add web page previews to
|
||||
/// their messages, implies `can_send_media_messages`.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub can_add_web_page_previews: Option<bool>,
|
||||
|
||||
/// `true`, if the user is allowed to change the chat title, photo and
|
||||
/// other settings. Ignored in public supergroups.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub can_change_info: Option<bool>,
|
||||
|
||||
/// `true`, if the user is allowed to invite new users to the chat.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub can_invite_users: Option<bool>,
|
||||
|
||||
/// `true`, if the user is allowed to pin messages. Ignored in public
|
||||
/// supergroups.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub can_pin_messages: Option<bool>,
|
||||
}
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Serialize, Clone)]
|
||||
/// This object represents a chat photo.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#chatphoto).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ChatPhoto {
|
||||
/// A file identifier of small (160x160) chat photo. This file_id can be
|
||||
/// used only for photo download and only for as long as the photo is
|
||||
/// not changed.
|
||||
pub small_file_id: String,
|
||||
|
||||
/// A file identifier of big (640x640) chat photo. This file_id can be used
|
||||
/// only for photo download and only for as long as the photo is not
|
||||
/// changed.
|
||||
pub big_file_id: String,
|
||||
}
|
||||
|
|
|
@ -1,20 +1,31 @@
|
|||
use crate::types::{Location, User};
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
||||
/// Represents a result of an inline query that was chosen by the user and
|
||||
/// Represents a [result] of an inline query that was chosen by the user and
|
||||
/// sent to their chat partner.
|
||||
/// https://core.telegram.org/bots/api#inputtextmessagecontent
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#choseninlineresult).
|
||||
///
|
||||
/// [result]: https://core.telegram.org/bots/api#inlinequeryresult
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct ChosenInlineResult {
|
||||
/// The unique identifier for the result that was chosen
|
||||
/// The unique identifier for the result that was chosen.
|
||||
pub result_id: String,
|
||||
/// The user that chose the result
|
||||
|
||||
/// The user that chose the result.
|
||||
pub from: User,
|
||||
/// Optional. Sender location, only for bots that require user location
|
||||
|
||||
/// A sender location, only for bots that require user location.
|
||||
pub location: Option<Location>,
|
||||
/// Optional. Identifier of the sent inline message. Available only if
|
||||
/// there is an inline keyboard attached to the message. Will be also
|
||||
/// received in callback queries and can be used to edit the message.
|
||||
|
||||
/// An identifier of the sent inline message. Available only if
|
||||
/// there is an [inline keyboard] attached to the message. Will be also
|
||||
/// received in [callback queries] and can be used to [edit] the message.
|
||||
///
|
||||
/// [inline keyboard]: https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
||||
/// [callback queries]: https://core.telegram.org/bots/api#callbackquery
|
||||
/// [edit]: https://core.telegram.org/bots/api#updating-messages
|
||||
pub inline_message_id: Option<String>,
|
||||
/// The query that was used to obtain the result
|
||||
|
||||
/// The query that was used to obtain the result.
|
||||
pub query: String,
|
||||
}
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
/// This object represents a phone contact.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#contact).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Contact {
|
||||
/// Contact's phone number
|
||||
/// A contact's phone number.
|
||||
pub phone_number: String,
|
||||
/// Contact's first name
|
||||
|
||||
/// A contact's first name.
|
||||
pub first_name: String,
|
||||
/// Optional. Contact's last name
|
||||
|
||||
/// A contact's last name.
|
||||
pub last_name: Option<String>,
|
||||
/// Optional. Contact's user identifier in Telegram
|
||||
|
||||
/// A contact's user identifier in Telegram.
|
||||
pub user_id: Option<i32>,
|
||||
/// Optional. Additional data about the contact in the form of a
|
||||
/// [vCard](https://en.wikipedia.org/wiki/VCard)
|
||||
|
||||
/// Additional data about the contact in the form of a [vCard].
|
||||
///
|
||||
/// [vCard]: https://en.wikipedia.org/wiki/VCard
|
||||
pub vcard: Option<String>,
|
||||
}
|
||||
|
|
|
@ -1,10 +1,27 @@
|
|||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
/// This object represents a general file (as opposed to [photos], [voice
|
||||
/// messages] and [audio files]).
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#document).
|
||||
///
|
||||
/// [photos]: https://core.telegram.org/bots/api#photosize
|
||||
/// [voice messages]: https://core.telegram.org/bots/api#voice
|
||||
/// [audio files]: https://core.telegram.org/bots/api#audio
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Document {
|
||||
/// An identifier for this file.
|
||||
pub file_id: String,
|
||||
|
||||
/// A document thumbnail as defined by a sender.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
|
||||
/// An original filename as defined by a sender.
|
||||
pub file_name: Option<String>,
|
||||
|
||||
/// A MIME type of the file as defined by a sender.
|
||||
pub mime_type: Option<String>,
|
||||
|
||||
/// A size of a file.
|
||||
pub file_size: Option<u32>,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,27 @@
|
|||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
/// Contains data required for decrypting and authenticating
|
||||
/// [`EncryptedPassportElement`]. See the [Telegram Passport Documentation] for
|
||||
/// a complete description of the data decryption and authentication processes.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#encryptedcredentials).
|
||||
///
|
||||
/// [`EncryptedPassportElement`]:
|
||||
/// crate::types::EncryptedPassportElement
|
||||
/// [Telegram Passport Documentation]: https://core.telegram.org/passport#receiving-information
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct EncryptedCredentials {
|
||||
// TODO: check base64 type
|
||||
pub data: String,
|
||||
/// Base64-encoded encrypted JSON-serialized data with unique user's
|
||||
/// payload, data hashes and secrets required for
|
||||
/// [`EncryptedPassportElement`] decryption and authentication.
|
||||
///
|
||||
/// [`EncryptedPassportElement`]:
|
||||
/// crate::types::EncryptedPassportElement
|
||||
pub data: String, // TODO: check base64 type
|
||||
|
||||
/// Base64-encoded data hash for data authentication.
|
||||
pub hash: String,
|
||||
|
||||
/// A base64-encoded secret, encrypted with the bot's public RSA key,
|
||||
/// required for data decryption.
|
||||
pub secret: String,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
use super::PassportFile;
|
||||
|
||||
/// Contains information about documents or other Telegram Passport elements
|
||||
/// shared with the bot by the user.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#encryptedpassportelement).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct EncryptedPassportElement {
|
||||
/// Base64-encoded element hash for using in
|
||||
/// [`PassportElementErrorUnspecified`].
|
||||
///
|
||||
/// [`PassportElementErrorUnspecified`]:
|
||||
/// crate::types::PassportElementErrorUnspecified
|
||||
pub hash: String,
|
||||
|
||||
#[serde(flatten)]
|
||||
pub kind: EncryptedPassportElementKind,
|
||||
}
|
||||
|
@ -11,61 +21,331 @@ pub struct EncryptedPassportElement {
|
|||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EncryptedPassportElementKind {
|
||||
PersonalDetails {
|
||||
/// Base64-encoded encrypted Telegram Passport element data provided
|
||||
/// by the user, available for `personal_details”, `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport” and
|
||||
/// `address” types. Can be decrypted and verified using the
|
||||
/// accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
data: String,
|
||||
},
|
||||
Passport {
|
||||
/// Base64-encoded encrypted Telegram Passport element data provided
|
||||
/// by the user, available for `personal_details”, `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport” and
|
||||
/// `address” types. Can be decrypted and verified using the
|
||||
/// accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
data: String,
|
||||
|
||||
/// Encrypted file with the front side of the document, provided by the
|
||||
/// user. Available for `passport”, `driver_license”, `identity_card”
|
||||
/// and `internal_passport”. The file can be decrypted and verified
|
||||
/// using the accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
front_side: PassportFile,
|
||||
|
||||
/// Encrypted file with the selfie of the user holding a document,
|
||||
/// provided by the user; available for `passport”, `driver_license”,
|
||||
/// `identity_card” and `internal_passport”. The file can be decrypted
|
||||
/// and verified using the accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
selfie: PassportFile,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
DriverLicense {
|
||||
/// Base64-encoded encrypted Telegram Passport element data provided
|
||||
/// by the user, available for `personal_details”, `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport” and
|
||||
/// `address” types. Can be decrypted and verified using the
|
||||
/// accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
data: String,
|
||||
|
||||
/// Encrypted file with the front side of the document, provided by the
|
||||
/// user. Available for `passport”, `driver_license”, `identity_card”
|
||||
/// and `internal_passport”. The file can be decrypted and verified
|
||||
/// using the accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
front_side: PassportFile,
|
||||
|
||||
/// Encrypted file with the reverse side of the document, provided by
|
||||
/// the user. Available for `driver_license” and `identity_card”. The
|
||||
/// file can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
reverse_side: PassportFile,
|
||||
|
||||
/// Encrypted file with the selfie of the user holding a document,
|
||||
/// provided by the user; available for `passport”, `driver_license”,
|
||||
/// `identity_card” and `internal_passport”. The file can be decrypted
|
||||
/// and verified using the accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
selfie: PassportFile,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
IdentityCard {
|
||||
/// Base64-encoded encrypted Telegram Passport element data provided
|
||||
/// by the user, available for `personal_details”, `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport” and
|
||||
/// `address” types. Can be decrypted and verified using the
|
||||
/// accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
data: String,
|
||||
|
||||
/// Encrypted file with the front side of the document, provided by the
|
||||
/// user. Available for `passport”, `driver_license”, `identity_card”
|
||||
/// and `internal_passport”. The file can be decrypted and verified
|
||||
/// using the accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
front_side: PassportFile,
|
||||
|
||||
/// Encrypted file with the reverse side of the document, provided by
|
||||
/// the user. Available for `driver_license” and `identity_card”. The
|
||||
/// file can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
reverse_side: PassportFile,
|
||||
|
||||
/// Encrypted file with the selfie of the user holding a document,
|
||||
/// provided by the user; available for `passport”, `driver_license”,
|
||||
/// `identity_card” and `internal_passport”. The file can be decrypted
|
||||
/// and verified using the accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
selfie: PassportFile,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
InternalPassport {
|
||||
/// Base64-encoded encrypted Telegram Passport element data provided
|
||||
/// by the user, available for `personal_details”, `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport” and
|
||||
/// `address” types. Can be decrypted and verified using the
|
||||
/// accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
data: String,
|
||||
|
||||
/// Encrypted file with the front side of the document, provided by the
|
||||
/// user. Available for `passport”, `driver_license”, `identity_card”
|
||||
/// and `internal_passport”. The file can be decrypted and verified
|
||||
/// using the accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
front_side: PassportFile,
|
||||
|
||||
/// Encrypted file with the selfie of the user holding a document,
|
||||
/// provided by the user; available for `passport”, `driver_license”,
|
||||
/// `identity_card” and `internal_passport”. The file can be decrypted
|
||||
/// and verified using the accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
selfie: PassportFile,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
Address {
|
||||
/// Base64-encoded encrypted Telegram Passport element data provided
|
||||
/// by the user, available for `personal_details”, `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport” and
|
||||
/// `address” types. Can be decrypted and verified using the
|
||||
/// accompanying [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
data: String,
|
||||
},
|
||||
UtilityBill {
|
||||
/// Array of encrypted files with documents provided by the user,
|
||||
/// available for `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
files: Vec<PassportFile>,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
BankStatement {
|
||||
/// Array of encrypted files with documents provided by the user,
|
||||
/// available for `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
files: Vec<PassportFile>,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
RentalAgreement {
|
||||
/// Array of encrypted files with documents provided by the user,
|
||||
/// available for `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
files: Vec<PassportFile>,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
PassportRegistration {
|
||||
/// Array of encrypted files with documents provided by the user,
|
||||
/// available for `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
files: Vec<PassportFile>,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
TemporaryRegistration {
|
||||
/// Array of encrypted files with documents provided by the user,
|
||||
/// available for `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
files: Vec<PassportFile>,
|
||||
|
||||
/// Array of encrypted files with translated versions of documents
|
||||
/// provided by the user. Available if requested for `passport”,
|
||||
/// `driver_license”, `identity_card”, `internal_passport”,
|
||||
/// `utility_bill”, `bank_statement”, `rental_agreement”,
|
||||
/// `passport_registration” and `temporary_registration” types. Files
|
||||
/// can be decrypted and verified using the accompanying
|
||||
/// [`EncryptedCredentials`].
|
||||
///
|
||||
/// [`EncryptedCredentials`]:
|
||||
/// crate::types::EncryptedCredentials
|
||||
translation: Option<Vec<PassportFile>>,
|
||||
},
|
||||
PhoneNumber {
|
||||
/// User's verified phone number, available only for `phone_number”
|
||||
/// type.
|
||||
phone_number: String,
|
||||
},
|
||||
Email {
|
||||
/// User's verified email address, available only for `email” type.
|
||||
email: String,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone)]
|
||||
/// This object represents a file ready to be downloaded. The file can be
|
||||
/// downloaded via the link `https://api.telegram.org/file/bot<token>/<file_path>`.
|
||||
/// It is guaranteed that the link will be valid for at least 1 hour. When the
|
||||
/// link expires, a new one can be requested by calling [`Bot::get_file`].
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#file).
|
||||
///
|
||||
/// [`Bot::get_file`]: crate::Bot::get_file
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct File {
|
||||
/// Identifier for this file.
|
||||
pub file_id: String,
|
||||
|
||||
/// File size, if known.
|
||||
pub file_size: u32,
|
||||
|
||||
/// File path. Use `https://api.telegram.org/file/bot<token>/<file_path>`
|
||||
/// to get the file.
|
||||
pub file_path: String,
|
||||
}
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
use crate::types::True;
|
||||
|
||||
/// Upon receiving a message with this object, Telegram clients will
|
||||
/// display a reply interface to the user (act as if the user has
|
||||
/// selected the bot‘s message and tapped ’Reply'). This can be
|
||||
/// extremely useful if you want to create user-friendly step-by-step
|
||||
/// interfaces without having to sacrifice privacy mod
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)]
|
||||
/// Upon receiving a message with this object, Telegram clients will display a
|
||||
/// reply interface to the user (act as if the user has selected the bot‘s
|
||||
/// message and tapped ’Reply'). This can be extremely useful if you want to
|
||||
/// create user-friendly step-by-step interfaces without having to sacrifice
|
||||
/// [privacy mode].
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#forcereply).
|
||||
///
|
||||
/// [privacy mode]: https://core.telegram.org/bots#privacy-mode
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ForceReply {
|
||||
/// Shows reply interface to the user, as if they manually selected the
|
||||
/// bot‘s message and tapped ’Reply'
|
||||
/// bot‘s message and tapped ’Reply'.
|
||||
pub force_reply: True,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
/// Optional. Use this parameter if you want to force reply from specific
|
||||
/// users only. Targets: 1) users that are @mentioned in the text of the
|
||||
/// Use this parameter if you want to force reply from specific users only.
|
||||
/// Targets: 1) users that are `@mentioned` in the text of the
|
||||
/// [`Message`] object; 2) if the bot's message is a reply
|
||||
/// (has reply_to_message_id), sender of the original message.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub selective: Option<bool>,
|
||||
}
|
||||
|
|
|
@ -2,25 +2,38 @@ use serde::Deserialize;
|
|||
|
||||
use crate::types::{Animation, MessageEntity, PhotoSize};
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
/// This object represents a game. Use BotFather to create and edit games, their
|
||||
/// short names will act as unique identifiers.
|
||||
/// This object represents a game. Use [@Botfather] to create and edit games,
|
||||
/// their short names will act as unique identifiers.
|
||||
///
|
||||
/// [@Botfather]: https://t.me/botfather
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Game {
|
||||
/// Title of the game
|
||||
/// Title of the game.
|
||||
pub title: String,
|
||||
/// Description of the game
|
||||
|
||||
/// Description of the game.
|
||||
pub description: String,
|
||||
|
||||
/// Photo that will be displayed in the game message in chats.
|
||||
pub photo: Vec<PhotoSize>,
|
||||
/// Optional. Brief description of the game or high scores included in the
|
||||
/// game message. Can be automatically edited to include current high
|
||||
/// scores for the game when the bot calls setGameScore, or manually
|
||||
/// edited using editMessageText. 0-4096 characters.
|
||||
|
||||
/// Brief description of the game or high scores included in the game
|
||||
/// message. Can be automatically edited to include current high scores
|
||||
/// for the game when the bot calls [`Bot::set_game_score`], or manually
|
||||
/// edited using [`Bot::edit_message_text`]. 0-4096 characters.
|
||||
///
|
||||
/// [`Bot::set_game_score`]: crate::Bot::set_game_score
|
||||
///
|
||||
/// [`Bot::edit_message_text`]: crate::Bot::edit_message_text
|
||||
pub text: Option<String>,
|
||||
/// Optional. Special entities that appear in text, such as usernames,
|
||||
/// URLs, bot commands, etc.
|
||||
|
||||
/// Special entities that appear in text, such as usernames, URLs, bot
|
||||
/// commands, etc.
|
||||
pub text_entities: Option<Vec<MessageEntity>>,
|
||||
/// Optional. Animation that will be displayed in the game message in
|
||||
/// chats. Upload via BotFather
|
||||
|
||||
/// Animation that will be displayed in the game message in chats. Upload
|
||||
/// via [@Botfather].
|
||||
///
|
||||
/// [@Botfather]: https://t.me/botfather
|
||||
pub animation: Option<Animation>,
|
||||
}
|
||||
|
|
|
@ -2,13 +2,17 @@ use serde::Deserialize;
|
|||
|
||||
use crate::types::user::User;
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
/// This object represents one row of the high scores table for a game.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#gamehighscore).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct GameHighScore {
|
||||
/// Position in high score table for the game
|
||||
/// Position in high score table for the game.
|
||||
pub position: u32,
|
||||
/// User
|
||||
|
||||
/// User.
|
||||
pub user: User,
|
||||
/// Score
|
||||
|
||||
/// Score.
|
||||
pub score: u32,
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
/// This object represents one button of an inline keyboard.
|
||||
#[derive(Debug, Serialize, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinekeyboardbutton).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct InlineKeyboardButton {
|
||||
/// Label text on the button
|
||||
/// Label text on the button.
|
||||
pub text: String,
|
||||
|
||||
#[serde(flatten)]
|
||||
|
@ -13,24 +15,32 @@ pub struct InlineKeyboardButton {
|
|||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum InlineKeyboardButtonKind {
|
||||
/// HTTP or tg:// url to be opened when button is pressed
|
||||
/// HTTP or tg:// url to be opened when button is pressed.
|
||||
Url(String),
|
||||
/// Data to be sent in a callback query to the bot when button is pressed,
|
||||
/// 1-64 bytes
|
||||
|
||||
/// Data to be sent in a [`CallbackQuery`] to the bot when button is
|
||||
/// pressed, 1-64 bytes.
|
||||
///
|
||||
/// [`CallbackQuery`]: crate::types::CallbackQuery
|
||||
CallbackData(String),
|
||||
|
||||
/// If set, pressing the button will prompt the user to select one of their
|
||||
/// chats, open that chat and insert the bot‘s username and the specified
|
||||
/// inline query in the input field. Can be empty, in which case just the
|
||||
/// bot’s username will be inserted.
|
||||
///
|
||||
/// Note: This offers an easy way for users to start using your bot in
|
||||
/// inline mode when they are currently in a private chat with it.
|
||||
/// Especially useful when combined with switch_pm… actions – in this case
|
||||
/// the user will be automatically returned to the chat they switched from,
|
||||
/// skipping the chat selection screen.
|
||||
/// [inline mode] when they are currently in a private chat with it.
|
||||
/// Especially useful when combined with [switch_pm…] actions – in this
|
||||
/// case the user will be automatically returned to the chat they
|
||||
/// switched from, skipping the chat selection screen.
|
||||
///
|
||||
/// [inline mode]: https://core.telegram.org/bots/inline
|
||||
/// [switch_pm…]: https://core.telegram.org/bots/api#answerinlinequery
|
||||
SwitchInlineQuery(String),
|
||||
/// Optional. If set, pressing the button will insert the bot‘s username
|
||||
/// and the specified inline query in the current chat's input field.
|
||||
|
||||
/// If set, pressing the button will insert the bot‘s username and the
|
||||
/// specified inline query in the current chat's input field.
|
||||
/// Can be empty, in which case only the bot’s username will be
|
||||
/// inserted.
|
||||
///
|
||||
|
@ -41,9 +51,9 @@ pub enum InlineKeyboardButtonKind {
|
|||
* TODO: add LoginUrl, pay */
|
||||
}
|
||||
|
||||
/// Build buttons
|
||||
/// Build buttons.
|
||||
///
|
||||
/// Example:
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// use teloxide::types::InlineKeyboardButton;
|
||||
///
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
use crate::types::InlineKeyboardButton;
|
||||
|
||||
/// This object represents an inline keyboard that appears right next to the
|
||||
/// This object represents an [inline keyboard] that appears right next to the
|
||||
/// message it belongs to.
|
||||
///
|
||||
/// *Note*: This will only work in Telegram versions released after
|
||||
/// 9 April, 2016. Older clients will display unsupported message.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize, Default)]
|
||||
/// *Note*: This will only work in Telegram versions released after 9 April,
|
||||
/// 2016. Older clients will display unsupported message.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinekeyboardmarkup).
|
||||
///
|
||||
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Default)]
|
||||
pub struct InlineKeyboardMarkup {
|
||||
/// Array of button rows, each represented by an Array of
|
||||
/// [`InlineKeyboardButton`] objects
|
||||
/// Array of button rows, each represented by an array of
|
||||
/// [`InlineKeyboardButton`] objects.
|
||||
///
|
||||
/// [`InlineKeyboardButton`]: crate::types::InlineKeyboardButton
|
||||
pub inline_keyboard: Vec<Vec<InlineKeyboardButton>>,
|
||||
}
|
||||
|
||||
/// Build Markup
|
||||
/// Build `InlineKeyboardMarkup`.
|
||||
///
|
||||
/// Example:
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// use teloxide::types::{InlineKeyboardButton, InlineKeyboardMarkup};
|
||||
///
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
use crate::types::{Location, User};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
/// This object represents an incoming inline query. When the user sends an
|
||||
/// empty query, your bot could return some default or trending results.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequery).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQuery {
|
||||
/// Unique identifier for this query
|
||||
/// Unique identifier for this query.
|
||||
pub id: String,
|
||||
/// Sender
|
||||
|
||||
/// Sender.
|
||||
pub from: User,
|
||||
/// Optional. Sender location, only for bots that request user location
|
||||
|
||||
/// Sender location, only for bots that request user location.
|
||||
pub location: Option<Location>,
|
||||
/// Text of the query (up to 512 characters)
|
||||
|
||||
/// Text of the query (up to 512 characters).
|
||||
pub query: String,
|
||||
/// Offset of the results to be returned, can be controlled by the bot
|
||||
|
||||
/// Offset of the results to be returned, can be controlled by the bot.
|
||||
pub offset: String,
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ use crate::types::{
|
|||
};
|
||||
|
||||
/// This object represents one result of an inline query.
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize, From)]
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresult).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, From)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum InlineQueryResult {
|
||||
|
|
|
@ -1,33 +1,45 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to an article or web page.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultarticle).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultArticle {
|
||||
/// Unique identifier for this result, 1-64 Bytes
|
||||
/// Unique identifier for this result, 1-64 Bytes.
|
||||
pub id: String,
|
||||
/// Title of the result
|
||||
|
||||
/// Title of the result.
|
||||
pub title: String,
|
||||
/// Content of the message to be sent
|
||||
|
||||
/// Content of the message to be sent.
|
||||
pub input_message_content: InputMessageContent,
|
||||
/// Optional. Inline keyboard attached to the message
|
||||
|
||||
/// Inline keyboard attached to the message.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
/// Optional. URL of the result
|
||||
|
||||
/// URL of the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub url: Option<String>,
|
||||
/// Optional. Pass True, if you don't want the URL to be shown in the
|
||||
/// message
|
||||
|
||||
/// Pass `true`, if you don't want the URL to be shown in the
|
||||
/// message.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub hide_url: Option<bool>,
|
||||
/// Optional. Short description of the result
|
||||
|
||||
/// Short description of the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
/// Optional. Url of the thumbnail for the result
|
||||
|
||||
/// Url of the thumbnail for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_url: Option<String>,
|
||||
/// Optional. Thumbnail width
|
||||
|
||||
/// Thumbnail width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_width: Option<i32>,
|
||||
/// Optional. Thumbnail height
|
||||
|
||||
/// Thumbnail height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_height: Option<i32>,
|
||||
}
|
||||
|
|
|
@ -1,20 +1,49 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to an MP3 audio file. By default, this audio file will be
|
||||
/// sent by the user. Alternatively, you can use `input_message_content` to send
|
||||
/// a message with the specified content instead of the audio.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultaudio).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultAudio {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid URL for the audio file.
|
||||
pub audio_url: String,
|
||||
|
||||
/// Title.
|
||||
pub title: String,
|
||||
|
||||
/// Caption, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// Performer.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub performer: Option<String>,
|
||||
|
||||
/// Audio duration in seconds.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub audio_duration: Option<String>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the audio.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,15 +1,39 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to an MP3 audio file stored on the Telegram servers. By
|
||||
/// default, this audio file will be sent by the user. Alternatively, you can
|
||||
/// use `input_message_content` to send a message with the specified content
|
||||
/// instead of the audio.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedaudio).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultCachedAudio {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid file identifier for the audio file.
|
||||
pub audio_file_id: String,
|
||||
|
||||
/// Caption, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the audio.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,18 +1,46 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a file stored on the Telegram servers. By default, this
|
||||
/// file will be sent by the user with an optional caption. Alternatively, you
|
||||
/// can use `input_message_content` to send a message with the specified content
|
||||
/// instead of the file.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcacheddocument).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultCachedDocument {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// Title for the result.
|
||||
pub title: String,
|
||||
|
||||
/// A valid file identifier for the file.
|
||||
pub document_file_id: String,
|
||||
|
||||
/// Short description of the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
|
||||
/// Caption of the document to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the file.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,17 +1,44 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to an animated GIF file stored on the Telegram servers. By
|
||||
/// default, this animated GIF file will be sent by the user with an optional
|
||||
/// caption. Alternatively, you can use `input_message_content` to send a
|
||||
/// message with specified content instead of the animation.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedgif).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultCachedGif {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid file identifier for the GIF file.
|
||||
pub gif_file_id: String,
|
||||
|
||||
/// Title for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
|
||||
/// Caption of the GIF file to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [`ParseMode::Markdown`] or [`ParseMode::HTML`], if you want
|
||||
/// Telegram apps to show [bold, italic, fixed-width text or inline
|
||||
/// URLs] in the media caption.
|
||||
///
|
||||
/// [`ParseMode::Markdown`]: crate::types::ParseMode::Markdown
|
||||
/// [`ParseMode::HTML`]: crate::types::ParseMode::HTML
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the GIF animation.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,17 +1,44 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a video animation (H.264/MPEG-4 AVC video without
|
||||
/// sound) stored on the Telegram servers. By default, this animated MPEG-4 file
|
||||
/// will be sent by the user with an optional caption. Alternatively, you can
|
||||
/// use `input_message_content` to send a message with the specified content
|
||||
/// instead of the animation.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultCachedMpeg4Gif {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid file identifier for the MP4 file.
|
||||
pub mpeg4_file_id: String,
|
||||
|
||||
/// Title for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
|
||||
/// Caption of the MPEG-4 file to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the video animation.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,19 +1,47 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a photo stored on the Telegram servers. By default,
|
||||
/// this photo will be sent by the user with an optional caption. Alternatively,
|
||||
/// you can use `input_message_content` to send a message with the specified
|
||||
/// content instead of the photo.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedphoto).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultCachedPhoto {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid file identifier of the photo.
|
||||
pub photo_file_id: String,
|
||||
|
||||
/// Title for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
|
||||
/// Short description of the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
|
||||
/// Caption of the photo to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the photo.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,11 +1,26 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a sticker stored on the Telegram servers. By default,
|
||||
/// this sticker will be sent by the user. Alternatively, you can use
|
||||
/// `input_message_content` to send a message with the specified content instead
|
||||
/// of the sticker.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedsticker).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultCachedSticker {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid file identifier of the sticker.
|
||||
pub sticker_file_id: String,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the sticker.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,18 +1,46 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a video file stored on the Telegram servers. By
|
||||
/// default, this video file will be sent by the user with an optional caption.
|
||||
/// Alternatively, you can use `input_message_content` to send a message with
|
||||
/// the specified content instead of the video.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultCachedVideo {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid file identifier for the video file.
|
||||
pub video_file_id: String,
|
||||
|
||||
/// Title for each result.
|
||||
pub title: String,
|
||||
|
||||
/// Short description of the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
|
||||
/// Caption of the video to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the video.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,16 +1,42 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a voice message stored on the Telegram servers. By
|
||||
/// default, this voice message will be sent by the user. Alternatively, you can
|
||||
/// use `input_message_content` to send a message with the specified content
|
||||
/// instead of the voice message.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultCachedVoice {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid file identifier for the voice message.
|
||||
pub voice_file_id: String,
|
||||
|
||||
/// Voice message title.
|
||||
pub title: String,
|
||||
|
||||
/// Caption, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the voice message.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,22 +1,51 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a contact with a phone number. By default, this contact will be
|
||||
/// sent by the user. Alternatively, you can use `input_message_content` to send
|
||||
/// a message with the specified content instead of the contact.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultContact {
|
||||
/// Unique identifier for this result, 1-64 Bytes.
|
||||
pub id: String,
|
||||
|
||||
/// Contact's phone number.
|
||||
pub phone_number: String,
|
||||
|
||||
/// Contact's first name.
|
||||
pub first_name: String,
|
||||
|
||||
/// Contact's last name.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub last_name: Option<String>,
|
||||
|
||||
/// Additional data about the contact in the form of a [vCard], 0-2048
|
||||
/// bytes.
|
||||
///
|
||||
/// [VCard]: https://en.wikipedia.org/wiki/VCard
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub vcard: Option<String>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the contact.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
|
||||
/// Url of the thumbnail for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_url: Option<String>,
|
||||
|
||||
/// Thumbnail width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_width: Option<i32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_height: Option<i32>,
|
||||
}
|
||||
|
|
|
@ -1,25 +1,60 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a file. By default, this file will be sent by the user
|
||||
/// with an optional caption. Alternatively, you can use `input_message_content`
|
||||
/// to send a message with the specified content instead of the file. Currently,
|
||||
/// only **.PDF** and **.ZIP** files can be sent using this method.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultdocument).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultDocument {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// Title for the result.
|
||||
pub title: String,
|
||||
|
||||
/// Caption of the document to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// A valid URL for the file.
|
||||
pub document_url: String,
|
||||
|
||||
/// Mime type of the content of the file, either `application/pdf” or
|
||||
/// `application/zip”.
|
||||
pub mime_type: String,
|
||||
|
||||
/// Short description of the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
|
||||
/// Inline keyboard attached to the message.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the file.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
|
||||
/// URL of the thumbnail (jpeg only) for the file.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_url: Option<String>,
|
||||
|
||||
/// Thumbnail width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_width: Option<i32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_height: Option<i32>,
|
||||
}
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
use crate::types::InlineKeyboardMarkup;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)]
|
||||
/// Represents a [game].
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultgame).
|
||||
///
|
||||
/// [game]: https://core.telegram.org/bots/api#games
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultGame {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// Short name of the game.
|
||||
pub game_short_name: String,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
}
|
||||
|
|
|
@ -1,24 +1,58 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to an animated GIF file. By default, this animated GIF
|
||||
/// file will be sent by the user with optional caption. Alternatively, you can
|
||||
/// use `input_message_content` to send a message with the specified content
|
||||
/// instead of the animation.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultgif).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultGif {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid URL for the GIF file. File size must not exceed 1MB.
|
||||
pub gif_url: String,
|
||||
|
||||
/// Width of the GIF.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub gif_width: Option<i32>,
|
||||
|
||||
/// Height of the GIFv.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub gif_height: Option<i32>,
|
||||
|
||||
/// Duration of the GIF.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub gif_duration: Option<i32>,
|
||||
|
||||
/// URL of the static thumbnail for the result (jpeg or gif).
|
||||
pub thumb_url: String,
|
||||
|
||||
/// Title for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
|
||||
/// Caption of the GIF file to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the GIF animation.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,21 +1,48 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a location on a map. By default, the location will be sent by the
|
||||
/// user. Alternatively, you can use `input_message_content` to send a message
|
||||
/// with the specified content instead of the location.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultlocation).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultLocation {
|
||||
/// Unique identifier for this result, 1-64 Bytes.
|
||||
pub id: String,
|
||||
|
||||
/// Location latitude in degrees.
|
||||
pub latitude: f64,
|
||||
|
||||
/// Location longitude in degrees.
|
||||
pub longitude: f64,
|
||||
|
||||
/// Location title.
|
||||
pub title: String,
|
||||
|
||||
/// Period in seconds for which the location can be updated, should be
|
||||
/// between 60 and 86400.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub live_period: Option<i32>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the location.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
|
||||
/// Url of the thumbnail for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_url: Option<String>,
|
||||
|
||||
/// Thumbnail width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_width: Option<i32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_height: Option<i32>,
|
||||
}
|
||||
|
|
|
@ -1,24 +1,58 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a video animation (H.264/MPEG-4 AVC video without
|
||||
/// sound). By default, this animated MPEG-4 file will be sent by the user with
|
||||
/// optional caption. Alternatively, you can use `input_message_content` to send
|
||||
/// a message with the specified content instead of the animation.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultMpeg4Gif {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid URL for the MP4 file. File size must not exceed 1MB.
|
||||
pub mpeg4_url: String,
|
||||
|
||||
/// Video width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mpeg4_width: Option<i32>,
|
||||
|
||||
/// Video height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mpeg4_height: Option<i32>,
|
||||
|
||||
/// Video duration.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mpeg4_duration: Option<i32>,
|
||||
|
||||
/// URL of the static thumbnail (jpeg or gif) for the result.
|
||||
pub thumb_url: String,
|
||||
|
||||
/// Title for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
|
||||
/// Caption of the MPEG-4 file to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the video animation.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,27 +1,59 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
/// Represents a link to a photo. By default, this photo will be sent by the
|
||||
/// user with optional caption. Alternatively, you can use input_message_content
|
||||
/// to send a message with the specified content instead of the photo.
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// user with optional caption. Alternatively, you can use
|
||||
/// `input_message_content` to send a message with the specified content instead
|
||||
/// of the photo.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultphoto).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultPhoto {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid URL of the photo. Photo must be in **jpeg** format. Photo size
|
||||
/// must not exceed 5MB.
|
||||
pub photo_url: String,
|
||||
|
||||
/// URL of the thumbnail for the photo.
|
||||
pub thumb_url: String,
|
||||
|
||||
/// Width of the photo.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub photo_width: Option<i32>,
|
||||
|
||||
/// Height of the photo.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub photo_height: Option<i32>,
|
||||
|
||||
/// Title for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
|
||||
/// Short description of the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
|
||||
/// Caption of the photo to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the photo.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,24 +1,56 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a venue. By default, the venue will be sent by the user.
|
||||
/// Alternatively, you can use `input_message_content` to send a message with
|
||||
/// the specified content instead of the venue.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvenue).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultVenue {
|
||||
/// Unique identifier for this result, 1-64 Bytes.
|
||||
pub id: String,
|
||||
|
||||
/// Latitude of the venue location in degrees.
|
||||
pub latitude: f64,
|
||||
|
||||
/// Longitude of the venue location in degrees.
|
||||
pub longitude: f64,
|
||||
|
||||
/// Title of the venue.
|
||||
pub title: String,
|
||||
|
||||
/// Address of the venue.
|
||||
pub address: String,
|
||||
|
||||
/// Foursquare identifier of the venue if known.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub foursquare_id: Option<String>,
|
||||
|
||||
/// Foursquare type of the venue, if known. (For example,
|
||||
/// `arts_entertainment/default`, `arts_entertainment/aquarium` or
|
||||
/// `food/icecream`.)
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub foursquare_type: Option<String>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the venue.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
|
||||
/// Url of the thumbnail for the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_url: Option<String>,
|
||||
|
||||
/// Thumbnail width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_width: Option<i32>,
|
||||
|
||||
/// Thumbnail height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumb_height: Option<i32>,
|
||||
}
|
||||
|
|
|
@ -1,26 +1,69 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a page containing an embedded video player or a video
|
||||
/// file. By default, this video file will be sent by the user with an optional
|
||||
/// caption. Alternatively, you can use `input_messaage_content` to send a
|
||||
/// message with the specified content instead of the video.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvideo).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultVideo {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid URL for the embedded video player or video file.
|
||||
pub video_url: String,
|
||||
|
||||
/// Mime type of the content of video url, `text/html` or `video/mp4`.
|
||||
pub mime_type: String,
|
||||
|
||||
/// URL of the thumbnail (jpeg only) for the video.
|
||||
pub thumb_url: String,
|
||||
|
||||
/// Title for the result.
|
||||
pub title: String,
|
||||
|
||||
/// Caption of the video to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// Video width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub video_width: Option<i32>,
|
||||
|
||||
/// Video height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub video_height: Option<i32>,
|
||||
|
||||
/// Video duration in seconds.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub video_duration: Option<i32>,
|
||||
|
||||
/// Short description of the result.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the video. This field is
|
||||
/// **required** if [`InlineQueryResultVideo`] is used to send an HTML-page
|
||||
/// as a result (e.g., a YouTube video).
|
||||
///
|
||||
/// [`InlineQueryResultVideo`]:
|
||||
/// crate::types::InlineQueryResultVideo
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,18 +1,46 @@
|
|||
use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// Represents a link to a voice recording in an .ogg container encoded with
|
||||
/// OPUS. By default, this voice recording will be sent by the user.
|
||||
/// Alternatively, you can use `input_message_content` to send a message with
|
||||
/// the specified content instead of the the voice message.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvoice).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InlineQueryResultVoice {
|
||||
/// Unique identifier for this result, 1-64 bytes.
|
||||
pub id: String,
|
||||
|
||||
/// A valid URL for the voice recording.
|
||||
pub voice_url: String,
|
||||
|
||||
/// Recording title.
|
||||
pub title: String,
|
||||
|
||||
/// Caption, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub caption: Option<String>,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub parse_mode: Option<ParseMode>,
|
||||
|
||||
/// Recording duration in seconds.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub voice_duration: Option<i32>,
|
||||
|
||||
/// [Inline keyboard] attached to the message.
|
||||
///
|
||||
/// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reply_markup: Option<InlineKeyboardMarkup>,
|
||||
|
||||
/// Content of the message to be sent instead of the voice recording.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_message_content: Option<InputMessageContent>,
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize)]
|
||||
/// This object represents the contents of a file to be uploaded.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputfile).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq)]
|
||||
pub enum InputFile {
|
||||
File(PathBuf),
|
||||
Url(String),
|
||||
|
|
|
@ -1,165 +1,187 @@
|
|||
use crate::types::{InputFile, ParseMode};
|
||||
|
||||
// TODO: should variants use new-type?
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
/// This object represents the content of a media message to be sent.
|
||||
/// [More](https://core.telegram.org/bots/api#inputmedia)
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmedia).
|
||||
pub enum InputMedia {
|
||||
/// Represents a photo to be sent.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediaphoto).
|
||||
Photo {
|
||||
/// File to send.
|
||||
media: InputFile,
|
||||
/// Caption of the photo to be sent, 0-1024 characters
|
||||
|
||||
/// Caption of the photo to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
caption: Option<String>,
|
||||
/// Send [Markdown] or [HTML],
|
||||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [HTML]: crate::types::ParseMode::HTML
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::types::ParseMode
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
},
|
||||
|
||||
/// Represents a video to be sent.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediavideo).
|
||||
Video {
|
||||
/// File to send.File to send.
|
||||
// File to send.
|
||||
media: InputFile,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
||||
/// Thumbnail of the file sent; can be ignored if thumbnail generation
|
||||
/// for the file is supported server-side.
|
||||
/// The thumbnail should be in JPEG format and less than 200 kB in
|
||||
/// size. A thumbnail‘s width and height should not exceed 320.
|
||||
/// Ignored if the file is not uploaded using [InputFile::File].
|
||||
///
|
||||
/// [InputFile::File]: crate::types::InputFile::File
|
||||
/// for the file is supported server-side. The thumbnail should be in
|
||||
/// JPEG format and less than 200 kB in size. A thumbnail‘s width and
|
||||
/// height should not exceed 320. Ignored if the file is not uploaded
|
||||
/// using multipart/form-data.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
thumb: Option<InputFile>,
|
||||
|
||||
/// Caption of the video to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
caption: Option<String>,
|
||||
/// Send [Markdown] or [HTML],
|
||||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [HTML]: crate::types::ParseMode::HTML
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::types::ParseMode
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
/// Video width
|
||||
|
||||
/// Video width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
width: Option<u16>,
|
||||
/// Video height
|
||||
|
||||
/// Video height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
height: Option<u16>,
|
||||
/// Video duration
|
||||
|
||||
/// Video duration.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
duration: Option<u16>,
|
||||
/// Pass `true`, if the uploaded video is suitable for streaming
|
||||
|
||||
/// Pass `true`, if the uploaded video is suitable for streaming.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
supports_streaming: Option<bool>,
|
||||
},
|
||||
|
||||
/// Represents an animation file (GIF or H.264/MPEG-4 AVC video without
|
||||
/// sound) to be sent.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediaanimation).
|
||||
Animation {
|
||||
/// File to send.
|
||||
media: InputFile,
|
||||
|
||||
/// Thumbnail of the file sent; can be ignored if thumbnail generation
|
||||
/// for the file is supported server-side.
|
||||
/// The thumbnail should be in JPEG format and less than 200 kB in
|
||||
/// size. A thumbnail‘s width and height should not exceed 320.
|
||||
/// Ignored if the file is not uploaded using [InputFile::File].
|
||||
///
|
||||
/// [InputFile::File]: crate::types::InputFile::File
|
||||
/// for the file is supported server-side. The thumbnail should be in
|
||||
/// JPEG format and less than 200 kB in size. A thumbnail‘s width and
|
||||
/// height should not exceed 320. Ignored if the file is not uploaded
|
||||
/// using multipart/form-data.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
thumb: Option<InputFile>,
|
||||
/// Caption of the animation to be sent, 0-1024 characters
|
||||
|
||||
/// Caption of the animation to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
caption: Option<String>,
|
||||
/// Send [Markdown] or [HTML],
|
||||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [HTML]: crate::types::ParseMode::HTML
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::types::ParseMode
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
/// Animation width
|
||||
|
||||
/// Animation width.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
width: Option<u16>,
|
||||
/// Animation height
|
||||
|
||||
/// Animation height.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
height: Option<u16>,
|
||||
/// Animation duration
|
||||
|
||||
/// Animation duration.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
duration: Option<u16>,
|
||||
},
|
||||
|
||||
/// Represents an audio file to be treated as music to be sent.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediaaudio).
|
||||
Audio {
|
||||
/// File to send,
|
||||
/// File to send.
|
||||
media: InputFile,
|
||||
|
||||
/// Thumbnail of the file sent; can be ignored if thumbnail generation
|
||||
/// for the file is supported server-side.
|
||||
/// The thumbnail should be in JPEG format and less than 200 kB in
|
||||
/// size. A thumbnail‘s width and height should not exceed 320.
|
||||
/// Ignored if the file is not uploaded using [InputFile::File].
|
||||
///
|
||||
/// [InputFile::File]: crate::types::InputFile::File
|
||||
/// for the file is supported server-side. The thumbnail should be in
|
||||
/// JPEG format and less than 200 kB in size. A thumbnail‘s width and
|
||||
/// height should not exceed 320. Ignored if the file is not uploaded
|
||||
/// using multipart/form-data.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
thumb: Option<InputFile>,
|
||||
/// Caption of the audio to be sent, 0-1024 characters
|
||||
|
||||
/// Caption of the audio to be sent, 0-1024 characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
caption: Option<String>,
|
||||
/// Send [Markdown] or [HTML],
|
||||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [HTML]: crate::types::ParseMode::HTML
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::types::ParseMode
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<String>,
|
||||
/// Duration of the audio in seconds
|
||||
|
||||
/// Duration of the audio in seconds.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
duration: Option<u16>,
|
||||
/// Performer of the audio
|
||||
|
||||
/// Performer of the audio.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
performer: Option<String>,
|
||||
/// Title of the audio
|
||||
|
||||
/// Title of the audio.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
title: Option<String>,
|
||||
},
|
||||
|
||||
/// Represents a general file to be sent.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmediadocument).
|
||||
Document {
|
||||
/// File to send.
|
||||
media: InputFile,
|
||||
|
||||
/// Thumbnail of the file sent; can be ignored if thumbnail generation
|
||||
/// for the file is supported server-side.
|
||||
/// The thumbnail should be in JPEG format and less than 200 kB in
|
||||
/// size. A thumbnail‘s width and height should not exceed 320.
|
||||
/// Ignored if the file is not uploaded using [InputFile::File].
|
||||
///
|
||||
/// [InputFile::File]: crate::types::InputFile::File
|
||||
/// for the file is supported server-side. The thumbnail should be in
|
||||
/// JPEG format and less than 200 kB in size. A thumbnail‘s width and
|
||||
/// height should not exceed 320. Ignored if the file is not uploaded
|
||||
/// using multipart/form-data.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
thumb: Option<InputFile>,
|
||||
/// Caption of the document to be sent, 0-1024 characters
|
||||
|
||||
/// Caption of the document to be sent, 0-1024 charactersю
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
caption: Option<String>,
|
||||
/// Send [Markdown] or [HTML],
|
||||
/// if you want Telegram apps to show [bold, italic, fixed-width text
|
||||
/// or inline URLs] in the media caption.
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [HTML]: crate::types::ParseMode::HTML
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::types::ParseMode
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
},
|
||||
|
|
|
@ -2,39 +2,40 @@ use serde::Serialize;
|
|||
|
||||
use crate::types::ParseMode;
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
#[serde(untagged)]
|
||||
/// This object represents the content of a message to be sent as
|
||||
/// a result of an inline query.
|
||||
/// [More](https://core.telegram.org/bots/api#inputmessagecontent)
|
||||
/// This object represents the content of a message to be sent as a result of an
|
||||
/// inline query.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#inputmessagecontent).
|
||||
pub enum InputMessageContent {
|
||||
/// Represents the content of a text message to be sent as the result of an
|
||||
/// inline query.
|
||||
Text {
|
||||
/// Text of the message to be sent, 1-4096 characters
|
||||
/// Text of the message to be sent, 1-4096 characters.
|
||||
message_text: String,
|
||||
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show
|
||||
/// [bold, italic, fixed-width text or inline URLs] in the media
|
||||
/// caption.
|
||||
/// Send [Markdown] or [HTML], if you want Telegram apps to show [bold,
|
||||
/// italic, fixed-width text or inline URLs] in the media caption.
|
||||
///
|
||||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [HTML]: crate::types::ParseMode::HTML
|
||||
/// [bold, italic, fixed-width text or inline URLs]:
|
||||
/// crate::types::ParseMode
|
||||
/// [Markdown]: https://core.telegram.org/bots/api#markdown-style
|
||||
/// [HTML]: https://core.telegram.org/bots/api#html-style
|
||||
/// [bold, italic, fixed-width text or inline URLs]: https://core.telegram.org/bots/api#formatting-options
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
parse_mode: Option<ParseMode>,
|
||||
|
||||
/// Disables link previews for links in the sent message
|
||||
/// Disables link previews for links in the sent message.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
disable_web_page_preview: Option<bool>,
|
||||
},
|
||||
|
||||
/// Represents the content of a location message to be sent as the result
|
||||
/// of an inline query.
|
||||
Location {
|
||||
/// Latitude of the location in degrees
|
||||
/// Latitude of the location in degrees.
|
||||
latitude: f64,
|
||||
/// Longitude of the location in degrees
|
||||
|
||||
/// Longitude of the location in degrees.
|
||||
longitude: f64,
|
||||
|
||||
/// Period in seconds for which the location can be updated, should be
|
||||
|
@ -42,42 +43,50 @@ pub enum InputMessageContent {
|
|||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
live_period: Option<u32>,
|
||||
},
|
||||
|
||||
/// Represents the content of a venue message to be sent as the result of
|
||||
/// an inline query.
|
||||
Venue {
|
||||
/// Latitude of the venue in degrees
|
||||
/// Latitude of the venue in degrees.
|
||||
latitude: f64,
|
||||
/// Longitude of the venue in degrees
|
||||
|
||||
/// Longitude of the venue in degrees.
|
||||
longitude: f64,
|
||||
/// Name of the venue
|
||||
|
||||
/// Name of the venue.
|
||||
title: String,
|
||||
/// Address of the venue
|
||||
|
||||
/// Address of the venue.
|
||||
address: String,
|
||||
|
||||
/// Foursquare identifier of the venue, if known
|
||||
/// Foursquare identifier of the venue, if known.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
foursquare_id: Option<String>,
|
||||
|
||||
/// Foursquare type of the venue, if known. (For example,
|
||||
/// “arts_entertainment/default”, “arts_entertainment/aquarium”
|
||||
/// or “food/icecream”.)
|
||||
/// `arts_entertainment/default`, `arts_entertainment/aquarium`
|
||||
/// or `food/icecream`.)
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
foursquare_type: Option<String>,
|
||||
},
|
||||
|
||||
/// Represents the content of a contact message to be sent as the result of
|
||||
/// an inline query.
|
||||
Contact {
|
||||
/// Contact's phone number
|
||||
/// Contact's phone number.
|
||||
phone_number: String,
|
||||
/// Contact's first name
|
||||
|
||||
/// Contact's first name.
|
||||
first_name: String,
|
||||
|
||||
/// Contact's last name
|
||||
/// Contact's last name.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
last_name: Option<String>,
|
||||
|
||||
/// Additional data about the contact in the form of a
|
||||
/// [vCard](https://en.wikipedia.org/wiki/VCard), 0-2048 bytes
|
||||
/// Additional data about the contact in the form of a [vCard], 0-2048
|
||||
/// bytes.
|
||||
///
|
||||
/// [vCard]: https://en.wikipedia.org/wiki/VCard
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
vcard: Option<String>,
|
||||
},
|
||||
|
|
|
@ -1,8 +1,27 @@
|
|||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
|
||||
/// This object contains basic information about an invoice.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#invoice).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Invoice {
|
||||
/// Product name.
|
||||
pub title: String,
|
||||
|
||||
/// Product description.
|
||||
pub description: String,
|
||||
|
||||
/// Unique bot deep-linking parameter that can be used to generate this
|
||||
/// invoice.
|
||||
pub start_parameter: String,
|
||||
|
||||
/// Three-letter ISO 4217 currency code.
|
||||
pub currency: String,
|
||||
|
||||
/// Total price in the smallest units of the currency (integer, **not**
|
||||
/// float/double). For example, for a price of `US$ 1.45` pass `amount =
|
||||
/// 145`. See the exp parameter in [`currencies.json`], it shows the number
|
||||
/// of digits past the decimal point for each currency (2 for the
|
||||
/// majority of currencies).
|
||||
///
|
||||
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
|
||||
pub total_amount: i32,
|
||||
}
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
/// This object represents one button of the reply keyboard. For filter text
|
||||
/// buttons String can be used instead of this object to specify text of the
|
||||
/// button. Optional fields are mutually exclusive.
|
||||
#[derive(Debug, Serialize, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#keyboardbutton).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct KeyboardButton {
|
||||
/// Text of the button. If none of the optional fields are used, it will
|
||||
/// be sent as a message when the button is pressed
|
||||
/// be sent as a message when the button is pressed.
|
||||
pub text: String,
|
||||
|
||||
/// If `true`, the user's phone number will be sent as a contact
|
||||
/// when the button is pressed. Available in private chats only.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
/// Optional. If True, the user's phone number will be sent as a contact
|
||||
/// when the button is pressed. Available in private chats only
|
||||
pub request_contact: Option<bool>,
|
||||
|
||||
/// If `true`, the user's current location will be sent when the
|
||||
/// button is pressed. Available in private chats only.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
/// Optional. If True, the user's current location will be sent when the
|
||||
/// button is pressed. Available in private chats only
|
||||
pub request_location: Option<bool>,
|
||||
}
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)]
|
||||
/// This object represents a portion of the price for goods or services.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#labeledprice).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct LabeledPrice {
|
||||
/// Portion label
|
||||
/// Portion label.
|
||||
pub label: String,
|
||||
/// Price of the product in the smallest units of the
|
||||
/// [currency](https://core.telegram.org/bots/payments#supported-currencies)
|
||||
/// (integer, not float/double). For example, for a price of US$ 1.45 pass
|
||||
/// amount = 145. See the exp parameter in [`currencies.json`](https://core.telegram.org/bots/payments/currencies.json),
|
||||
/// it shows the number of digits past the decimal point for each currency
|
||||
/// (2 for the majority of currencies).
|
||||
|
||||
/// Price of the product in the smallest units of the [currency] (integer,
|
||||
/// **not** float/double). For example, for a price of `US$ 1.45` pass
|
||||
/// `amount = 145`. See the exp parameter in [`currencies.json`], it shows
|
||||
/// the number of digits past the decimal point for each currency (2
|
||||
/// for the majority of currencies).
|
||||
///
|
||||
/// [currency]: https://core.telegram.org/bots/payments#supported-currencies
|
||||
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
|
||||
pub amount: i32,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
/// This object represents a point on the map.
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Location {
|
||||
/// Longitude as defined by sender
|
||||
/// Longitude as defined by sender.
|
||||
pub longitude: f64,
|
||||
/// Latitude as defined by sender
|
||||
|
||||
/// Latitude as defined by sender.
|
||||
pub latitude: f64,
|
||||
}
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
/// This object represents a parameter of the inline keyboard button used to
|
||||
/// automatically authorize a user. Serves as a great replacement for the
|
||||
/// [Telegram Login Widget] when the user is coming from Telegram. All the user
|
||||
/// needs to do is tap/click a button and confirm that they want to log in:
|
||||
///
|
||||
/// <div align="center">
|
||||
/// <img src="https://core.telegram.org/file/811140015/1734/8VZFkwWXalM.97872/6127fa62d8a0bf2b3c" width=300 />
|
||||
/// </div>
|
||||
///
|
||||
/// [Telegram Login Widget]: https://core.telegram.org/widgets/login
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct LoginUrl {
|
||||
pub url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub forward_text: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub bot_username: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub request_write_access: Option<bool>,
|
||||
}
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
/// This object describes the position on faces where a mask should be placed by
|
||||
/// default.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#maskposition).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct MaskPosition {
|
||||
/// The part of the face relative to which the mask should be placed. One
|
||||
/// of `forehead`, `eyes`, `mouth`, or `chin`.
|
||||
pub point: String,
|
||||
|
||||
/// Shift by X-axis measured in widths of the mask scaled to the face size,
|
||||
/// from left to right. For example, choosing `-1.0` will place mask just
|
||||
/// to the left of the default mask position.
|
||||
pub x_shift: f64,
|
||||
|
||||
/// Shift by Y-axis measured in heights of the mask scaled to the face
|
||||
/// size, from top to bottom. For example, `1.0` will place the mask just
|
||||
/// below the default mask position.
|
||||
pub y_shift: f64,
|
||||
|
||||
/// Mask scaling coefficient. For example, `2.0` means double size.
|
||||
pub scale: f64,
|
||||
}
|
||||
|
|
|
@ -6,80 +6,147 @@ use crate::types::{
|
|||
SuccessfulPayment, True, User, Venue, Video, VideoNote, Voice,
|
||||
};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
/// This object represents a message.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#message).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Message {
|
||||
/// Unique message identifier inside this chat.
|
||||
#[serde(rename = "message_id")]
|
||||
pub id: i32,
|
||||
|
||||
/// Date the message was sent in Unix time.
|
||||
pub date: i32,
|
||||
|
||||
/// Conversation the message belongs to.
|
||||
pub chat: Chat,
|
||||
|
||||
#[serde(flatten)]
|
||||
pub kind: MessageKind,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum MessageKind {
|
||||
Common {
|
||||
/// Sender, empty for messages sent to channels.
|
||||
#[serde(flatten)]
|
||||
from: Sender,
|
||||
|
||||
#[serde(flatten)]
|
||||
forward_kind: ForwardKind,
|
||||
|
||||
/// Date the message was last edited in Unix time.
|
||||
edit_date: Option<i32>,
|
||||
|
||||
#[serde(flatten)]
|
||||
media_kind: MediaKind,
|
||||
|
||||
/// Inline keyboard attached to the message. `login_url` buttons are
|
||||
/// represented as ordinary `url` buttons.
|
||||
reply_markup: Option<InlineKeyboardMarkup>,
|
||||
},
|
||||
NewChatMembers {
|
||||
/// New members that were added to the group or supergroup and
|
||||
/// information about them (the bot itself may be one of these
|
||||
/// members).
|
||||
new_chat_members: Vec<User>,
|
||||
},
|
||||
LeftChatMember {
|
||||
/// A member was removed from the group, information about them (this
|
||||
/// member may be the bot itself).
|
||||
left_chat_member: User,
|
||||
},
|
||||
NewChatTitle {
|
||||
/// A chat title was changed to this value.
|
||||
new_chat_title: String,
|
||||
},
|
||||
NewChatPhoto {
|
||||
/// A chat photo was change to this value.
|
||||
new_chat_photo: Vec<PhotoSize>,
|
||||
},
|
||||
DeleteChatPhoto {
|
||||
/// Service message: the chat photo was deleted.
|
||||
delete_chat_photo: True,
|
||||
},
|
||||
GroupChatCreated {
|
||||
/// Service message: the group has been created.
|
||||
group_chat_created: True,
|
||||
},
|
||||
SupergroupChatCreated {
|
||||
/// Service message: the supergroup has been created. This field can‘t
|
||||
/// be received in a message coming through updates, because bot can’t
|
||||
/// be a member of a supergroup when it is created. It can only be
|
||||
/// found in `reply_to_message` if someone replies to a very first
|
||||
/// message in a directly created supergroup.
|
||||
supergroup_chat_created: True,
|
||||
},
|
||||
ChannelChatCreated {
|
||||
/// Service message: the channel has been created. This field can‘t be
|
||||
/// received in a message coming through updates, because bot can’t be
|
||||
/// a member of a channel when it is created. It can only be found in
|
||||
/// `reply_to_message` if someone replies to a very first message in a
|
||||
/// channel.
|
||||
channel_chat_created: True,
|
||||
},
|
||||
Migrate {
|
||||
/// The group has been migrated to a supergroup with the specified
|
||||
/// identifier. This number may be greater than 32 bits and some
|
||||
/// programming languages may have difficulty/silent defects in
|
||||
/// interpreting it. But it is smaller than 52 bits, so a signed 64 bit
|
||||
/// integer or double-precision float type are safe for storing this
|
||||
/// identifier.
|
||||
migrate_to_chat_id: i64,
|
||||
|
||||
/// The supergroup has been migrated from a group with the specified
|
||||
/// identifier. This number may be greater than 32 bits and some
|
||||
/// programming languages may have difficulty/silent defects in
|
||||
/// interpreting it. But it is smaller than 52 bits, so a signed 64 bit
|
||||
/// integer or double-precision float type are safe for storing this
|
||||
/// identifier.
|
||||
migrate_from_chat_id: i64,
|
||||
},
|
||||
Pinned {
|
||||
/// Specified message was pinned. Note that the Message object in this
|
||||
/// field will not contain further `reply_to_message` fields even if it
|
||||
/// is itself a reply.
|
||||
pinned: Box<Message>,
|
||||
},
|
||||
Invoice {
|
||||
/// Message is an invoice for a [payment], information about the
|
||||
/// invoice. [More about payments »].
|
||||
///
|
||||
/// [payment]: https://core.telegram.org/bots/api#payments
|
||||
/// [More about payments »]: https://core.telegram.org/bots/api#payments
|
||||
invoice: Invoice,
|
||||
},
|
||||
SuccessfulPayment {
|
||||
/// Message is a service message about a successful payment,
|
||||
/// information about the payment. [More about payments »].
|
||||
///
|
||||
/// [More about payments »]: https://core.telegram.org/bots/api#payments
|
||||
successful_payment: SuccessfulPayment,
|
||||
},
|
||||
ConnectedWebsite {
|
||||
/// The domain name of the website on which the user has logged in.
|
||||
/// [More about Telegram Login »].
|
||||
///
|
||||
/// [More about Telegram Login »]: https://core.telegram.org/widgets/login
|
||||
connected_website: String,
|
||||
},
|
||||
PassportData {
|
||||
/// Telegram Passport data.
|
||||
passport_data: PassportData,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub enum Sender {
|
||||
/// If message is sent from Chat
|
||||
/// Sender of a message from chat.
|
||||
#[serde(rename = "from")]
|
||||
User(User),
|
||||
/// If message is sent from Channel
|
||||
|
||||
/// Signature of a sender of a message from a channel.
|
||||
#[serde(rename = "author_signature")]
|
||||
Signature(String),
|
||||
}
|
||||
|
@ -92,7 +159,7 @@ pub enum ForwardedFrom {
|
|||
SenderName(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ForwardKind {
|
||||
ChannelForward {
|
||||
|
@ -116,75 +183,137 @@ pub enum ForwardKind {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum MediaKind {
|
||||
Animation {
|
||||
/// Message is an animation, information about the animation. For
|
||||
/// backward compatibility, when this field is set, the document field
|
||||
/// will also be set.
|
||||
animation: Animation,
|
||||
|
||||
#[doc(hidden)]
|
||||
/// "For backward compatibility" (c) Telegram Docs
|
||||
/// "For backward compatibility" (c) Telegram Docs.
|
||||
#[serde(skip)]
|
||||
document: (),
|
||||
|
||||
/// Caption for the animation, 0-1024 characters.
|
||||
caption: Option<String>,
|
||||
|
||||
/// For messages with a caption, special entities like usernames, URLs,
|
||||
/// bot commands, etc. that appear in the caption.
|
||||
#[serde(default = "Vec::new")]
|
||||
caption_entities: Vec<MessageEntity>,
|
||||
},
|
||||
Audio {
|
||||
/// Message is an audio file, information about the file.
|
||||
audio: Audio,
|
||||
|
||||
/// Caption for the audio, 0-1024 characters.
|
||||
caption: Option<String>,
|
||||
|
||||
/// For messages with a caption, special entities like usernames, URLs,
|
||||
/// bot commands, etc. that appear in the caption.
|
||||
#[serde(default = "Vec::new")]
|
||||
caption_entities: Vec<MessageEntity>,
|
||||
},
|
||||
Contact {
|
||||
/// Message is a shared contact, information about the contact.
|
||||
contact: Contact,
|
||||
},
|
||||
Document {
|
||||
/// Message is a general file, information about the file.
|
||||
document: Document,
|
||||
|
||||
/// Caption for the document, 0-1024 characters.
|
||||
caption: Option<String>,
|
||||
|
||||
/// For messages with a caption, special entities like usernames, URLs,
|
||||
/// bot commands, etc. that appear in the caption.
|
||||
#[serde(default = "Vec::new")]
|
||||
caption_entities: Vec<MessageEntity>,
|
||||
},
|
||||
Game {
|
||||
/// Message is a game, information about the game. [More
|
||||
/// about games »].
|
||||
///
|
||||
/// [More about games »]: https://core.telegram.org/bots/api#games
|
||||
game: Game,
|
||||
},
|
||||
Location {
|
||||
/// Message is a shared location, information about the location.
|
||||
location: Location,
|
||||
},
|
||||
Photo {
|
||||
/// Message is a photo, available sizes of the photo.
|
||||
photo: Vec<PhotoSize>,
|
||||
|
||||
/// Caption for the photo, 0-1024 characters.
|
||||
caption: Option<String>,
|
||||
|
||||
/// For messages with a caption, special entities like usernames, URLs,
|
||||
/// bot commands, etc. that appear in the caption.
|
||||
#[serde(default = "Vec::new")]
|
||||
caption_entities: Vec<MessageEntity>,
|
||||
|
||||
/// The unique identifier of a media message group this message belongs
|
||||
/// to.
|
||||
media_group_id: Option<String>,
|
||||
},
|
||||
Poll {
|
||||
/// Message is a native poll, information about the poll.
|
||||
poll: Poll,
|
||||
},
|
||||
Sticker {
|
||||
/// Message is a sticker, information about the sticker.
|
||||
sticker: Sticker,
|
||||
},
|
||||
Text {
|
||||
/// For text messages, the actual UTF-8 text of the message, 0-4096
|
||||
/// characters.
|
||||
text: String,
|
||||
|
||||
/// For text messages, special entities like usernames, URLs, bot
|
||||
/// commands, etc. that appear in the text.
|
||||
#[serde(default = "Vec::new")]
|
||||
entities: Vec<MessageEntity>,
|
||||
},
|
||||
Video {
|
||||
/// Message is a video, information about the video.
|
||||
video: Video,
|
||||
|
||||
/// Caption for the video, 0-1024 characters.
|
||||
caption: Option<String>,
|
||||
|
||||
/// For messages with a caption, special entities like usernames, URLs,
|
||||
/// bot commands, etc. that appear in the caption.
|
||||
#[serde(default = "Vec::new")]
|
||||
caption_entities: Vec<MessageEntity>,
|
||||
|
||||
/// The unique identifier of a media message group this message belongs
|
||||
/// to.
|
||||
media_group_id: Option<String>,
|
||||
},
|
||||
VideoNote {
|
||||
/// Message is a [video note], information about the video message.
|
||||
///
|
||||
/// [video note]: https://telegram.org/blog/video-messages-and-telescope
|
||||
video_note: VideoNote,
|
||||
},
|
||||
Voice {
|
||||
/// Message is a voice message, information about the file.
|
||||
voice: Voice,
|
||||
|
||||
/// Caption for the voice, 0-1024 characters.
|
||||
caption: Option<String>,
|
||||
|
||||
/// For messages with a caption, special entities like usernames, URLs,
|
||||
/// bot commands, etc. that appear in the caption.
|
||||
#[serde(default = "Vec::new")]
|
||||
caption_entities: Vec<MessageEntity>,
|
||||
},
|
||||
Venue {
|
||||
/// Message is a venue, information about the venue.
|
||||
venue: Venue,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
use crate::types::User;
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
/// This object represents one special entity in a text message. For example,
|
||||
/// hashtags, usernames, URLs, etc.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#messageentity).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct MessageEntity {
|
||||
#[serde(flatten)]
|
||||
pub kind: MessageEntityKind,
|
||||
|
||||
/// Offset in UTF-16 code units to the start of the entity.
|
||||
pub offset: usize,
|
||||
|
||||
/// Length of the entity in UTF-16 code units.
|
||||
pub length: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[serde(tag = "type")]
|
||||
pub enum MessageEntityKind {
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
use crate::types::ShippingAddress;
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
|
||||
/// This object represents information about an order.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#orderinfo).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct OrderInfo {
|
||||
/// User's name.
|
||||
pub name: String,
|
||||
|
||||
/// User's phone number.
|
||||
pub phone_number: String,
|
||||
|
||||
/// User's email.
|
||||
pub email: String,
|
||||
|
||||
/// User's shipping address.
|
||||
pub shipping_address: ShippingAddress,
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone)]
|
||||
/// ## Formatting options
|
||||
/// The Bot API supports basic formatting for messages.
|
||||
/// You can use **bold** and *italic* text, as well as [inline links](https://example.com) and `pre-formatted code` in
|
||||
/// your bots' messages. Telegram clients will render them accordingly. You can
|
||||
/// use either markdown-style or HTML-style formatting.
|
||||
/// You can use **bold** and *italic* text, as well as [inline links](https://example.com)
|
||||
/// and `pre-formatted code` in your bots' messages. Telegram clients will
|
||||
/// render them accordingly. You can use either markdown-style or HTML-style
|
||||
/// formatting.
|
||||
///
|
||||
/// Note that Telegram clients will display an alert to the user before opening
|
||||
/// an inline link (‘Open this link?’ together with the full URL).
|
||||
|
@ -68,6 +68,7 @@ use serde::{Deserialize, Serialize};
|
|||
/// [Markdown]: crate::types::ParseMode::Markdown
|
||||
/// [HTML]: crate::types::ParseMode::HTML
|
||||
/// [SendMessage]: crate::requests::payloads::SendMessage
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub enum ParseMode {
|
||||
HTML,
|
||||
Markdown,
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
use super::{EncryptedCredentials, EncryptedPassportElement};
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
/// Contains information about Telegram Passport data shared with the bot by the
|
||||
/// user.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#passportdata).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct PassportData {
|
||||
/// Array with information about documents and other Telegram Passport
|
||||
/// elements that was shared with the bot.
|
||||
pub data: Vec<EncryptedPassportElement>,
|
||||
|
||||
/// Encrypted credentials required to decrypt the data.
|
||||
pub credentials: EncryptedCredentials,
|
||||
}
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
/// This object represents a file uploaded to Telegram Passport. Currently all
|
||||
/// Telegram Passport files are in JPEG format when decrypted and don't exceed
|
||||
/// 10MB.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#passportfile).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct PassportFile {
|
||||
/// Identifier for this file.
|
||||
pub file_id: String,
|
||||
|
||||
/// File size.
|
||||
pub file_size: u64,
|
||||
|
||||
/// Unix time when the file was uploaded.
|
||||
pub file_date: u64,
|
||||
}
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||
/// This object represents one size of a photo or a [`Document`] /
|
||||
/// [`Sticker`] thumbnail.
|
||||
/// This object represents one size of a photo or a [file]/[sticker] thumbnail.
|
||||
///
|
||||
/// [`Document`]: crate::types::Document
|
||||
/// [`Sticker`]: crate::types::Sticker
|
||||
/// [file]: crate::types::Document
|
||||
/// [sticker]: crate::types::Sticker
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct PhotoSize {
|
||||
/// Identifier for this file
|
||||
/// Identifier for this file.
|
||||
pub file_id: String,
|
||||
/// Photo width
|
||||
|
||||
/// Photo width.
|
||||
pub width: i32,
|
||||
/// Photo height
|
||||
|
||||
/// Photo height.
|
||||
pub height: i32,
|
||||
/// Optional. File size
|
||||
|
||||
/// File size.
|
||||
pub file_size: Option<u32>,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,29 @@
|
|||
/// This object contains information about a poll.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#poll).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Poll {
|
||||
/// Unique poll identifier.
|
||||
pub id: String,
|
||||
|
||||
/// Poll question, 1-255 characters.
|
||||
pub question: String,
|
||||
|
||||
/// List of poll options.
|
||||
pub options: Vec<PollOption>,
|
||||
|
||||
/// `true`, if the poll is closed.
|
||||
pub is_closed: bool,
|
||||
}
|
||||
|
||||
/// This object contains information about one answer option in a poll.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#polloption).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct PollOption {
|
||||
/// Option text, 1-100 characters.
|
||||
pub text: String,
|
||||
|
||||
/// Number of users that voted for this option.
|
||||
pub voter_count: i32,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,36 @@
|
|||
use crate::types::{OrderInfo, User};
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
/// This object contains information about an incoming pre-checkout query.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#precheckoutquery).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct PreCheckoutQuery {
|
||||
/// Unique query identifier.
|
||||
pub id: String,
|
||||
|
||||
/// User who sent the query.
|
||||
pub from: User,
|
||||
|
||||
/// Three-letter ISO 4217 [currency] code.
|
||||
///
|
||||
/// [currency]: https://core.telegram.org/bots/payments#supported-currencies
|
||||
pub currency: String,
|
||||
|
||||
/// Total price in the _smallest units_ of the currency (integer, **not**
|
||||
/// float/double). For example, for a price of `US$ 1.45` pass `amount =
|
||||
/// 145`. See the exp parameter in [`currencies.json`], it shows the number
|
||||
/// of digits past the decimal point for each currency (2 for the
|
||||
/// majority of currencies).
|
||||
///
|
||||
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
|
||||
pub total_amount: i32,
|
||||
|
||||
/// Bot specified invoice payload.
|
||||
pub invoice_payload: String,
|
||||
|
||||
/// Identifier of the shipping option chosen by the user.
|
||||
pub shipping_option_id: Option<String>,
|
||||
|
||||
/// Order info provided by the user.
|
||||
pub order_info: Option<OrderInfo>,
|
||||
}
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
use crate::types::KeyboardButton;
|
||||
|
||||
/// This object represents a custom keyboard with reply options.
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)]
|
||||
/// This object represents a [custom keyboard] with reply options (see
|
||||
/// [Introduction to bots] for details and examples).
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#replykeyboardmarkup).
|
||||
///
|
||||
/// [custom keyboard]: https://core.telegram.org/bots#keyboards
|
||||
/// [Introduction to bots]: https://core.telegram.org/bots#keyboards
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ReplyKeyboardMarkup {
|
||||
/// Array of button rows, each represented by an Array of
|
||||
/// [`KeyboardButton`] objects
|
||||
|
@ -9,32 +15,31 @@ pub struct ReplyKeyboardMarkup {
|
|||
/// [`KeyboardButton`]: crate::types::KeyboardButton
|
||||
pub keyboard: Vec<Vec<KeyboardButton>>,
|
||||
|
||||
/// Requests clients to resize the keyboard vertically for optimal fit
|
||||
/// (e.g., make the keyboard smaller if there are just two rows of
|
||||
/// buttons). Defaults to `false`, in which case the custom keyboard is
|
||||
/// always of the same height as the app's standard keyboard.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
/// Optional. Requests clients to resize the keyboard vertically for
|
||||
/// optimal fit (e.g., make the keyboard smaller if there are just two
|
||||
/// rows of buttons). Defaults to false, in which case the custom
|
||||
/// keyboard is always of the same height as the app's standard
|
||||
/// keyboard.
|
||||
pub resize_keyboard: Option<bool>,
|
||||
|
||||
/// Requests clients to hide the keyboard as soon as it's been used. The
|
||||
/// keyboard will still be available, but clients will automatically
|
||||
/// display the usual letter-keyboard in the chat – the user can press a
|
||||
/// special button in the input field to see the custom keyboard again.
|
||||
/// Defaults to `false`.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
/// Optional. Requests clients to hide the keyboard as soon as it's been
|
||||
/// used. The keyboard will still be available, but clients will
|
||||
/// automatically display the usual letter-keyboard in the chat – the user
|
||||
/// can press a special button in the input field to see the custom
|
||||
/// keyboard again. Defaults to false.
|
||||
pub one_time_keyboard: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
/// Optional. Use this parameter if you want to show the keyboard to
|
||||
/// specific users only. Targets: 1) users that are @mentioned in the text
|
||||
/// of the [`Message`] object; 2) if the bot's message is a reply
|
||||
/// (has reply_to_message_id), sender of the original message.
|
||||
/// Use this parameter if you want to show the keyboard to specific users
|
||||
/// only. Targets: 1) users that are `@mentioned` in the `text` of the
|
||||
/// [`Message`] object; 2) if the bot's message is a reply (has
|
||||
/// `reply_to_message_id`), sender of the original message.
|
||||
///
|
||||
/// Example: A user requests to change the bot‘s language, bot replies to
|
||||
/// the request with a keyboard to select the new language. Other users in
|
||||
/// the group don’t see the keyboard.
|
||||
/// the request with a keyboard to select the new language. Other users
|
||||
/// in the group don’t see the keyboard.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub selective: Option<bool>,
|
||||
}
|
||||
|
|
|
@ -1,35 +1,34 @@
|
|||
use crate::types::True;
|
||||
|
||||
/// Upon receiving a message with this object, Telegram clients will remove
|
||||
/// the current custom keyboard and display the default letter-keyboard.
|
||||
/// By default, custom keyboards are displayed until a new keyboard is sent
|
||||
/// by a bot. An exception is made for one-time keyboards that are hidden
|
||||
/// immediately after the user presses a button (see [`ReplyKeyboardMarkup`]).
|
||||
/// Upon receiving a message with this object, Telegram clients will remove the
|
||||
/// current custom keyboard and display the default letter-keyboard. By default,
|
||||
/// custom keyboards are displayed until a new keyboard is sent by a bot. An
|
||||
/// exception is made for one-time keyboards that are hidden immediately after
|
||||
/// the user presses a button (see [`ReplyKeyboardMarkup`]).
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#replykeyboardremove).
|
||||
///
|
||||
/// [`ReplyKeyboardMarkup`]: crate::types::ReplyKeyboardMarkup
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ReplyKeyboardRemove {
|
||||
/// Requests clients to remove the custom keyboard (user will not be able
|
||||
/// to summon this keyboard; if you want to hide the keyboard from
|
||||
/// sight but keep it accessible, use one_time_keyboard in
|
||||
/// ReplyKeyboardMarkup)
|
||||
/// to summon this keyboard; if you want to hide the keyboard from sight
|
||||
/// but keep it accessible, use one_time_keyboard in
|
||||
/// [`ReplyKeyboardMarkup`]).
|
||||
///
|
||||
/// [`ReplyKeyboardMarkup`]: crate::types::ReplyKeyboardMarkup
|
||||
pub remove_keyboard: True,
|
||||
|
||||
/// Optional. Use this parameter if you want to show the keyboard to
|
||||
/// specific users only.
|
||||
/// Use this parameter if you want to remove the keyboard for specific
|
||||
/// users only. Targets: 1) users that are `@mentioned` in the `text` of
|
||||
/// the [`Message`] object; 2) if the bot's message is a reply (has
|
||||
/// `reply_to_message_id`), sender of the original message.
|
||||
///
|
||||
/// Targets:
|
||||
/// 1. users that are `@mentioned` in the text of the [`Message`]
|
||||
/// 2. if the bot's message is a reply (has [`reply_to_message_id`]),
|
||||
/// sender of the original message.
|
||||
///
|
||||
/// ## Example
|
||||
/// A user requests to change the bot‘s language, bot replies to
|
||||
/// the request with a keyboard to select the new language. Other users in
|
||||
/// the group don’t see the keyboard.
|
||||
/// Example: A user votes in a poll, bot returns confirmation message in
|
||||
/// reply to the vote and removes the keyboard for that user, while still
|
||||
/// showing the keyboard with poll options to users who haven't voted yet.
|
||||
///
|
||||
/// [`Message`]: crate::types::Message
|
||||
/// [`reply_to_message_id`]: crate::types::ForwardKind::Origin
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub selective: Option<bool>,
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::types::{
|
|||
ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove,
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ReplyMarkup {
|
||||
Inline(InlineKeyboardMarkup),
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
/// Contains information about why a request was unsuccessful.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#responseparameters).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ResponseParameters {
|
||||
/// The group has been migrated to a supergroup with the specified
|
||||
/// identifier. This number may be greater than 32 bits and some
|
||||
/// programming languages may have difficulty/silent defects in
|
||||
/// interpreting it. But it is smaller than 52 bits, so a signed 64 bit
|
||||
/// integer or double-precision float type are safe for storing this
|
||||
/// identifier.
|
||||
MigrateToChatId(i64),
|
||||
|
||||
/// In case of exceeding flood control, the number of seconds left to wait
|
||||
/// before the request can be repeated.
|
||||
RetryAfter(i32),
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::types::{ChatId, InlineKeyboardMarkup, LabeledPrice};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct SendInvoice {
|
||||
pub chat_id: ChatId,
|
||||
pub title: String,
|
||||
|
|
|
@ -1,9 +1,23 @@
|
|||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
|
||||
/// This object represents a shipping address.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#shippingaddress).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ShippingAddress {
|
||||
/// ISO 3166-1 alpha-2 country code.
|
||||
pub country_code: String,
|
||||
|
||||
/// State, if applicable.
|
||||
pub state: String,
|
||||
|
||||
/// City.
|
||||
pub city: String,
|
||||
|
||||
/// First line for the address.
|
||||
pub street_line1: String,
|
||||
|
||||
/// Second line for the address.
|
||||
pub street_line2: String,
|
||||
|
||||
/// Address post code.
|
||||
pub post_code: String,
|
||||
}
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
use crate::types::LabeledPrice;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Deserialize, Serialize)]
|
||||
/// This object represents one shipping option.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#shippingoption).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ShippingOption {
|
||||
/// Shipping option identifier
|
||||
/// Shipping option identifier.
|
||||
pub id: String,
|
||||
/// Option title
|
||||
|
||||
/// Option title.
|
||||
pub title: String,
|
||||
/// List of price portions
|
||||
|
||||
/// List of price portions.
|
||||
pub prices: Vec<LabeledPrice>,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
use crate::types::{ShippingAddress, User};
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
/// This object contains information about an incoming shipping query.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#shippingquery).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct ShippingQuery {
|
||||
/// Unique query identifier.
|
||||
pub id: String,
|
||||
|
||||
/// User who sent the query.
|
||||
pub from: User,
|
||||
|
||||
/// Bot specified invoice payload.
|
||||
pub invoice_payload: String,
|
||||
|
||||
/// User specified shipping address.
|
||||
pub shipping_address: ShippingAddress,
|
||||
}
|
||||
|
|
|
@ -1,14 +1,36 @@
|
|||
use crate::types::{MaskPosition, PhotoSize};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
/// This object represents a sticker.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#sticker).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Sticker {
|
||||
/// Identifier for this file.
|
||||
pub file_id: String,
|
||||
|
||||
/// Sticker width.
|
||||
pub width: u16,
|
||||
|
||||
/// Sticker height.
|
||||
pub height: u16,
|
||||
|
||||
/// `true`, if the sticker is [animated].
|
||||
///
|
||||
/// [animated]: https://telegram.org/blog/animated-stickers
|
||||
pub is_animated: bool,
|
||||
|
||||
/// Sticker thumbnail in the .webp or .jpg format.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
|
||||
/// Emoji associated with the sticker.
|
||||
pub emoji: Option<String>,
|
||||
|
||||
/// Name of the sticker set to which the sticker belongs.
|
||||
pub set_name: Option<String>,
|
||||
|
||||
/// For mask stickers, the position where the mask should be placed.
|
||||
pub mask_position: Option<MaskPosition>,
|
||||
|
||||
/// File size.
|
||||
pub file_size: Option<u32>,
|
||||
}
|
||||
|
|
|
@ -1,10 +1,24 @@
|
|||
use crate::types::Sticker;
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
/// This object represents a sticker set.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#stickerset).
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct StickerSet {
|
||||
/// Sticker set name.
|
||||
pub name: String,
|
||||
|
||||
/// Sticker set title.
|
||||
pub title: String,
|
||||
|
||||
/// `true`, if the sticker set contains [animated stickers].
|
||||
///
|
||||
/// [animates stickers]: https://telegram.org/blog/animated-stickers
|
||||
pub is_animated: bool,
|
||||
|
||||
/// `true`, if the sticker set contains masks.
|
||||
pub contains_masks: bool,
|
||||
|
||||
/// List of all set stickers.
|
||||
pub stickers: Vec<Sticker>,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,36 @@
|
|||
use crate::types::OrderInfo;
|
||||
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
|
||||
/// This object contains basic information about a successful payment.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#successfulpayment).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct SuccessfulPayment {
|
||||
/// Three-letter ISO 4217 [currency] code.
|
||||
///
|
||||
/// [currency]: https://core.telegram.org/bots/payments#supported-currencies
|
||||
pub currency: String,
|
||||
|
||||
/// Total price in the smallest units of the currency (integer, not
|
||||
/// float/double). For example, for a price of `US$ 1.45` pass `amount =
|
||||
/// 145`. See the exp parameter in [`currencies.json`], it shows the
|
||||
/// number of digits past the decimal point for each currency (2 for
|
||||
/// the majority of currencies).
|
||||
///
|
||||
/// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
|
||||
pub total_amount: i32,
|
||||
|
||||
/// Bot specified invoice payload.
|
||||
pub invoice_payload: String,
|
||||
|
||||
/// Identifier of the shipping option chosen by the user.
|
||||
pub shipping_option_id: Option<String>,
|
||||
|
||||
/// Order info provided by the user.
|
||||
pub order_info: Option<OrderInfo>,
|
||||
|
||||
/// Telegram payment identifier.
|
||||
pub telegram_payment_charge_id: String,
|
||||
|
||||
/// Provider payment identifier.
|
||||
pub provider_payment_charge_id: String,
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Default)]
|
||||
pub struct False;
|
||||
|
||||
impl std::convert::TryFrom<bool> for False {
|
||||
|
|
|
@ -3,7 +3,7 @@ use serde::{
|
|||
ser::{Serialize, Serializer},
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Default)]
|
||||
pub struct True;
|
||||
|
||||
impl std::convert::TryFrom<bool> for True {
|
||||
|
|
|
@ -2,24 +2,60 @@
|
|||
|
||||
use crate::types::{CallbackQuery, ChosenInlineResult, InlineQuery, Message};
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
/// This [object] represents an incoming update.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#update).
|
||||
///
|
||||
/// [object]: https://core.telegram.org/bots/api#available-types
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Update {
|
||||
/// The update‘s unique identifier. Update identifiers start from a certain
|
||||
/// positive number and increase sequentially. This ID becomes especially
|
||||
/// handy if you’re using [Webhooks], since it allows you to ignore
|
||||
/// repeated updates or to restore the correct update sequence, should
|
||||
/// they get out of order. If there are no new updates for at least a
|
||||
/// week, then identifier of the next update will be chosen randomly
|
||||
/// instead of sequentially.
|
||||
///
|
||||
/// [Webhooks]: crate::Bot::set_webhook
|
||||
#[serde(rename = "update_id")]
|
||||
pub id: i32,
|
||||
|
||||
#[serde(flatten)]
|
||||
pub kind: UpdateKind,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum UpdateKind {
|
||||
/// New incoming message of any kind — text, photo, sticker, etc.
|
||||
Message(Message),
|
||||
|
||||
/// New version of a message that is known to the bot and was edited.
|
||||
EditedMessage(Message),
|
||||
|
||||
/// New incoming channel post of any kind — text, photo, sticker, etc.
|
||||
ChannelPost(Message),
|
||||
|
||||
/// New version of a channel post that is known to the bot and was edited.
|
||||
EditedChannelPost(Message),
|
||||
|
||||
/// New incoming [inline] query.
|
||||
///
|
||||
/// [inline]: https://core.telegram.org/bots/api#inline-mode
|
||||
InlineQuery(InlineQuery),
|
||||
|
||||
/// The result of an [inline] query that was chosen by a user and sent to
|
||||
/// their chat partner. Please see our documentation on the [feedback
|
||||
/// collecting] for details on how to enable these updates for your bot.
|
||||
///
|
||||
/// [inline]: https://core.telegram.org/bots/api#inline-mode
|
||||
/// [feedback collecting]: https://core.telegram.org/bots/inline#collecting-feedback
|
||||
ChosenInlineResult(ChosenInlineResult),
|
||||
|
||||
/// New incoming callback query.
|
||||
CallbackQuery(CallbackQuery),
|
||||
// TODO: Add more variants
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -1,10 +1,26 @@
|
|||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)]
|
||||
/// This object represents a Telegram user or bot.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#user).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct User {
|
||||
/// Unique identifier for this user or bot.
|
||||
pub id: i32,
|
||||
|
||||
/// `true`, if this user is a bot.
|
||||
pub is_bot: bool,
|
||||
|
||||
/// User‘s or bot’s first name.
|
||||
pub first_name: String,
|
||||
|
||||
/// User‘s or bot’s last name.
|
||||
pub last_name: Option<String>,
|
||||
|
||||
/// User‘s or bot’s username.
|
||||
pub username: Option<String>,
|
||||
|
||||
/// [IETF language tag] of the user's language.
|
||||
///
|
||||
/// [IETF language tag]: https://en.wikipedia.org/wiki/IETF_language_tag
|
||||
pub language_code: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)]
|
||||
/// This object represent a user's profile pictures.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#userprofilephotos).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct UserProfilePhotos {
|
||||
/// Total number of profile pictures the target user has.
|
||||
pub total_count: u32,
|
||||
|
||||
/// Requested profile pictures (in up to 4 sizes each).
|
||||
pub photos: Vec<Vec<PhotoSize>>,
|
||||
}
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
use crate::types::Location;
|
||||
|
||||
/// This object represents a venue.
|
||||
#[derive(Debug, Deserialize, PartialEq, Serialize, Clone)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Venue {
|
||||
/// Venue location
|
||||
/// Venue location.
|
||||
pub location: Location,
|
||||
/// Name of the venue
|
||||
|
||||
/// Name of the venue.
|
||||
pub title: String,
|
||||
/// Address of the venue
|
||||
|
||||
/// Address of the venue.
|
||||
pub address: String,
|
||||
/// Foursquare identifier of the venue
|
||||
|
||||
/// Foursquare identifier of the venue.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub foursquare_id: Option<String>,
|
||||
|
||||
/// Foursquare type of the venue. (For example,
|
||||
/// “arts_entertainment/default”, “arts_entertainment/aquarium” or
|
||||
/// “food/icecream”.)
|
||||
/// `arts_entertainment/default`, `arts_entertainment/aquarium` or
|
||||
/// `food/icecream`.)
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub foursquare_type: Option<String>, // TODO: is this enum?...
|
||||
}
|
||||
|
|
|
@ -1,20 +1,28 @@
|
|||
use crate::types::PhotoSize;
|
||||
|
||||
/// This object represents a video file.
|
||||
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)]
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#video).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Video {
|
||||
/// Identifier for this file
|
||||
/// Identifier for this file.
|
||||
pub file_id: String,
|
||||
/// Video width as defined by sender
|
||||
|
||||
/// Video width as defined by sender.
|
||||
pub width: u32,
|
||||
/// Video height as defined by sender
|
||||
|
||||
/// Video height as defined by sender.
|
||||
pub height: u32,
|
||||
/// Duration of the video in seconds as defined by sender
|
||||
|
||||
/// Duration of the video in seconds as defined by sender.
|
||||
pub duration: u32,
|
||||
/// Video thumbnail
|
||||
|
||||
/// Video thumbnail.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
/// Mime type of a file as defined by sender
|
||||
|
||||
/// Mime type of a file as defined by sender.
|
||||
pub mime_type: Option<String>,
|
||||
/// File size
|
||||
|
||||
/// File size.
|
||||
pub file_size: Option<u32>,
|
||||
}
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
use crate::types::PhotoSize;
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
/// This object represents a [video message](https://telegram.org/blog/video-messages-and-telescope)
|
||||
/// (available in Telegram apps as of v.4.0).
|
||||
/// This object represents a [video message] (available in Telegram apps as of
|
||||
/// [v.4.0]).
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#videonote).
|
||||
///
|
||||
/// [video message]: https://telegram.org/blog/video-messages-and-telescope
|
||||
/// [v4.0]: https://telegram.org/blog/video-messages-and-telescope
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct VideoNote {
|
||||
/// Identifier for this file
|
||||
/// Identifier for this file.
|
||||
pub file_id: String,
|
||||
|
||||
/// Video width and height (diameter of the video message) as defined by
|
||||
/// sender
|
||||
/// sender.
|
||||
pub length: u32,
|
||||
/// Duration of the video in seconds as defined by sender
|
||||
|
||||
/// Duration of the video in seconds as defined by sender.
|
||||
pub duration: u32,
|
||||
/// Optional. Video thumbnail
|
||||
|
||||
/// Video thumbnail.
|
||||
pub thumb: Option<PhotoSize>,
|
||||
/// Optional. File size
|
||||
|
||||
/// File size.
|
||||
pub file_size: Option<u32>,
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
#[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
/// This object represents a voice note.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#voice).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct Voice {
|
||||
/// Identifier for this file
|
||||
/// Identifier for this file.
|
||||
pub file_id: String,
|
||||
/// Duration of the audio in seconds as defined by sender
|
||||
|
||||
/// Duration of the audio in seconds as defined by sender.
|
||||
pub duration: u32,
|
||||
/// Optional. MIME type of the file as defined by sender
|
||||
|
||||
/// MIME type of the file as defined by sender.
|
||||
pub mime_type: Option<String>,
|
||||
/// Optional. File size
|
||||
|
||||
/// File size.
|
||||
pub file_size: Option<u64>,
|
||||
}
|
||||
|
|
|
@ -1,23 +1,31 @@
|
|||
/// Contains information about the current status of a webhook.
|
||||
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)]
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#webhookinfo).
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
pub struct WebhookInfo {
|
||||
/// Webhook URL, may be empty if webhook is not set up
|
||||
/// Webhook URL, may be empty if webhook is not set up.
|
||||
pub url: String,
|
||||
/// True, if a custom certificate was provided for webhook certificate
|
||||
/// checks
|
||||
|
||||
/// `true`, if a custom certificate was provided for webhook certificate
|
||||
/// checks.
|
||||
pub has_custom_certificate: bool,
|
||||
/// Number of updates awaiting delivery
|
||||
|
||||
/// Number of updates awaiting delivery.
|
||||
pub pending_update_count: u32,
|
||||
/// Optional. Unix time for the most recent error that happened when trying
|
||||
/// to deliver an update via webhook
|
||||
|
||||
/// Unix time for the most recent error that happened when trying to
|
||||
/// deliver an update via webhook.
|
||||
pub last_error_date: Option<u64>,
|
||||
/// Optional. Error message in human-readable format for the most recent
|
||||
/// error that happened when trying to deliver an update via webhook
|
||||
|
||||
/// Error message in human-readable format for the most recent error that
|
||||
/// happened when trying to deliver an update via webhook.
|
||||
pub last_error_message: Option<String>,
|
||||
/// Optional. Maximum allowed number of simultaneous HTTPS connections to
|
||||
/// the webhook for update delivery
|
||||
|
||||
/// Maximum allowed number of simultaneous HTTPS connections to the webhook
|
||||
/// for update delivery.
|
||||
pub max_connections: Option<u32>,
|
||||
/// Optional. A list of update types the bot is subscribed to. Defaults
|
||||
/// to all update types
|
||||
|
||||
/// A list of update types the bot is subscribed to. Defaults to all update
|
||||
/// types.
|
||||
pub allowed_updates: Option<Vec<String>>,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue