support playing files

patrick/test-ci
Patrick Cleavelin 2023-02-12 19:41:01 -06:00
parent 7772a39526
commit fb39392958
1 changed files with 8 additions and 3 deletions

View File

@ -136,14 +136,19 @@ impl EventHandler for Handler {
SoundType::Youtube => match songbird::ytdl(&user.sound).await { SoundType::Youtube => match songbird::ytdl(&user.sound).await {
Ok(source) => source, Ok(source) => source,
Err(err) => { Err(err) => {
error!("Error starting source: {err:?}"); error!("Error starting youtube source: {err:?}");
return; return;
} }
}, },
SoundType::File => { SoundType::File => {
error!("Playing files not supported yet"); match songbird::ffmpeg(format!("sounds/{}", &user.sound)).await {
Ok(source) => source,
Err(err) => {
error!("Error starting file source: {err:?}");
return; return;
} }
}
}
}; };
let track_handle = handler.play_source(source); let track_handle = handler.play_source(source);