diff --git a/src/types/animation.rs b/src/types/animation.rs index fda13b3f..de54253e 100644 --- a/src/types/animation.rs +++ b/src/types/animation.rs @@ -38,7 +38,7 @@ pub struct Animation { pub mime_type: Option, /// File size in bytes. - pub file_size: Option, + pub file_size: Option, } #[cfg(test)] diff --git a/src/types/audio.rs b/src/types/audio.rs index a06d4ce6..febc4980 100644 --- a/src/types/audio.rs +++ b/src/types/audio.rs @@ -35,7 +35,7 @@ pub struct Audio { pub mime_type: Option, /// File size in bytes. - pub file_size: Option, + pub file_size: Option, /// A thumbnail of the album cover to which the music file belongs. pub thumb: Option, diff --git a/src/types/document.rs b/src/types/document.rs index 94a3aaa0..864443c2 100644 --- a/src/types/document.rs +++ b/src/types/document.rs @@ -33,5 +33,5 @@ pub struct Document { pub mime_type: Option, /// File size in bytes. - pub file_size: Option, + pub file_size: Option, } diff --git a/src/types/file.rs b/src/types/file.rs index 8b11e871..3de6521f 100644 --- a/src/types/file.rs +++ b/src/types/file.rs @@ -27,7 +27,7 @@ pub struct File { /// errourneusly marked as required in Teloxide. To workaround this issue, /// when `file_size` is not present, it is deserialized as [`u32::MAX`]. #[serde(default = "default_file_size")] - pub file_size: u32, + pub file_size: u64, /// File path. Use [`Bot::download_file(file_path, dst)`] to get the file. /// @@ -40,8 +40,8 @@ pub struct File { pub file_path: String, } -const fn default_file_size() -> u32 { - u32::MAX +const fn default_file_size() -> u64 { + u64::MAX } #[cfg(test)] @@ -59,7 +59,7 @@ mod tests { File { file_id: "FILE_ID".to_owned(), file_unique_id: "FILE_UNIQUE_ID".to_owned(), - file_size: u32::MAX, + file_size: u64::MAX, file_path: "FILE_PATH".to_owned(), } ); diff --git a/src/types/me.rs b/src/types/me.rs index 9ecfb574..b0d82b8c 100644 --- a/src/types/me.rs +++ b/src/types/me.rs @@ -66,6 +66,7 @@ mod tests { last_name: None, username: Some("SomethingSomethingBot".to_owned()), language_code: None, + is_premium: false, }, can_join_groups: false, can_read_all_group_messages: false, diff --git a/src/types/sticker.rs b/src/types/sticker.rs index 36510976..4066350b 100644 --- a/src/types/sticker.rs +++ b/src/types/sticker.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -use crate::types::{MaskPosition, PhotoSize}; +use crate::types::{File, MaskPosition, PhotoSize}; /// This object represents a sticker. /// @@ -41,6 +41,9 @@ pub struct Sticker { /// Name of the sticker set to which the sticker belongs. pub set_name: Option, + /// Premium animation for the sticker, if the sticker is premium. + pub premium_animation: Option, + /// For mask stickers, the position where the mask should be placed. pub mask_position: Option, diff --git a/src/types/user.rs b/src/types/user.rs index f5063112..0eecb3c2 100644 --- a/src/types/user.rs +++ b/src/types/user.rs @@ -27,6 +27,10 @@ pub struct User { /// /// [IETF language tag]: https://en.wikipedia.org/wiki/IETF_language_tag pub language_code: Option, + + /// `true`, if this user is a Telegram Premium user. + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + pub is_premium: bool, } impl User { @@ -137,6 +141,7 @@ mod tests { last_name: Some("lastName".to_string()), username: Some("Username".to_string()), language_code: Some(String::from("ru")), + is_premium: false, }; let actual = serde_json::from_str::(json).unwrap(); assert_eq!(actual, expected) @@ -151,6 +156,7 @@ mod tests { last_name: Some("Last".to_owned()), username: Some("aaaaaaaaaaaaaaaa".to_owned()), language_code: None, + is_premium: false, }; let user_b = User { @@ -160,6 +166,7 @@ mod tests { last_name: None, username: None, language_code: None, + is_premium: false, }; assert_eq!(user_a.full_name(), "First Last"); diff --git a/src/types/video.rs b/src/types/video.rs index df873dc9..08e484d5 100644 --- a/src/types/video.rs +++ b/src/types/video.rs @@ -37,5 +37,5 @@ pub struct Video { pub mime_type: Option, /// File size in bytes. - pub file_size: Option, + pub file_size: Option, }