/// Check if the given user is a moderator or not, based on their access to the moderation channel
Check if the given user is a moderator or not, based on their access to the moderation channel
Check if the given user is a moderator or not based on their access to the moderation channel
async fn is_moderator(ctx: &Context, user: &User) -> bool {
    let channelid = env::var("MOD_CHANNEL_ID")
        .expect("MOD_CHANNEL_ID id expected")
        .parse::<u64>()
        .expect("Invalid mod role id");
    if let Channel::Guild(channel) = ctx.http.get_channel(channelid).await.unwrap() {
        return channel
            .permissions_for_user(&ctx.cache, user)
            .await
            .unwrap()
            .read_messages();
    }
    unreachable!();
}
async fn is_moderator ( ctx : & Context , user : & User ) -> bool { let channelid = env :: var ( " " ) . expect ( " " ) . parse :: < u64 > ( ) . expect ( " " ) ; if let Channel :: Guild ( channel ) = ctx . http . get_channel ( channelid ) . await . unwrap ( ) { return channel . permissions_for_user ( & ctx . cache , user ) . await . unwrap ( ) . read_messages ( ) ; } unreachable ! ( ) ; }
Check if the given user is a moderator or not, based on their access to the moderation channel
Check if the given user is a moderator or not based on their access to the moderation channel
ctx
&Context
user
&User