aboutsummaryrefslogtreecommitdiffstats
path: root/src/voice/mod.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-07-31 01:09:07 +0200
committersalmonik <salmonik@tuta.io>2026-07-31 01:09:07 +0200
commit3f1a4d113e71fc412ec05a319d5ffd5a3d7a78bc (patch)
treec0eefa2d0a04c6dab74b471536fe31e7f4d4b559 /src/voice/mod.rs
parentfix: auto completion timing out before ready + fix preexisting warns (diff)
downloadsenator-sperma-3f1a4d113e71fc412ec05a319d5ffd5a3d7a78bc.tar.gz
senator-sperma-3f1a4d113e71fc412ec05a319d5ffd5a3d7a78bc.zip
fir auto completion and send file in the response body upon grajcuj file
Diffstat (limited to 'src/voice/mod.rs')
-rw-r--r--src/voice/mod.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/voice/mod.rs b/src/voice/mod.rs
index 0d5b89e..4087eba 100644
--- a/src/voice/mod.rs
+++ b/src/voice/mod.rs
@@ -25,12 +25,13 @@ pub struct VoiceManager {
25} 25}
26 26
27impl VoiceManager { 27impl VoiceManager {
28 pub async fn new(ctx: &serenity::client::Context) -> Self { 28 pub async fn new(ctx: &serenity::client::Context) -> Result<Self> {
29 Self { 29 let songbird = songbird::get(ctx)
30 songbird: songbird::get(ctx) 30 .await
31 .await 31 .ok_or_else(|| Error::Custom(
32 .expect("Songbird not registered via register_songbird()"), 32 "Songbird not registered via register_songbird()".into(),
33 } 33 ))?;
34 Ok(Self { songbird })
34 } 35 }
35 36
36 pub async fn connect( 37 pub async fn connect(
@@ -54,7 +55,12 @@ impl VoiceManager {
54 warn!("Driver error details: {driver_err:?}"); 55 warn!("Driver error details: {driver_err:?}");
55 } 56 }
56 last_err = Some(e); 57 last_err = Some(e);
57 tokio::time::sleep(Duration::from_secs(1)).await; 58
59 // Stale voice state: remove the guild from songbird and
60 // wait a few seconds so Discord's voice gateway can fully
61 // process the disconnect before we retry.
62 let _ = self.songbird.remove(guild_id).await;
63 tokio::time::sleep(Duration::from_secs(3)).await;
58 } 64 }
59 } 65 }
60 } 66 }