Fixed lock up on multiple say messages
+ clippy + fmt
This commit is contained in:
parent
41213db8d4
commit
883a235ab6
@ -178,31 +178,29 @@ pub async fn speak(
|
||||
|
||||
let (handler_lock, success_reader) = manager.join(guild_id, connect_to).await;
|
||||
|
||||
success_reader.unwrap();
|
||||
|
||||
let mut handler = handler_lock.lock().await;
|
||||
if success_reader.is_ok() {
|
||||
for word in sentence {
|
||||
let word_path = dict.get(&word).unwrap();
|
||||
|
||||
for word in sentence {
|
||||
let word_path = dict.get(&word).unwrap();
|
||||
let audio_src = Compressed::new(
|
||||
input::ffmpeg(word_path.to_str().unwrap())
|
||||
.await
|
||||
.expect("Bad audio link."),
|
||||
Bitrate::BitsPerSecond(128_000),
|
||||
)
|
||||
.expect("Bad params on message load");
|
||||
let _ = audio_src.raw.spawn_loader();
|
||||
|
||||
let audio_src = Compressed::new(
|
||||
input::ffmpeg(word_path.to_str().unwrap())
|
||||
.await
|
||||
.expect("Bad audio link."),
|
||||
Bitrate::BitsPerSecond(128_000),
|
||||
)
|
||||
.expect("Bad params on message load");
|
||||
let _ = audio_src.raw.spawn_loader();
|
||||
let duration = audio_src.metadata.duration.unwrap();
|
||||
let voice = handler.play_source(audio_src.into());
|
||||
voice.set_volume(0.5).unwrap();
|
||||
|
||||
let duration = audio_src.metadata.duration.unwrap();
|
||||
let voice = handler.play_source(audio_src.into());
|
||||
voice.set_volume(0.5).unwrap();
|
||||
|
||||
tokio::time::sleep(duration).await;
|
||||
tokio::time::sleep(duration).await;
|
||||
}
|
||||
}
|
||||
|
||||
handler.leave().await.unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user