mirror of
https://github.com/mii443/ncb-tts-r2.git
synced 2025-08-22 16:15:29 +00:00
fix: 自動参加のバグ修正
アナウンスが無効の時に自動参加も無効になるバグを修正
This commit is contained in:
@ -48,10 +48,6 @@ pub async fn voice_state_update(ctx: Context, old: Option<VoiceState>, new: Voic
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
if !config.voice_state_announce.unwrap_or(true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut storage = storage_lock.write().await;
|
let mut storage = storage_lock.write().await;
|
||||||
if !storage.contains_key(&guild_id) {
|
if !storage.contains_key(&guild_id) {
|
||||||
@ -124,20 +120,22 @@ pub async fn voice_state_update(ctx: Context, old: Option<VoiceState>, new: Voic
|
|||||||
|
|
||||||
let voice_move_state = new.move_state(&old, instance.voice_channel);
|
let voice_move_state = new.move_state(&old, instance.voice_channel);
|
||||||
|
|
||||||
let message: Option<String> = match voice_move_state {
|
if config.voice_state_announce.unwrap_or(false) {
|
||||||
VoiceMoveState::JOIN => Some(format!(
|
let message: Option<String> = match voice_move_state {
|
||||||
"{} さんが通話に参加しました",
|
VoiceMoveState::JOIN => Some(format!(
|
||||||
new.member.unwrap().read_name()
|
"{} さんが通話に参加しました",
|
||||||
)),
|
new.member.unwrap().read_name()
|
||||||
VoiceMoveState::LEAVE => Some(format!(
|
)),
|
||||||
"{} さんが通話から退出しました",
|
VoiceMoveState::LEAVE => Some(format!(
|
||||||
new.member.unwrap().read_name()
|
"{} さんが通話から退出しました",
|
||||||
)),
|
new.member.unwrap().read_name()
|
||||||
_ => None,
|
)),
|
||||||
};
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(message) = message {
|
if let Some(message) = message {
|
||||||
instance.read(AnnounceMessage { message }, &ctx).await;
|
instance.read(AnnounceMessage { message }, &ctx).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if voice_move_state == VoiceMoveState::LEAVE {
|
if voice_move_state == VoiceMoveState::LEAVE {
|
||||||
|
Reference in New Issue
Block a user