commands.CommandApplication
- interface CommandApplication
A command registry created for one script. Register commands and component handlers at module scope. Slash and context-menu definitions are synchronized when the deployment is published; prefix commands are matched only by the running script.
- Extends:
Properties
Property
Type
Description
{ message: ; user: ; }
Methods
- CommandApplication.button(customId: string, handler: ComponentHandler)
Handles clicks on buttons with a matching custom ID. Link and premium buttons have no custom ID and never reach a handler.
Filters, permissions, and cooldowns work as they do for commands. Their failure messages are sent as ephemeral replies, so only the person who clicked sees them.
Example
commands.button("ticket:close", async (interaction, [ticketId]) => { await closeTicket(ticketId); await interaction.update({ content: "Ticket closed.", components: [] }); });
- CommandApplication.list() { aliases: string[]; description?: string; kind: “slash” | “prefix” | “menu”; name: string; path: string[]; }[]
- CommandApplication.modal(customId: string, handler: ComponentHandler)
Handles submissions of modals with a matching custom ID. Read the fields with
interaction.getTextInput()and the other modal getters.
- CommandApplication.prefix<TSchema>(
- config:
PrefixConfig<TSchema>, - handler: (message:
GuildMemberMessage, args: InferArguments<TSchema>) => Promise<unknown> - Type parameters:
TSchema – (extends ArgumentMap)