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.options for a single command or this.match for several. Command authoring stays plain discord.js, seedcord codegen reads its toJSON() to type these options.
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 InteractionHandler class
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 SlashOptionRegistry, e.g. 'ban' or 'ban' | 'kick'.
Route extends keyof SlashOptionRegistryapi
Typed Discord REST API (@discordjs/core/http-only) over core.rest, one instance per core. The interaction callbacks on api.interactions bypass the reply surface. The no-raw-interaction-acks rule flags them in handler classes.
protected api: APIInherited from:RepliableHandler
protected options: SlashOptions<Route>buildSender()
protected 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>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>Inherited from:InteractionHandler