Merge branch 'dev' of github.com:async-telegram-bot/async-telegram-bot into dev

This commit is contained in:
Waffle 2019-09-04 11:08:17 +03:00
commit 8fe2db0259
24 changed files with 157 additions and 155 deletions

View file

@ -45,8 +45,6 @@ pub trait Request<'a> {
pub type RequestFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
// todo: better name?
#[derive(Debug)]
pub struct RequestInfo<'a> {

View file

@ -1,6 +1,5 @@
use crate::core::types::PhotoSize;
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Audio {
pub file_id: String,
@ -14,5 +13,5 @@ pub struct Audio {
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub thumb: Option<PhotoSize>
pub thumb: Option<PhotoSize>,
}

View file

@ -1,6 +1,5 @@
use crate::core::types::{ChatPermissions, ChatPhoto, Message};
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
pub struct Chat {
pub id: i32,
@ -9,7 +8,6 @@ pub struct Chat {
pub photo: Option<ChatPhoto>,
}
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
#[serde(rename_all = "snake_case")]
#[serde(untagged)]
@ -20,35 +18,33 @@ pub enum ChatType {
type_: NotPrivateChatType,
description: Option<String>,
invite_link: Option<String>,
pinned_message: Option<Box<Message>>
pinned_message: Option<Box<Message>>,
},
Private {
username: Option<String>,
first_name: Option<String>,
last_name: Option<String>
}
last_name: Option<String>,
},
}
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "type")]
pub enum NotPrivateChatType {
Channel {
username: Option<String>
username: Option<String>,
},
Group {
permissions: Option<ChatPermissions>
permissions: Option<ChatPermissions>,
},
Supergroup {
username: Option<String>,
sticker_set_name: Option<String>,
can_set_sticker_set: Option<bool>,
permissions: Option<ChatPermissions>
}
permissions: Option<ChatPermissions>,
},
}
#[test]
fn test_chat_de() {
use serde_json::from_str;

View file

@ -1,4 +1,4 @@
use crate::core::types::{User, ChatMemberStatus};
use crate::core::types::{ChatMemberStatus, User};
/// This object contains information about one member of the chat.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
@ -7,32 +7,48 @@ pub struct ChatMember {
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
///Optional. 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
///Optional. 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
///Optional. 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
///Optional. 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
///Optional. 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
///Optional. 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
///Optional. 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
///Optional. 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
///Optional. 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 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)
///Optional. 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)
pub can_promote_members: Option<bool>,
///Optional. Restricted only. True, if the user can send text messages, contacts, locations and venues
///Optional. 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
///Optional. Restricted only. True, if the user can send audios, documents,
/// photos, videos, video notes and voice notes, implies can_send_messages
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
///Optional. Restricted only. True, if the user can send animations, games,
/// stickers and use inline bots, implies can_send_media_messages
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
///Optional. Restricted only. True, if user may add web page previews to
/// his messages, implies can_send_media_messages
pub can_add_web_page_previews: Option<bool>,
}

View file

@ -4,14 +4,14 @@ use serde::Deserialization;
/// This object represents a phone contact.
struct Contact {
/// Contact's phone number
phone_number: String,
pub phone_number: String,
/// Contact's first name
first_name: String,
pub first_name: String,
/// Optional. Contact's last name
last_name: Option<String>,
pub last_name: Option<String>,
/// Optional. Contact's user identifier in Telegram
user_id: Option<i64>,
pub user_id: Option<i64>,
/// Optional. Additional data about the contact in the form of a
/// [vCard](https://en.wikipedia.org/wiki/VCard)
vcard: Option<String>,
pub vcard: Option<String>,
}

View file

@ -1,6 +1,5 @@
use crate::core::types::PhotoSize;
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
pub struct Document {
pub file_id: String,

View file

@ -5,7 +5,7 @@
/// interfaces without having to sacrifice privacy mod
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ForceReply {
force_reply: True,
pub force_reply: True,
#[serde(skip_serializing_if = "Not::not")]
selective: bool,
pub selective: bool,
}

View file

@ -1,9 +1,9 @@
/// This object represents one button of an inline keyboard.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct InlineKeyboardButton {
text: String,
pub text: String,
#[serde(flatten)]
kind: InlineKeyboardButtonKind,
pub kind: InlineKeyboardButtonKind,
}
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)]

View file

@ -1,5 +1,5 @@
/// This object represents an inline keyboard that appears right next to the message it belongs to.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct InlineKeyboardMarkup {
inline_keyboard: Vec<Vec<InlineKeyboardButton>>,
pub inline_keyboard: Vec<Vec<InlineKeyboardButton>>,
}

View file

