diff --git a/crates/commands/src/commands.rs b/crates/commands/src/commands.rs index 8c2c5357..d9ab69b7 100644 --- a/crates/commands/src/commands.rs +++ b/crates/commands/src/commands.rs @@ -33,6 +33,7 @@ pub struct Command { pub tokens: Vec, pub help: SmolStr, pub cb: SmolStr, + pub show_in_suggestions: bool, } impl Command { @@ -40,11 +41,13 @@ impl Command { tokens: impl IntoIterator, help: impl Into, cb: impl Into, + show_in_suggestions: bool, ) -> Self { Self { tokens: tokens.into_iter().collect(), help: help.into(), cb: cb.into(), + show_in_suggestions, } } } @@ -63,8 +66,11 @@ impl Display for Command { #[macro_export] macro_rules! command { + ([$($v:expr),+], $cb:expr, $help:expr, suggest = $suggest:expr) => { + $crate::commands::Command::new([$($v.to_token()),*], $help, $cb, $suggest) + }; ([$($v:expr),+], $cb:expr, $help:expr) => { - $crate::commands::Command::new([$($v.to_token()),*], $help, $cb) + $crate::command!([$($v),+], $cb, $help, suggest = true) }; } diff --git a/crates/commands/src/commands/member.rs b/crates/commands/src/commands/member.rs index 12b66155..534c7417 100644 --- a/crates/commands/src/commands/member.rs +++ b/crates/commands/src/commands/member.rs @@ -19,11 +19,6 @@ pub fn cmds() -> impl Iterator { "member_show", "Shows information about a member" ), - command!( - [member, MemberRef("target"), "soulscream"], - "member_soulscream", - "todo" - ), command!( [member, MemberRef("target"), description], "member_desc_show", @@ -55,6 +50,12 @@ pub fn cmds() -> impl Iterator { "member_privacy_update", "Changes a member's privacy settings" ), + command!( + [member, MemberRef("target"), "soulscream"], + "member_soulscream", + "todo", + suggest = false + ), ] .into_iter() } diff --git a/crates/commands/src/lib.rs b/crates/commands/src/lib.rs index 64bcf33a..22a1e6a4 100644 --- a/crates/commands/src/lib.rs +++ b/crates/commands/src/lib.rs @@ -110,6 +110,7 @@ pub fn parse_command(prefix: String, input: String) -> CommandResult { if !possible_commands.is_empty() { error.push_str(" Perhaps you meant to use one of the commands below:\n"); for command in possible_commands { + if !command.show_in_suggestions { continue } writeln!(&mut error, "- **{prefix}{command}** - *{}*", command.help) .expect("oom"); }