From 76c1824bd6f0dcb157544862652b65af8f6539ce Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 01:09:53 +0100 Subject: recording: keep one buffer per guild --- src/recording/mod.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/recording') 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( if !voice_manager.recording_enabled() { return; } + let Some(guild_id) = guild_id else { + return; + }; // Already torn down by `VoiceManager::disconnect` in the `/stop` path; this // is the catch-all for leaves `disconnect` didn't initiate (kicks, drops). if new_channel.is_none() { - voice_manager.stop_recording().await; + voice_manager.stop_recording(guild_id).await; return; } - // Joined or moved into a channel. If the recorder is missing (e.g. a move - // broke the prior Call), try to (re)register on the current Call. - if new_channel != old_channel { - let existing = voice_manager.get_recorder().await.is_some(); - if !existing { - if let Some(gid) = guild_id { - if let Some(call) = voice_manager.get_call(gid) { - voice_manager.start_recording(&call).await; - } - } + // Joined or moved into a channel. If this guild's recorder is missing + // (e.g. a move broke the prior Call), try to (re)register on the current + // Call. + if new_channel != old_channel && voice_manager.get_recorder(guild_id).await.is_none() { + if let Some(call) = voice_manager.get_call(guild_id) { + voice_manager.start_recording(guild_id, &call).await; } } } -- cgit v1.2.3