Merge pull request #139 from SpriteOvO/master

Add the missing field `media_group_id` to `MediaDocument` & `MediaAudio`
This commit is contained in:
Waffle Maybe 2021-11-27 14:19:35 +03:00 committed by GitHub
commit b01655044f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -14,11 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `EditedMessageIsTooLong` error ([#109][pr109])
- `UntilDate` enum and use it for `{Restricted, Banned}::until_date` ([#116][pr116])
- `Limits::messages_per_min_channel` ([#121][pr121])
- `media_group_id` field to `MediaDocument` and `MediaAudio` ([#139][pr139])
[pr109]: https://github.com/teloxide/teloxide-core/pull/109
[pr116]: https://github.com/teloxide/teloxide-core/pull/116
[pr121]: https://github.com/teloxide/teloxide-core/pull/121
[pr135]: https://github.com/teloxide/teloxide-core/pull/135
[pr139]: https://github.com/teloxide/teloxide-core/pull/139
### Changed

View file

@ -319,6 +319,10 @@ pub struct MediaAudio {
/// bot commands, etc. that appear in the caption.
#[serde(default = "Vec::new")]
pub caption_entities: Vec<MessageEntity>,
/// The unique identifier of a media message group this message belongs
/// to.
pub media_group_id: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
@ -340,6 +344,10 @@ pub struct MediaDocument {
/// bot commands, etc. that appear in the caption.
#[serde(default = "Vec::new")]
pub caption_entities: Vec<MessageEntity>,
/// The unique identifier of a media message group this message belongs
/// to.
pub media_group_id: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
@ -620,6 +628,14 @@ mod getters {
| Common(MessageCommon {
media_kind: MediaKind::Photo(MediaPhoto { media_group_id, .. }),
..
})
| Common(MessageCommon {
media_kind: MediaKind::Document(MediaDocument { media_group_id, .. }),
..
})
| Common(MessageCommon {
media_kind: MediaKind::Audio(MediaAudio { media_group_id, .. }),
..
}) => media_group_id.as_ref().map(Deref::deref),
_ => None,
}