mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Fix parsing pinned_message
Related to https://github.com/teloxide/teloxide/issues/167.
This commit is contained in:
parent
93afb0b611
commit
29ed9a1ffe
2 changed files with 43 additions and 0 deletions
|
@ -113,6 +113,7 @@ pub enum MessageKind {
|
||||||
/// Specified message was pinned. Note that the Message object in this
|
/// Specified message was pinned. Note that the Message object in this
|
||||||
/// field will not contain further `reply_to_message` fields even if it
|
/// field will not contain further `reply_to_message` fields even if it
|
||||||
/// is itself a reply.
|
/// is itself a reply.
|
||||||
|
#[serde(rename = "pinned_message")]
|
||||||
pinned: Box<Message>,
|
pinned: Box<Message>,
|
||||||
},
|
},
|
||||||
Invoice {
|
Invoice {
|
||||||
|
|
|
@ -205,4 +205,46 @@ mod test {
|
||||||
|
|
||||||
assert!(serde_json::from_str::<Update>(text).is_ok());
|
assert!(serde_json::from_str::<Update>(text).is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pinned_message_works() {
|
||||||
|
let json = r#"{
|
||||||
|
"message": {
|
||||||
|
"chat": {
|
||||||
|
"id": -1001276785818,
|
||||||
|
"title": "teloxide dev",
|
||||||
|
"type": "supergroup",
|
||||||
|
"username": "teloxide_dev"
|
||||||
|
},
|
||||||
|
"date": 1582134655,
|
||||||
|
"from": {
|
||||||
|
"first_name": "Hirrolot",
|
||||||
|
"id": 408258968,
|
||||||
|
"is_bot": false,
|
||||||
|
"username": "hirrolot"
|
||||||
|
},
|
||||||
|
"message_id": 20225,
|
||||||
|
"pinned_message": {
|
||||||
|
"chat": {
|
||||||
|
"id": -1001276785818,
|
||||||
|
"title": "teloxide dev",
|
||||||
|
"type": "supergroup",
|
||||||
|
"username": "teloxide_dev"
|
||||||
|
},
|
||||||
|
"date": 1582134643,
|
||||||
|
"from": {
|
||||||
|
"first_name": "Hirrolot",
|
||||||
|
"id": 408258968,
|
||||||
|
"is_bot": false,
|
||||||
|
"username": "hirrolot"
|
||||||
|
},
|
||||||
|
"message_id": 20224,
|
||||||
|
"text": "Faster than a bullet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"update_id": 845402291
|
||||||
|
}"#;
|
||||||
|
|
||||||
|
serde_json::from_str::<Update>(json).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue