diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 01:09:53 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 01:09:53 +0100 |
| commit | 76c1824bd6f0dcb157544862652b65af8f6539ce (patch) | |
| tree | 1b89a5394d2cfb207d3fe37ae6d40d4a86dfd04a /src/recording | |
| parent | triggers: scope groups to the guild that created them (diff) | |
| download | senator-sperma-76c1824bd6f0dcb157544862652b65af8f6539ce.tar.gz senator-sperma-76c1824bd6f0dcb157544862652b65af8f6539ce.zip | |
recording: keep one buffer per guild
Diffstat (limited to 'src/recording')
| -rw-r--r-- | src/recording/mod.rs | 21 |
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 | } |