@ -6,18 +6,20 @@ pub enum InputFile {
}
impl serde::Serialize for InputFile {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
InputFile::File(path) => {
// NOTE: file should be actually attached with multipart/form-data
serializer.serialize_str(
// TODO: remove unwrap (?)
&format!("attach://{}", path.file_name().unwrap().to_string_lossy())
&format!("attach://{}", path.file_name().unwrap().to_string_lossy()),
)
},
}
InputFile::Url(url) => serializer.serialize_str(url),
InputFile::FileId(id) => serializer.serialize_str(id),
}
}
}

View file

@ -15,12 +15,13 @@ pub enum InputMedia {
#[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.
/// if you want Telegram apps to show [bold, italic, fixed-width text or
/// inline URLs] in the media caption.
///
/// [Markdown]: crate::core::types::ParseMode::Markdown
/// [Html]: crate::core::types::ParseMode::Html
/// [bold, italic, fixed-width text or inline URLs]: crate::core::types::ParseMode
/// [bold, italic, fixed-width text or inline URLs]:
/// crate::core::types::ParseMode
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<ParseMode>,
},
@ -28,8 +29,8 @@ pub enum InputMedia {
/// 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.
/// 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 thumbnails width and height should not exceed 320.
/// Ignored if the file is not uploaded using [InputFile::File].
@ -40,12 +41,13 @@ pub enum InputMedia {
#[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.
/// if you want Telegram apps to show [bold, italic, fixed-width text or
/// inline URLs] in the media caption.
///
/// [Markdown]: crate::core::types::ParseMode::Markdown
/// [Html]: crate::core::types::ParseMode::Html
/// [bold, italic, fixed-width text or inline URLs]: crate::core::types::ParseMode
/// [bold, italic, fixed-width text or inline URLs]:
/// crate::core::types::ParseMode
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<ParseMode>,
/// Video width
@ -61,12 +63,13 @@ pub enum InputMedia {
#[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.
/// Represents an animation file (GIF or H.264/MPEG-4 AVC video without
/// sound) to be sent.
Animation {
/// File to send.
media: InputFile,
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is
/// supported server-side.
/// 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 thumbnails width and height should not exceed 320.
/// Ignored if the file is not uploaded using [InputFile::File].
@ -78,12 +81,13 @@ pub enum InputMedia {
#[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.
/// if you want Telegram apps to show [bold, italic, fixed-width text or
/// inline URLs] in the media caption.
///
/// [Markdown]: crate::core::types::ParseMode::Markdown
/// [Html]: crate::core::types::ParseMode::Html
/// [bold, italic, fixed-width text or inline URLs]: crate::core::types::ParseMode
/// [bold, italic, fixed-width text or inline URLs]:
/// crate::core::types::ParseMode
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<ParseMode>,
/// Animation width
@ -100,8 +104,8 @@ pub enum InputMedia {
Audio {
/// File to send,
media: InputFile,
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is
/// supported server-side.
/// 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 thumbnails width and height should not exceed 320.
/// Ignored if the file is not uploaded using [InputFile::File].
@ -113,12 +117,13 @@ pub enum InputMedia {
#[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.
/// if you want Telegram apps to show [bold, italic, fixed-width text or
/// inline URLs] in the media caption.
///
/// [Markdown]: crate::core::types::ParseMode::Markdown
/// [Html]: crate::core::types::ParseMode::Html
/// [bold, italic, fixed-width text or inline URLs]: crate::core::types::ParseMode
/// [bold, italic, fixed-width text or inline URLs]:
/// crate::core::types::ParseMode
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<String>,
/// Duration of the audio in seconds
@ -129,14 +134,14 @@ pub enum InputMedia {
performer: Option<String>,
/// Title of the audio
#[serde(skip_serializing_if = "Option::is_none")]
title: Option<String>
title: Option<String>,
},
/// Represents a general file to be sent.
Document {
/// File to send.
media: InputFile,
/// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is
/// supported server-side.
/// 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 thumbnails width and height should not exceed 320.
/// Ignored if the file is not uploaded using [InputFile::File].
@ -148,12 +153,13 @@ pub enum InputMedia {
#[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.
/// if you want Telegram apps to show [bold, italic, fixed-width text or
/// inline URLs] in the media caption.
///
/// [Markdown]: crate::core::types::ParseMode::Markdown
/// [Html]: crate::core::types::ParseMode::Html
/// [bold, italic, fixed-width text or inline URLs]: crate::core::types::ParseMode
/// [bold, italic, fixed-width text or inline URLs]:
/// crate::core::types::ParseMode
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<ParseMode>,
},
@ -221,7 +227,7 @@ mod tests {
parse_mode: None,
duration: None,
performer: None,
title: None
title: None,
};
let actual_json = serde_json::to_string(&video).unwrap();

View file

@ -1,9 +1,9 @@
/// This object represents one button of the reply keyboard.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct KeyboardButton {
text: String,
pub text: String,
#[serde(skip_serializing_if = "Not::not")]
request_contact: bool,
pub request_contact: bool,
#[serde(skip_serializing_if = "Not::not")]
request_location: bool,
pub request_location: bool,
}

View file

@ -4,7 +4,7 @@ use serde::{Serialization, Deserialization};
/// This object represents a point on the map.
struct Location {
/// Longitude as defined by sender
longitude: f64,
pub longitude: f64,
/// Latitude as defined by sender
latitude: f64,
pub latitude: f64,
}

View file

@ -1,10 +1,10 @@
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct LoginUrl {
url: String,
pub url: String,
#[serde(skip_serializing_if = "Option::is_none")]
forward_text: Option<String>,
pub forward_text: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
bot_username: Option<String>,
pub bot_username: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
request_write_access: Option<bool>,
pub request_write_access: Option<bool>,
}

View file

@ -1,6 +1,5 @@
use crate::core::types::User;
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
pub struct MessageEntity {
#[serde(flatten)]
@ -9,7 +8,6 @@ pub struct MessageEntity {
pub length: usize,
}
#[derive(Debug, Deserialize, Eq, Hash, PartialEq)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "type")]

View file

@ -1,49 +1,34 @@
use self::not_implemented_types::*;
pub use self::{
answer_pre_checkout_query::AnswerPreCheckoutQuery,
answer_shipping_query::AnswerShippingQuery,
audio::Audio,
chat::Chat,
chat_permissions::ChatPermissions,
chat_photo::ChatPhoto,
chat_member::ChatMember,
document::Document,
invoice::Invoice,
label_price::LabeledPrice,
message::Message,
message_entity::MessageEntity,
order_info::OrderInfo,
photo_size::PhotoSize,
pre_checkout_query::PreCheckoutQuery,
send_invoice::SendInvoice,
shipping_address::ShippingAddress,
shipping_option::ShippingOption,
shipping_query::ShippingQuery,
sticker::Sticker,
successful_payment::SuccessfulPayment,
user::User,
input_file::InputFile,
input_media::InputMedia,
parse_mode::ParseMode,
video::Video
answer_pre_checkout_query::AnswerPreCheckoutQuery, answer_shipping_query::AnswerShippingQuery,
audio::Audio, chat::Chat, chat_member::ChatMember, chat_permissions::ChatPermissions,
chat_photo::ChatPhoto, document::Document, input_file::InputFile, input_media::InputMedia,
invoice::Invoice, label_price::LabeledPrice, message::Message, message_entity::MessageEntity,
order_info::OrderInfo, parse_mode::ParseMode, photo_size::PhotoSize,
pre_checkout_query::PreCheckoutQuery, send_invoice::SendInvoice,
shipping_address::ShippingAddress, shipping_option::ShippingOption,
shipping_query::ShippingQuery, sticker::Sticker, successful_payment::SuccessfulPayment,
user::User, video::Video,
};
mod answer_pre_checkout_query;
mod answer_shipping_query;
mod audio;
mod chat;
mod chat_member;
mod chat_permissions;
mod chat_photo;
mod chat_member;
mod document;
mod input_file;
mod input_media;
mod invoice;
mod label_price;
mod message;
mod message_entity;
mod not_implemented_types;
mod order_info;
mod parse_mode;
mod photo_size;
mod pre_checkout_query;
mod send_invoice;
@ -53,7 +38,4 @@ mod shipping_query;
mod sticker;
mod successful_payment;
mod user;
mod input_file;
mod input_media;
mod parse_mode;
mod video;

View file

@ -1,27 +1,30 @@
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
/// ## 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.
/// 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).
/// Note that Telegram clients will display an alert to the user before opening
/// an inline link (Open this link? together with the full URL).
///
/// Links `tg://user?id=<user_id>` can be used to mention a user by their id without using a username.
/// Please note:
/// Links `tg://user?id=<user_id>` can be used to mention a user by their id
/// without using a username. Please note:
///
/// - These links will work only if they are used inside an inline link.
/// For example, they will not work, when used in an inline keyboard button or in a message text.
/// - The mentions are only guaranteed to work if: **A**. the user is a member in the group where he
/// was mentioned or **B**. the user has contacted the bot in the past or has sent a callback
/// query to the bot via inline button and has not restricted linking to their account in
/// `Settings > Privacy & Security > Forwarded Messages`.
/// - These links will work only if they are used inside an inline link. For
/// example, they will not work, when used in an inline keyboard button or in
/// a message text.
/// - The mentions are only guaranteed to work if: **A**. the user is a member
/// in the group where he was mentioned or **B**. the user has contacted the
/// bot in the past or has sent a callback query to the bot via inline button
/// and has not restricted linking to their account in `Settings > Privacy &
/// Security > Forwarded Messages`.
///
/// ## Markdown style
/// To use this mode, pass [Markdown] in the `parse_mode` field when using [SendMessage] (or other methods).
/// To use this mode, pass [Markdown] in the `parse_mode` field when using
/// [SendMessage] (or other methods).
///
/// Use the following syntax in your message:
///
@ -37,7 +40,8 @@ use serde::{Serialize, Deserialize};
/// ```
///
/// ## HTML style
/// To use this mode, pass [HTML] in the `parse_mode` field when using [SendMessage] (or other methods).
/// To use this mode, pass [HTML] in the `parse_mode` field when using
/// [SendMessage] (or other methods).
///
/// The following tags are currently supported:
///
@ -54,9 +58,12 @@ use serde::{Serialize, Deserialize};
///
/// - Only the tags mentioned above are currently supported.
/// - Tags must not be nested.
/// - All `<`, `>` and `&` symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (`<` with `&lt;`, `>` with `&gt;` and `&` with `&amp;`).
/// - All `<`, `>` and `&` symbols that are not a part of a tag or an HTML
/// entity must be replaced with the corresponding HTML entities (`<` with
/// `&lt;`, `>` with `&gt;` and `&` with `&amp;`).
/// - All numerical HTML entities are supported.
/// - The API currently supports only the following named HTML entities: `&lt;`, `&gt;`, `&amp;` and `&quot;`.
/// - The API currently supports only the following named HTML entities: `&lt;`,
/// `&gt;`, `&amp;` and `&quot;`.
pub enum ParseMode {
HTML,
Markdown,

View file

@ -2,6 +2,6 @@
pub struct PhotoSize {
pub file_id: String,
pub width: i32,
pub heigth: i32,
pub file_size: Option<u32>
pub height: i32,
pub file_size: Option<u32>,
}

View file

@ -1,11 +1,11 @@
/// This object represents a custom keyboard with reply options.
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ReplyKeyboardMarkup {
keyboard: Vec<Vec<KeyboardButton>>,
pub keyboard: Vec<Vec<KeyboardButton>>,
#[serde(skip_serializing_if = "Not::not")]
resize_keyboard: bool,
pub resize_keyboard: bool,
#[serde(skip_serializing_if = "Not::not")]
one_time_keyboard: bool,
pub one_time_keyboard: bool,
#[serde(skip_serializing_if = "Not::not")]
selective: bool,
pub selective: bool,
}

View file

@ -5,7 +5,7 @@
/// immediately after the user presses a button (see ReplyKeyboardMarkup).
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ReplyKeyboardRemove {
remove_keyboard: True,
pub remove_keyboard: True,
#[serde(skip_serializing_if = "Not::not")]
selective: bool,
pub selective: bool,
}

View file

@ -1,5 +1,5 @@
#[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ResponseParameters {
migrate_to_chat_id: Option<i64>,
retry_after: Option<i64>,
pub migrate_to_chat_id: Option<i64>,
pub retry_after: Option<i64>,
}

View file

@ -1,6 +1,5 @@
use crate::core::types::PhotoSize;
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Video {
pub file_id: String,
@ -9,5 +8,5 @@ pub struct Video {
pub duration: u32,
pub thumb: Option<PhotoSize>,
pub mime_type: Option<String>,
pub file_size: Option<u32>
pub file_size: Option<u32>,
}

View file

@ -5,13 +5,13 @@ use serde::Deserialize;
/// (available in Telegram apps as of v.4.0).
struct VideoNote {
/// Identifier for this file
file_id: String,
pub file_id: String,
/// Video width and height (diameter of the video message) as defined by sender
length: u32,
pub length: u32,
/// Duration of the video in seconds as defined by sender
duration: u32,
pub duration: u32,
/// Optional. Video thumbnail
thumb: Option<PhotoSize>,
pub thumb: Option<PhotoSize>,
/// Optional. File size
file_size: Option<u32>,
pub file_size: Option<u32>,
}

View file

@ -4,11 +4,11 @@ use serde::Deserialize;
/// This object represents a voice note.
struct Voice {
/// Identifier for this file
file_id: String,
pub file_id: String,
/// Duration of the audio in seconds as defined by sender
duration: u32,
pub duration: u32,
/// Optional. MIME type of the file as defined by sender
mime_type: Option<String>,
pub mime_type: Option<String>,
/// Optional. File size
file_size: Option<u64>
pub file_size: Option<u64>
}