From 43cce7dc3185c6822581e0a664722ecb1f0a5d0e Mon Sep 17 00:00:00 2001 From: mii443 Date: Wed, 28 May 2025 17:22:08 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=8B=95=E5=8F=82=E5=8A=A0?= =?UTF-8?q?=E3=81=AE=E3=83=90=E3=82=B0=E4=BF=AE=E6=AD=A3=20=E3=82=A2?= =?UTF-8?q?=E3=83=8A=E3=82=A6=E3=83=B3=E3=82=B9=E3=81=8C=E7=84=A1=E5=8A=B9?= =?UTF-8?q?=E3=81=AE=E6=99=82=E3=81=AB=E8=87=AA=E5=8B=95=E5=8F=82=E5=8A=A0?= =?UTF-8?q?=E3=82=82=E7=84=A1=E5=8A=B9=E3=81=AB=E3=81=AA=E3=82=8B=E3=83=90?= =?UTF-8?q?=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/events/voice_state_update.rs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/events/voice_state_update.rs b/src/events/voice_state_update.rs index 88d4770..d3abfc7 100644 --- a/src/events/voice_state_update.rs +++ b/src/events/voice_state_update.rs @@ -48,10 +48,6 @@ pub async fn voice_state_update(ctx: Context, old: Option, new: Voic .unwrap() }; - if !config.voice_state_announce.unwrap_or(true) { - return; - } - { let mut storage = storage_lock.write().await; if !storage.contains_key(&guild_id) { @@ -124,20 +120,22 @@ pub async fn voice_state_update(ctx: Context, old: Option, new: Voic let voice_move_state = new.move_state(&old, instance.voice_channel); - let message: Option = match voice_move_state { - VoiceMoveState::JOIN => Some(format!( - "{} さんが通話に参加しました", - new.member.unwrap().read_name() - )), - VoiceMoveState::LEAVE => Some(format!( - "{} さんが通話から退出しました", - new.member.unwrap().read_name() - )), - _ => None, - }; + if config.voice_state_announce.unwrap_or(false) { + let message: Option = match voice_move_state { + VoiceMoveState::JOIN => Some(format!( + "{} さんが通話に参加しました", + new.member.unwrap().read_name() + )), + VoiceMoveState::LEAVE => Some(format!( + "{} さんが通話から退出しました", + new.member.unwrap().read_name() + )), + _ => None, + }; - if let Some(message) = message { - instance.read(AnnounceMessage { message }, &ctx).await; + if let Some(message) = message { + instance.read(AnnounceMessage { message }, &ctx).await; + } } if voice_move_state == VoiceMoveState::LEAVE {