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,20 @@ pub async fn run(ctx: &Context, command: &CommandInteraction) {
// Pause the track
if let Some(handler_lock) = manager.get(guild_id.to_owned()) {
let handler = handler_lock.lock().await;
match handler.queue().pause() {
Ok(_) => {
log::debug!("<{guild_id}> Paused the track");
edit_response(&ctx, &command, format!("Pausing the track")).await;
}
Err(err) => {
edit_response(&ctx, &command, format!("Failed to pause: {}", err)).await;
match handler.queue().current() {
Some(track) => {
match track.pause() {
Ok(_) => {
log::debug!("<{guild_id}> Paused the track");
edit_response(&ctx, &command, format!("Pausing the track")).await;
}
Err(err) => {
edit_response(&ctx, &command, format!("Failed to pause: {}", err)).await;
}
}
},
None => {
edit_response(ctx, command, format!("No track currently being played")).await;
}
}
}