mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-30 14:09:51 +01:00
feat: simplified commands help
This commit is contained in:
1 parent
463af106be
commit
6c8f5ca478
2 files changed
+10
-53
No files matched your search
+9
-52
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { SlashCommandBuilder } from 'discord.js';
|
||||||
SlashCommandBuilder,
|
|
||||||
SlashCommandSubcommandBuilder,
|
|
||||||
SlashCommandSubcommandGroupBuilder,
|
|
||||||
} from 'discord.js';
|
|
||||||
import embedInfo from '../core/discord/embedInfo.js';
|
|
||||||
import {
|
import {
|
||||||
COMMANDS_RAW,
|
COMMANDS_RAW,
|
||||||
CommandRegistry,
|
CommandRegistry,
|
||||||
@@ -49,52 +44,14 @@ export const helpCommand: CommandRegistry = {
|
|||||||
const subcommand = interaction.options.getSubcommand();
|
const subcommand = interaction.options.getSubcommand();
|
||||||
|
|
||||||
if (subcommand === 'commands') {
|
if (subcommand === 'commands') {
|
||||||
return [
|
return `# Commands\n\nBlitzkrieg offers the following commands:\n\n${COMMANDS_RAW.filter(
|
||||||
`# Commands\n\nBlitzkrieg offers the following commands:`,
|
(registry) => registry.inPublic && registry.inProduction,
|
||||||
embedInfo(
|
)
|
||||||
'',
|
.map(
|
||||||
COMMANDS_RAW.filter(
|
(registry) =>
|
||||||
(registry) => registry.inPublic && registry.inProduction,
|
`- \`/${registry.command.name}\`: ${registry.command.description}`,
|
||||||
)
|
)
|
||||||
.map((registry) => {
|
.join('\n')}`;
|
||||||
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'),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `${RAW_PATH}${DOCS[subcommand]}.md`;
|
const url = `${RAW_PATH}${DOCS[subcommand]}.md`;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { RouteRegistry } from '../server.js';
|
|||||||
export const todayRoute: RouteRegistry = {
|
export const todayRoute: RouteRegistry = {
|
||||||
route: '/today',
|
route: '/today',
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
inDevelopment: false,
|
inDevelopment: true,
|
||||||
|
|
||||||
async handler(req) {
|
async handler(req) {
|
||||||
const player = resolvePlayerFromRequest(req);
|
const player = resolvePlayerFromRequest(req);
|
||||||
|
|||||||
Reference in new issue
Block a user