SlashHandler
Base class for a chat-input (slash) command handler on the HTTP transport.
Pass the route from the generated registry as the generic, then read this.optionsthis.options for a single command or this.matchthis.match for several. Command authoring stays plain discord.js, seedcord codegenseedcord codegen reads its toJSON()toJSON() to type these options.
abstract class SlashHandler<
Route extends keyof SlashOptionRegistry
> extends InteractionHandler<APIChatInputApplicationCommandInteraction>abstract class SlashHandler<
Route extends keyof SlashOptionRegistry
> extends InteractionHandler<APIChatInputApplicationCommandInteraction>Member visibility
Filter class members by access level.
constructor
Constructs a new instance of the InteractionHandlerInteractionHandler class
InteractionHandler(
event: Event,
core: Core,
dispatch?: DispatchContext
)InteractionHandler(
event: Event,
core: Core,
dispatch?: DispatchContext
)Inherited from:InteractionHandler
Showing members with Protected visibility and higher.
Properties
Methods
Route
One or more route keys from SlashOptionRegistrySlashOptionRegistry, e.g. 'ban''ban' or 'ban' | 'kick''ban' | 'kick'.
Route extends keyof SlashOptionRegistryRoute extends keyof SlashOptionRegistryprotected options: SlashOptions<Route>protected options: SlashOptions<Route>buildSender()
protected buildSender(
event: Event,
core: Core,
routeId: string
): ReplySenderprotected buildSender(
event: Event,
core: Core,
routeId: string
): ReplySenderInherited from:RepliableHandler
Run the arm for whichever command fired. Use this only when the handler is registered for several routes.
Provide one arm per registered route, keyed by its route string, and each arm receives that route's own narrowed options. The arms must cover every route in the generic, a missing route or an unknown key is a compile error.
protected async match<Ret>(
arms: SlashMatchArms<Route, Ret>
): Promise<Ret>protected async match<Ret>(
arms: SlashMatchArms<Route, Ret>
): Promise<Ret>armsOne handler per registered route, keyed by route string.
showModal()
Open a modal. Must be the initial response to this interaction. The modal kind rejects this call at compile time (Discord forbids a modal in response to a modal).
protected async showModal(
this: InteractionHandler<
Exclude<Repliables, APIModalSubmitInteraction>
>,
modal: ModalLike
): Promise<void>protected async showModal(
this: InteractionHandler<
Exclude<Repliables, APIModalSubmitInteraction>
>,
modal: ModalLike
): Promise<void>Inherited from:InteractionHandler