trying to get handler to pause/play

This commit is contained in:
2024-10-11 11:22:05 -04:00
parent 2688d2304e
commit 38841369fc
8 changed files with 47 additions and 33 deletions

View File

@@ -29,13 +29,21 @@ pub async fn run(ctx: &Context, command: &CommandInteraction) {
// Resume the track
if let Some(handler_lock) = manager.get(guild_id.to_owned()) {
let handler = handler_lock.lock().await;
match handler.queue().resume() {
Ok(_) => {
log::debug!("<{guild_id}> Resumed the track");
edit_response(&ctx, &command, format!("Resuming the track")).await;
match handler.queue().current() {
Some(track) => {
match track.play() {
Ok(_) => {
log::debug!("<{guild_id}> Resumed the track");
edit_response(&ctx, &command, format!("Resuming the track")).await;
}
Err(err) => {
edit_response(&ctx, &command, format!("Failed to resume: {}", err)).await;
}
}
}
Err(err) => {
edit_response(&ctx, &command, format!("Failed to resume: {}", err)).await;
None => {
edit_response(&ctx, &command, format!("No track is currently playing")).await;
return;
}
}
}