From b0ce5ae370ea62ce95e304e88bdbb46bd4f32630 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 8 Nov 2022 00:28:02 +0100 Subject: [PATCH] fix(media-channel): correctly check for admin status --- src/utils/media_channel.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/utils/media_channel.rs b/src/utils/media_channel.rs index e9fedf5..ff98943 100644 --- a/src/utils/media_channel.rs +++ b/src/utils/media_channel.rs @@ -19,13 +19,12 @@ pub async fn handle_media_channel( .iter() .any(|&channel| channel == current_channel); - if is_media_channel - && (new_message.attachments.is_empty() - || !configuration - .administrators - .users - .contains(&new_message.author.id.0)) - { + let is_admin = configuration + .administrators + .users + .contains(&new_message.author.id.0); + + if is_media_channel && new_message.attachments.is_empty() && !is_admin { if let Err(why) = new_message.delete(&ctx.http).await { error!("Error deleting message: {:?}", why); }