mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 17:50:13 +00:00
hide admin commands from suggestions etc.
This commit is contained in:
parent
7dd2a4e7e1
commit
42c9429953
3 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,12 @@ public partial class CommandTree
|
||||||
{
|
{
|
||||||
private async Task PrintCommandList(Context ctx, string subject, string commands)
|
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: <https://pluralkit.me/commands>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await ctx.Reply(
|
await ctx.Reply(
|
||||||
components: [
|
components: [
|
||||||
new MessageComponent()
|
new MessageComponent()
|
||||||
|
|
|
||||||
|
|
@ -71,4 +71,5 @@ pub fn cmds() -> impl Iterator<Item = Command> {
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(abuselog_cmds)
|
.chain(abuselog_cmds)
|
||||||
|
.map(|cmd| cmd.show_in_suggestions(false))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,9 @@ pub fn parse_command(prefix: String, input: String) -> CommandResult {
|
||||||
pub fn get_related_commands(prefix: String, input: String) -> String {
|
pub fn get_related_commands(prefix: String, input: String) -> String {
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
for command in command_definitions::all() {
|
for command in command_definitions::all() {
|
||||||
|
if !command.show_in_suggestions {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if command.tokens.first().map_or(false, |token| {
|
if command.tokens.first().map_or(false, |token| {
|
||||||
token
|
token
|
||||||
.try_match(Some(&input))
|
.try_match(Some(&input))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue