Create and update Discord slash commands for this Node.js + TypeScript + discord.js v14 template. Use when the request involves adding a new command, changing command options/subcommands, refactoring command behavior, or fixing command typing/execution in files under src/commands/.
Create one command module that exports command and matches the repository type pattern.
src/commands/<name>.ts for a simple command.src/commands/<group>/index.ts for grouped or complex command sets.index.ts.discord.js and Command from @/types.command exactly.SlashCommandBuilder for schema and execute for behavior.MessageFlags.Ephemeralinteraction.deferReply() before long operations.npm run typecheck.npm run check.npm run deploy-commands (or npm run deploy-commands -- --global when explicitly requested).import { type ChatInputCommandInteraction, MessageFlags, SlashCommandBuilder } from 'discord.js';
import type { Command } from '@/types';
export const command: Command<ChatInputCommandInteraction> = {
data: new SlashCommandBuilder().setName('command-name').setDescription('Command description'),
execute: async (interaction) => {
await interaction.reply({
content: 'Response',
flags: MessageFlags.Ephemeral
});
}
};
@/ path aliases, not relative imports for internal modules.src/events/interaction-create.ts command routing.