Add max_reaction_count field to ChatFullInfo struct

This commit is contained in:
Andrey Brusnik 2024-08-27 01:02:02 +04:00
parent 8ce91a1363
commit 6345a3d06f
No known key found for this signature in database
GPG key ID: D33232F28CFF442C

View file

@ -73,6 +73,10 @@ pub struct ChatFullInfo {
/// only to chat administrators. /// only to chat administrators.
#[serde(default, skip_serializing_if = "std::ops::Not::not")] #[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub has_visible_history: bool, pub has_visible_history: bool,
/// The maximum number of reactions that can be set on a message in the
/// chat
pub max_reaction_count: u8,
} }
#[serde_with::skip_serializing_none] #[serde_with::skip_serializing_none]
@ -677,6 +681,7 @@ mod tests {
emoji_status_custom_emoji_id: None, emoji_status_custom_emoji_id: None,
emoji_status_expiration_date: DateTime::from_timestamp(1720708004, 0), emoji_status_expiration_date: DateTime::from_timestamp(1720708004, 0),
has_visible_history: false, has_visible_history: false,
max_reaction_count: 0,
}; };
let actual = from_str( let actual = from_str(
r#"{ r#"{
@ -689,7 +694,8 @@ mod tests {
"emoji": "🌭" "emoji": "🌭"
} }
], ],
"emoji_status_expiration_date": 1720708004 "emoji_status_expiration_date": 1720708004,
"max_reaction_count": 0
}"#, }"#,
) )
.unwrap(); .unwrap();
@ -725,6 +731,7 @@ mod tests {
emoji_status_custom_emoji_id: None, emoji_status_custom_emoji_id: None,
emoji_status_expiration_date: DateTime::from_timestamp(1720708004, 0), emoji_status_expiration_date: DateTime::from_timestamp(1720708004, 0),
has_visible_history: false, has_visible_history: false,
max_reaction_count: 0,
}; };
eprintln!("{}", to_string(&chat).unwrap()); eprintln!("{}", to_string(&chat).unwrap());
assert_eq!( assert_eq!(
@ -735,7 +742,8 @@ mod tests {
"type": "private", "type": "private",
"username": "username", "username": "username",
"first_name": "Anon", "first_name": "Anon",
"emoji_status_expiration_date": 1720708004 "emoji_status_expiration_date": 1720708004,
"max_reaction_count": 0
}"# }"#
) )
.unwrap() .unwrap()
@ -771,6 +779,7 @@ mod tests {
emoji_status_custom_emoji_id: None, emoji_status_custom_emoji_id: None,
emoji_status_expiration_date: None, emoji_status_expiration_date: None,
has_visible_history: false, has_visible_history: false,
max_reaction_count: 0,
}; };
let json = to_string(&chat).unwrap(); let json = to_string(&chat).unwrap();