minor tweaks
This commit is contained in:
@@ -55,6 +55,10 @@ pub async fn leave_voice_channel(manager: &Arc<Songbird>, guild_id: &GuildId) ->
|
|||||||
Ok(())
|
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) {
|
pub async fn create_response(ctx: &Context, command: &CommandInteraction, content: String) {
|
||||||
let data = CreateInteractionResponseMessage::new().content(content.to_owned());
|
let data = CreateInteractionResponseMessage::new().content(content.to_owned());
|
||||||
let builder = CreateInteractionResponse::Message(data);
|
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()) {
|
if let Some(handler_lock) = manager.get(guild_id.to_owned()) {
|
||||||
let handler = handler_lock.lock().await;
|
let handler = handler_lock.lock().await;
|
||||||
match handler.queue().current() {
|
match handler.queue().current() {
|
||||||
Some(track) => {
|
Some(track) => match track.pause() {
|
||||||
match track.pause() {
|
Ok(_) => {
|
||||||
Ok(_) => {
|
log::debug!("<{guild_id}> Paused the track");
|
||||||
log::debug!("<{guild_id}> Paused the track");
|
edit_response(&ctx, &command, format!("Pausing the track")).await;
|
||||||
edit_response(&ctx, &command, format!("Pausing the track")).await;
|
}
|
||||||
}
|
Err(err) => {
|
||||||
Err(err) => {
|
edit_response(&ctx, &command, format!("Failed to pause: {}", err)).await;
|
||||||
edit_response(&ctx, &command, format!("Failed to pause: {}", err)).await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ use crate::bot::ytdlp::{PlaylistItem, YtDlp};
|
|||||||
use crate::error::{SirenResult, Error as SirenError};
|
use crate::error::{SirenResult, Error as SirenError};
|
||||||
use crate::HttpKey;
|
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) {
|
pub async fn run(ctx: &Context, command: &CommandInteraction) {
|
||||||
// Process the command options
|
// Process the command options
|
||||||
@@ -30,7 +32,7 @@ pub async fn run(ctx: &Context, command: &CommandInteraction) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create the initial response
|
// Create the initial response
|
||||||
create_response(&ctx, &command, format!(".....")).await;
|
process_message(&ctx, &command).await;
|
||||||
|
|
||||||
// Get the songbird manager
|
// Get the songbird manager
|
||||||
let manager = get_songbird(ctx).await;
|
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()) {
|
if let Some(handler_lock) = manager.get(guild_id.to_owned()) {
|
||||||
let handler = handler_lock.lock().await;
|
let handler = handler_lock.lock().await;
|
||||||
match handler.queue().current() {
|
match handler.queue().current() {
|
||||||
Some(track) => {
|
Some(track) => match track.play() {
|
||||||
match track.play() {
|
Ok(_) => {
|
||||||
Ok(_) => {
|
log::debug!("<{guild_id}> Resumed the track");
|
||||||
log::debug!("<{guild_id}> Resumed the track");
|
edit_response(&ctx, &command, format!("Resuming the track")).await;
|
||||||
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 => {
|
None => {
|
||||||
edit_response(&ctx, &command, format!("No track is currently playing")).await;
|
edit_response(&ctx, &command, format!("No track is currently playing")).await;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user