feat: replace owner by administrator right
This commit is contained in:
parent
6fd51ef7d8
commit
3870f84585
@ -1,5 +1,5 @@
|
||||
use super::check_if_server_enable::{check_if_server_enable, CheckIfServerEnableError};
|
||||
use crate::db::server_config::ServerConfig;
|
||||
use crate::{api::bot::info, db::server_config::ServerConfig};
|
||||
use poise::serenity_prelude::{self, RoleId, UserId};
|
||||
use tracing::{info, instrument};
|
||||
|
||||
@ -33,8 +33,9 @@ pub async fn check_if_server_enable_and_user_admin(
|
||||
}
|
||||
match guild.member(http, UserId::new(user_id)).await {
|
||||
Ok(member) => {
|
||||
info!("Checking if user is admin");
|
||||
info!(user_name = member.user.name, "Checking if user is admin");
|
||||
if let Some(perm) = member.permissions {
|
||||
info!(perm = perm.bits(), "Checking if user has admin permission");
|
||||
if perm.administrator() {
|
||||
info!("User has administarator permission");
|
||||
return Ok((true, Some(server_config)));
|
||||
@ -48,6 +49,8 @@ pub async fn check_if_server_enable_and_user_admin(
|
||||
info!("User has administarator permission");
|
||||
return Ok((true, Some(server_config)));
|
||||
}
|
||||
info!("Checking if user has admin role");
|
||||
|
||||
Ok((
|
||||
server_config
|
||||
.clone()
|
||||
|
Loading…
Reference in New Issue
Block a user