fix: remove handlers after failing to join call

This commit is contained in:
2026-05-14 00:54:34 -04:00
parent c20bab2761
commit b2af146360

View File

@@ -310,11 +310,8 @@ pub async fn handle(state: State, interaction: Interaction) {
call.mute(true).await.expect("TODO"); call.mute(true).await.expect("TODO");
} }
state match state.songbird.join(guild_id, voice_channel_id).await {
.songbird Ok(_call) => {
.join(guild_id, voice_channel_id)
.await
.expect("TODO");
tracing::error!(?call, "successfully joined"); tracing::error!(?call, "successfully joined");
let channel_mention = format!("<#{voice_channel_id}>"); let channel_mention = format!("<#{voice_channel_id}>");
@@ -347,4 +344,10 @@ pub async fn handle(state: State, interaction: Interaction) {
])) ]))
.await .await
.expect("TODO"); .expect("TODO");
},
Err(join_error) => {
tracing::error!(?join_error);
let _ = state.songbird.remove(guild_id).await;
}
}
} }