From 42c94299538353c89afd99540fa454cd962f58db Mon Sep 17 00:00:00 2001 From: dusk Date: Sat, 11 Oct 2025 05:17:13 +0000 Subject: [PATCH] hide admin commands from suggestions etc. --- PluralKit.Bot/CommandMeta/CommandParseErrors.cs | 6 ++++++ crates/command_definitions/src/admin.rs | 1 + crates/commands/src/lib.rs | 3 +++ 3 files changed, 10 insertions(+) diff --git a/PluralKit.Bot/CommandMeta/CommandParseErrors.cs b/PluralKit.Bot/CommandMeta/CommandParseErrors.cs index 5b54df32..fae70988 100644 --- a/PluralKit.Bot/CommandMeta/CommandParseErrors.cs +++ b/PluralKit.Bot/CommandMeta/CommandParseErrors.cs @@ -6,6 +6,12 @@ public partial class CommandTree { private async Task PrintCommandList(Context ctx, string subject, string commands) { + if (commands.Length == 0) + { + await ctx.Reply($"No commands related to {subject} was found. For the full list of commands, see the website: "); + return; + } + await ctx.Reply( components: [ new MessageComponent() diff --git a/crates/command_definitions/src/admin.rs b/crates/command_definitions/src/admin.rs index 032f137a..73a8e892 100644 --- a/crates/command_definitions/src/admin.rs +++ b/crates/command_definitions/src/admin.rs @@ -71,4 +71,5 @@ pub fn cmds() -> impl Iterator { ] .into_iter() .chain(abuselog_cmds) + .map(|cmd| cmd.show_in_suggestions(false)) } diff --git a/crates/commands/src/lib.rs b/crates/commands/src/lib.rs index 959683c7..ed67b282 100644 --- a/crates/commands/src/lib.rs +++ b/crates/commands/src/lib.rs @@ -147,6 +147,9 @@ pub fn parse_command(prefix: String, input: String) -> CommandResult { pub fn get_related_commands(prefix: String, input: String) -> String { let mut s = String::new(); for command in command_definitions::all() { + if !command.show_in_suggestions { + continue; + } if command.tokens.first().map_or(false, |token| { token .try_match(Some(&input))