Merge pull request #175 from teloxide/tba_5.7

TBA 5.7
This commit is contained in:
Waffle Maybe 2022-02-03 17:39:16 +03:00 committed by GitHub
commit d83f7180c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 5 deletions

View file

@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `ApiError::NotEnoughRightsToChangeChatPermissions` ([#155][pr155])
- Support for 5.4 telegram bot API ([#133][pr133])
- Support for 5.5 telegram bot API ([#143][pr143], [#164][pr164])
- Support for 5.6 telegram bot API ([#162][pr162])
- Support for 5.7 telegram bot API ([#175][pr175])
- `EditedMessageIsTooLong` error ([#109][pr109])
- `UntilDate` enum and use it for `{Restricted, Banned}::until_date` ([#117][pr117])
- `Limits::messages_per_min_channel` ([#121][pr121])
@ -31,7 +33,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[pr151]: https://github.com/teloxide/teloxide-core/pull/151
[pr155]: https://github.com/teloxide/teloxide-core/pull/155
[pr156]: https://github.com/teloxide/teloxide-core/pull/156
[pr162]: https://github.com/teloxide/teloxide-core/pull/162
[pr164]: https://github.com/teloxide/teloxide-core/pull/164
[pr175]: https://github.com/teloxide/teloxide-core/pull/175
### Changed

View file

@ -434,13 +434,13 @@ impl InputFileLike for Option<InputFile> {
impl InputFileLike for InputSticker {
fn copy_into(&self, into: &mut dyn FnMut(InputFile)) {
let (InputSticker::Png(input_file) | InputSticker::Tgs(input_file)) = self;
let (Self::Png(input_file) | Self::Tgs(input_file) | Self::Webm(input_file)) = self;
input_file.copy_into(into)
}
fn move_into(&mut self, into: &mut dyn FnMut(InputFile)) {
let (InputSticker::Png(input_file) | InputSticker::Tgs(input_file)) = self;
let (Self::Png(input_file) | Self::Tgs(input_file) | Self::Webm(input_file)) = self;
input_file.move_into(into)
}

View file

@ -27,7 +27,12 @@ pub enum InputSticker {
/// TGS animation with the sticker, uploaded using multipart/form-data.
///
/// See <https://core.telegram.org/animated_stickers#technical-requirements> for technical requirements
/// See <https://core.telegram.org/animated_stickers#technical-requirements> for technical requirements.
#[serde(rename = "tgs_sticker")]
Tgs(InputFile),
/// WEBM video with the sticker, uploaded using multipart/form-data.
///
/// See <https://core.telegram.org/stickers#video-sticker-requirements> for technical requirements.
Webm(InputFile),
}

View file

@ -1222,6 +1222,7 @@ mod tests {
"emoji": "😡",
"set_name": "AdvenTimeAnim",
"is_animated": true,
"is_video": false,
"thumb": {
"file_id": "AAQCAAMjAAOw0PgMaabKAcaXKCBLubkPAAQBAAdtAAPGKwACFgQ",
"file_unique_id":"",
@ -1234,8 +1235,7 @@ mod tests {
"file_size": 16639
}
}"#;
let message = from_str::<Message>(json);
assert!(message.is_ok());
from_str::<Message>(json).unwrap();
}
#[test]

View file

@ -27,6 +27,11 @@ pub struct Sticker {
/// [animated]: https://telegram.org/blog/animated-stickers
pub is_animated: bool,
/// `true`, if the sticker is a [video sticker].
///
/// [video sticker]: https://telegram.org/blog/video-stickers-better-reactions
pub is_video: bool,
/// Sticker thumbnail in the .webp or .jpg format.
pub thumb: Option<PhotoSize>,

View file

@ -18,6 +18,11 @@ pub struct StickerSet {
/// [animates stickers]: https://telegram.org/blog/animated-stickers
pub is_animated: bool,
/// `true`, if the sticker is a [video sticker].
///
/// [video sticker]: https://telegram.org/blog/video-stickers-better-reactions
pub is_video: bool,
/// `true`, if the sticker set contains masks.
pub contains_masks: bool,