Compare commits
2 Commits
b5a9315a2d
...
c76364c8b4
Author | SHA1 | Date | |
---|---|---|---|
doryan | c76364c8b4 | ||
doryan | f9abd1592e |
|
@ -10,7 +10,6 @@ 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"
|
||||||
|
|
|
@ -4,7 +4,16 @@ 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) => 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,
|
ChatMember::Owner(owner) => owner.user.id == user_id,
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue