Compare commits

...

2 Commits

2 changed files with 10 additions and 2 deletions

View File

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

View File

@ -4,7 +4,16 @@ pub fn is_admin(all_admin_members: &Vec<ChatMember>, user_id: i64) -> bool {
all_admin_members
.iter()
.any(|admin: &ChatMember| match admin {
ChatMember::Administrator(admin) => admin.user.id == user_id,
ChatMember::Administrator(admin) => {
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,
_ => false,
})