Compare commits

..

No commits in common. "c76364c8b4b8ca536153150e917917230719c99d" and "b5a9315a2d8aad4d8958be6a6d5a34b371459e91" have entirely different histories.

2 changed files with 2 additions and 10 deletions

View File

@ -10,6 +10,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
actix-web = "4.6.0"
anyhow = "1.0.86" anyhow = "1.0.86"
async-trait = "0.1.80" async-trait = "0.1.80"
chrono = "0.4.38" chrono = "0.4.38"

View File

@ -4,16 +4,7 @@ pub fn is_admin(all_admin_members: &Vec<ChatMember>, user_id: i64) -> bool {
all_admin_members all_admin_members
.iter() .iter()
.any(|admin: &ChatMember| match admin { .any(|admin: &ChatMember| match admin {
ChatMember::Administrator(admin) => { ChatMember::Administrator(admin) => admin.user.id == user_id,
admin.user.id == user_id
&& admin.can_change_info
&& admin.can_delete_messages
&& admin.can_promote_members
&& admin.can_manage_chat
&& admin.can_restrict_members
&& admin.can_invite_users
&& admin.can_manage_topics.unwrap()
}
ChatMember::Owner(owner) => owner.user.id == user_id, ChatMember::Owner(owner) => owner.user.id == user_id,
_ => false, _ => false,
}) })