From 6c8f5ca478d3c46c0df740d0c1342463ab525d05 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Tue, 11 Jul 2023 18:44:32 +0000 Subject: [PATCH] feat: simplified commands help --- src/commands/help.ts | 61 +++++++------------------------------------- src/routes/today.tsx | 2 +- 2 files changed, 10 insertions(+), 53 deletions(-) diff --git a/src/commands/help.ts b/src/commands/help.ts index 32e280296..210a68980 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -1,9 +1,4 @@ -import { - SlashCommandBuilder, - SlashCommandSubcommandBuilder, - SlashCommandSubcommandGroupBuilder, -} from 'discord.js'; -import embedInfo from '../core/discord/embedInfo.js'; +import { SlashCommandBuilder } from 'discord.js'; import { COMMANDS_RAW, CommandRegistry, @@ -49,52 +44,14 @@ export const helpCommand: CommandRegistry = { const subcommand = interaction.options.getSubcommand(); if (subcommand === 'commands') { - return [ - `# Commands\n\nBlitzkrieg offers the following commands:`, - embedInfo( - '', - COMMANDS_RAW.filter( - (registry) => registry.inPublic && registry.inProduction, - ) - .map((registry) => { - const info = `- \`/${registry.command.name}\`: ${registry.command.description}`; - const subcommandGroups = registry.command.options.filter( - (option) => - option instanceof SlashCommandSubcommandGroupBuilder, - ) as SlashCommandSubcommandGroupBuilder[]; - const subcommands = registry.command.options.filter( - (option) => option instanceof SlashCommandSubcommandBuilder, - ) as SlashCommandSubcommandBuilder[]; - - const tree = - subcommandGroups.length > 0 - ? subcommandGroups - .map((subcommandGroup) => { - const info = ` - \`${subcommandGroup.name}\`: ${subcommandGroup.description}`; - const subcommands = subcommandGroup.options - .map( - (subcommand) => - ` - \`${subcommand.name}\`: ${subcommand.description}`, - ) - .join('\n'); - - return `${info}${ - subcommands ? `\n${subcommands}` : '' - }`; - }) - .join('\n') - : subcommands - .map( - (subcommand) => - ` - \`${subcommand.name}\`: ${subcommand.description}`, - ) - .join('\n'); - - return `${info}${tree ? `\n${tree}` : ''}`; - }) - .join('\n'), - ), - ]; + return `# Commands\n\nBlitzkrieg offers the following commands:\n\n${COMMANDS_RAW.filter( + (registry) => registry.inPublic && registry.inProduction, + ) + .map( + (registry) => + `- \`/${registry.command.name}\`: ${registry.command.description}`, + ) + .join('\n')}`; } const url = `${RAW_PATH}${DOCS[subcommand]}.md`; diff --git a/src/routes/today.tsx b/src/routes/today.tsx index 257c79473..b4bf67298 100644 --- a/src/routes/today.tsx +++ b/src/routes/today.tsx @@ -5,7 +5,7 @@ import { RouteRegistry } from '../server.js'; export const todayRoute: RouteRegistry = { route: '/today', inProduction: true, - inDevelopment: false, + inDevelopment: true, async handler(req) { const player = resolvePlayerFromRequest(req);