diff --git a/src/cmds/info.rs b/src/cmds/info.rs index 2252c2e..2d97a17 100644 --- a/src/cmds/info.rs +++ b/src/cmds/info.rs @@ -1,7 +1,59 @@ use crate::{consts::THEME_COLOR, Context, Error}; +/// View bot commands +#[poise::command(slash_command)] +pub async fn help(ctx: Context<'_>) -> Result<(), Error> { + ctx.send(|m| { + m.embed(|e| { + e.title("Help") + .color(THEME_COLOR) + .footer(|f| { + f.text(concat!( + env!("CARGO_PKG_NAME"), + " ver ", + env!("CARGO_PKG_VERSION") + )) + }) + .description( + "__Info Commands__ +`/help` `/info` +*run these commands with no options* + +__Play Commands__ +`/play` - Play a sound by name or ID +`/loop` - Play a sound on loop +`/disconnect` - Disconnect the bot +`/stop` - Stop playback + +__Library Commands__ +`/upload` - Upload a sound file +`/delete` - Delete a sound file +`/download` - Download a sound file +`/public` - Set a sound as public/private +`/list server` - List sounds on this server +`/list user` - List your sounds + +__Search Commands__ +`/search` - Search for public sounds by name +`/random` - View random public sounds + +__Setting Commands__ +`/greet set/unset` - Set or unset a join sound +`/greet enable/disable` - Enable or disable join sounds on this server +`/volume` - Change the volume + +__Advanced Commands__ +`/soundboard` - Create a soundboard", + ) + }) + }) + .await?; + + Ok(()) +} + /// Get additional information about the bot -#[poise::command(slash_command, category = "Information")] +#[poise::command(slash_command)] pub async fn info(ctx: Context<'_>) -> Result<(), Error> { let current_user = ctx.discord().cache.current_user(); @@ -11,11 +63,7 @@ pub async fn info(ctx: Context<'_>) -> Result<(), Error> { .color(THEME_COLOR) .footer(|f| f .text(concat!(env!("CARGO_PKG_NAME"), " ver ", env!("CARGO_PKG_VERSION")))) - .description(format!("Default prefix: `?` - -Reset prefix: `@{0} prefix ?` - -Invite me: https://discord.com/api/oauth2/authorize?client_id={1}&permissions=3165184&scope=applications.commands%20bot + .description(format!("Invite me: https://discord.com/api/oauth2/authorize?client_id={}&permissions=3165184&scope=applications.commands%20bot **Welcome to SoundFX!** Developer: <@203532103185465344> @@ -23,7 +71,6 @@ Find me on https://discord.jellywx.com/ and on https://github.com/JellyWX :) **An online dashboard is available!** Visit https://soundfx.jellywx.com/dashboard There is a maximum sound limit per user. This can be removed by subscribing at **https://patreon.com/jellywx**", - current_user.name, current_user.id.as_u64())))).await?; Ok(()) diff --git a/src/cmds/search.rs b/src/cmds/search.rs index 0cc3b06..8920be3 100644 --- a/src/cmds/search.rs +++ b/src/cmds/search.rs @@ -26,9 +26,15 @@ fn format_search_results<'a>(search_results: Vec) -> CreateReply<'a> { builder } -/// Show the sounds uploaded to this server +/// Show uploaded sounds #[poise::command(slash_command, rename = "list")] -pub async fn list_sounds(ctx: Context<'_>) -> Result<(), Error> { +pub async fn list_sounds(_ctx: Context<'_>) -> Result<(), Error> { + Ok(()) +} + +/// Show the sounds uploaded to this server +#[poise::command(slash_command, rename = "server")] +pub async fn list_guild_sounds(ctx: Context<'_>) -> Result<(), Error> { let sounds; let mut message_buffer; @@ -62,7 +68,7 @@ pub async fn list_sounds(ctx: Context<'_>) -> Result<(), Error> { } /// Show all sounds you have uploaded -#[poise::command(slash_command, rename = "me")] +#[poise::command(slash_command, rename = "user")] pub async fn list_user_sounds(ctx: Context<'_>) -> Result<(), Error> { let sounds; let mut message_buffer; diff --git a/src/main.rs b/src/main.rs index 89d629b..09e9826 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,6 +76,7 @@ async fn main() -> Result<(), Box> { let options = poise::FrameworkOptions { commands: vec![ + cmds::info::help(), cmds::info::info(), cmds::manage::change_public(), cmds::manage::upload_new_sound(), @@ -84,8 +85,13 @@ async fn main() -> Result<(), Box> { cmds::play::play(), cmds::play::loop_play(), cmds::play::soundboard(), - cmds::search::list_sounds(), - cmds::search::list_user_sounds(), + poise::Command { + subcommands: vec![ + cmds::search::list_guild_sounds(), + cmds::search::list_user_sounds(), + ], + ..cmds::search::list_sounds() + }, cmds::search::show_random_sounds(), cmds::search::search_sounds(), cmds::stop::stop_playing(), @@ -97,7 +103,6 @@ async fn main() -> Result<(), Box> { cmds::settings::enable_greet_sound(), cmds::settings::set_greet_sound(), cmds::settings::unset_greet_sound(), - cmds::settings::greet_sound(), ], ..cmds::settings::greet_sound() },