use serenity::{ all::{CommandInteraction, CreateCommand}, prelude::*, }; use super::{get_songbird, create_response, edit_response}; pub async fn run(ctx: &Context, command: &CommandInteraction) { // Create the initial response create_response(&ctx, &command, format!(".....")).await; // Get the songbird manager let manager = get_songbird(ctx).await; // Extract the guild ID let guild_id = match &command.guild_id { Some(guild_id) => guild_id, None => { edit_response( &ctx, &command, "Unable to find the current server ID".to_string(), ) .await; return; } }; // Pause the track if let Some(handler_lock) = manager.get(guild_id.to_owned()) { let handler = handler_lock.lock().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; } } } } pub fn register() -> CreateCommand { CreateCommand::new("pause").description("Pause the current track") }