fix(admin check): check for admin if a member doesn't ha the admins privileges but have prefix
This commit is contained in:
parent
f9abd1592e
commit
c76364c8b4
|
@ -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