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;
|
let (handler_lock, success_reader) = manager.join(guild_id, connect_to).await;
|
||||||
|
|
||||||
success_reader.unwrap();
|
|
||||||
|
|
||||||
let mut handler = handler_lock.lock().await;
|
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 audio_src = Compressed::new(
|
||||||
let word_path = dict.get(&word).unwrap();
|
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(
|
let duration = audio_src.metadata.duration.unwrap();
|
||||||
input::ffmpeg(word_path.to_str().unwrap())
|
let voice = handler.play_source(audio_src.into());
|
||||||
.await
|
voice.set_volume(0.5).unwrap();
|
||||||
.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();
|
tokio::time::sleep(duration).await;
|
||||||
let voice = handler.play_source(audio_src.into());
|
}
|
||||||
voice.set_volume(0.5).unwrap();
|
|
||||||
|
|
||||||
tokio::time::sleep(duration).await;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handler.leave().await.unwrap();
|
handler.leave().await.unwrap();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user