minor tweaks
This commit is contained in:
@@ -55,6 +55,10 @@ pub async fn leave_voice_channel(manager: &Arc<Songbird>, 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);
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user