diff --git a/src/bot/commands/audio/mod.rs b/src/bot/commands/audio/mod.rs index 09343b8..55dc3ad 100644 --- a/src/bot/commands/audio/mod.rs +++ b/src/bot/commands/audio/mod.rs @@ -55,6 +55,10 @@ pub async fn leave_voice_channel(manager: &Arc, guild_id: &GuildId) -> Ok(()) } +pub async fn process_message(ctx: &Context, command: &CommandInteraction) { + create_response(&ctx, &command, format!("Processing...")).await; +} + pub async fn create_response(ctx: &Context, command: &CommandInteraction, content: String) { let data = CreateInteractionResponseMessage::new().content(content.to_owned()); let builder = CreateInteractionResponse::Message(data); diff --git a/src/bot/commands/audio/pause.rs b/src/bot/commands/audio/pause.rs index 09d71b6..a3ba074 100644 --- a/src/bot/commands/audio/pause.rs +++ b/src/bot/commands/audio/pause.rs @@ -30,15 +30,13 @@ pub async fn run(ctx: &Context, command: &CommandInteraction) { 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; - } + 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 => { diff --git a/src/bot/commands/audio/play.rs b/src/bot/commands/audio/play.rs index 89ff571..0e0f280 100644 --- a/src/bot/commands/audio/play.rs +++ b/src/bot/commands/audio/play.rs @@ -13,7 +13,9 @@ use crate::bot::ytdlp::{PlaylistItem, YtDlp}; use crate::error::{SirenResult, Error as SirenError}; use crate::HttpKey; -use super::{create_response, edit_response, get_songbird, is_valid_url, join_voice_channel}; +use super::{ + create_response, edit_response, get_songbird, is_valid_url, join_voice_channel, process_message, +}; pub async fn run(ctx: &Context, command: &CommandInteraction) { // Process the command options @@ -30,7 +32,7 @@ pub async fn run(ctx: &Context, command: &CommandInteraction) { }; // Create the initial response - create_response(&ctx, &command, format!(".....")).await; + process_message(&ctx, &command).await; // Get the songbird manager let manager = get_songbird(ctx).await; diff --git a/src/bot/commands/audio/resume.rs b/src/bot/commands/audio/resume.rs index 55aa757..49a4d7b 100644 --- a/src/bot/commands/audio/resume.rs +++ b/src/bot/commands/audio/resume.rs @@ -30,17 +30,15 @@ pub async fn run(ctx: &Context, command: &CommandInteraction) { 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.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; - } + 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; + } + }, None => { edit_response(&ctx, &command, format!("No track is currently playing")).await; return;