feat: added skip command, reworked embed messages

fix: fixed issue with queue not working properly
This commit is contained in:
moonleay 2024-03-10 19:36:02 +01:00
parent 1dcd0ab66b
commit ba0f1fb959
Signed by: moonleay
GPG key ID: 82667543CCD715FB
10 changed files with 159 additions and 114 deletions

View file

@ -6,11 +6,7 @@ use crate::util::embed::Embed;
pub async fn run(_ctx: &Context, command: &CommandInteraction) -> CreateEmbed {
let username = command.user.name.as_str();
Embed::create(
"",
"Botendo v7",
"developed by [moonleay](https://moonleay.net)\n\nCheck out the repository: https://git.moonleay.net/DiscordBots/Rustendo",
)
Embed::create_success_response(username, "Botendo v7", "developed by [moonleay](https://moonleay.net)\n\nCheck out the repository: https://git.moonleay.net/DiscordBots/Rustendo")
}
pub fn register() -> CreateCommand {

View file

@ -1,3 +1,4 @@
pub mod info;
pub mod play;
pub mod stop;
pub mod stop;
pub mod skip;

View file

@ -19,13 +19,13 @@ pub async unsafe fn run(ctx: &Context, command: &CommandInteraction) -> CreateEm
});
if query.is_none() {
return Embed::create(username, "Error 400", "There is no query provided");
return Embed::create_error_respose(username, "400: Bad request", "There is no query provided");
}
let guild_id = match &command.guild_id {
Some(guild_id) => guild_id,
None => {
return Embed::create(username, "GuildId not found", "Could not find guild id.");
return Embed::create_error_respose(username, "guild_id not found", "Could not find guild id.");
}
};

24
src/commands/skip.rs Normal file
View file

@ -0,0 +1,24 @@
use crate::music::music_manager;
use crate::util::embed::Embed;
use serenity::all::{CommandInteraction, Context};
use serenity::builder::{CreateCommand, CreateEmbed};
pub async unsafe fn run(ctx: &Context, command: &CommandInteraction) -> CreateEmbed {
let username = command.user.name.as_str();
let guild_id = match &command.guild_id {
Some(guild_id) => guild_id,
None => {
return Embed::create_error_respose(username, "guild_id not found", "Could not find guild id.");
}
};
music_manager::attempt_to_skip_current_song(ctx, guild_id, &command.user.id, &command.user.name).await
}
pub fn register() -> CreateCommand {
CreateCommand::new("skip").description("Skip to the next song in queue")
}
// >18/02/2024 @ 19:01:59 - bartlo
// >2024-02-19 17:58:39 | moonleay

View file

@ -9,7 +9,7 @@ pub async unsafe fn run(ctx: &Context, command: &CommandInteraction) -> CreateEm
let guild_id = match &command.guild_id {
Some(guild_id) => guild_id,
None => {
return Embed::create(username, "GuildId not found", "Could not find guild id.");
return Embed::create_error_respose(username, "guild_id not found", "Could not find guild id.");
}
};