feat(moderation): disconnect from voice channel on mute (#39)

This commit is contained in:
Ax333l 2022-12-01 18:15:05 +01:00 committed by GitHub
parent c2fe25a3a8
commit b2aa39b9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ use poise::serenity_prelude::{
User, User,
}; };
use tracing::log::error; use tracing::log::error;
use tracing::{debug, trace}; use tracing::{debug, warn, trace};
use crate::db::model::{LockedChannel, Muted}; use crate::db::model::{LockedChannel, Muted};
use crate::utils::moderation::{ use crate::utils::moderation::{
@ -313,6 +313,12 @@ pub async fn mute(
), ),
); );
if result.is_none() {
if let Err(e) = member.disconnect_from_voice(&ctx.discord().http).await {
warn!("Could not disconnect member from voice channel: {}", e);
}
}
respond_moderation( respond_moderation(
&ctx, &ctx,
&ModerationKind::Mute( &ModerationKind::Mute(