aboutsummaryrefslogtreecommitdiffstats
path: root/src/recording/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/recording/mod.rs')
-rw-r--r--src/recording/mod.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/recording/mod.rs b/src/recording/mod.rs
index d0a94be..4cd2891 100644
--- a/src/recording/mod.rs
+++ b/src/recording/mod.rs
@@ -304,22 +304,21 @@ pub async fn on_bot_voice_state(
304 if !voice_manager.recording_enabled() { 304 if !voice_manager.recording_enabled() {
305 return; 305 return;
306 } 306 }
307 let Some(guild_id) = guild_id else {
308 return;
309 };
307 // Already torn down by `VoiceManager::disconnect` in the `/stop` path; this 310 // Already torn down by `VoiceManager::disconnect` in the `/stop` path; this
308 // is the catch-all for leaves `disconnect` didn't initiate (kicks, drops). 311 // is the catch-all for leaves `disconnect` didn't initiate (kicks, drops).
309 if new_channel.is_none() { 312 if new_channel.is_none() {
310 voice_manager.stop_recording().await; 313 voice_manager.stop_recording(guild_id).await;
311 return; 314 return;
312 } 315 }
313 // Joined or moved into a channel. If the recorder is missing (e.g. a move 316 // Joined or moved into a channel. If this guild's recorder is missing
314 // broke the prior Call), try to (re)register on the current Call. 317 // (e.g. a move broke the prior Call), try to (re)register on the current
315 if new_channel != old_channel { 318 // Call.
316 let existing = voice_manager.get_recorder().await.is_some(); 319 if new_channel != old_channel && voice_manager.get_recorder(guild_id).await.is_none() {
317 if !existing { 320 if let Some(call) = voice_manager.get_call(guild_id) {
318 if let Some(gid) = guild_id { 321 voice_manager.start_recording(guild_id, &call).await;
319 if let Some(call) = voice_manager.get_call(gid) {
320 voice_manager.start_recording(&call).await;
321 }
322 }
323 } 322 }
324 } 323 }
325} 324}