Skip to content

Commit

Permalink
Parse 'kicked' chat member status
Browse files Browse the repository at this point in the history
  • Loading branch information
kriomant committed Oct 3, 2023
1 parent 981c02e commit b7456e4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub enum ChatMember {
Member(ChatMemberMember),
Restricted(ChatMemberRestricted),
Left(ChatMemberLeft),
#[serde(rename = "kicked")]
Banned(ChatMemberBanned),
}

Expand Down Expand Up @@ -3329,4 +3330,20 @@ mod serde_tests {

assert_eq!(update, expected);
}

#[test]
pub fn kicked_user_status_is_parsed() {
let member_content = r#"{
"status": "kicked",
"until_date": 0,
"user": {
"id": 0,
"is_bot": false,
"first_name": "First"
}
}"#;

let member: ChatMember = serde_json::from_str(member_content).unwrap();
assert!(matches!(member, ChatMember::Banned(_)));
}
}

0 comments on commit b7456e4

Please sign in to comment.