Skip to main content
Version: Next

ModalKit

ModalKit

Signature
class ModalKit extends ModalBuilder {
onSubmit(handler: CommandKitModalBuilderInteractionCollectorDispatch, data?: CommandKitModalBuilderInteractionCollectorDispatchContextData) => this;
onEnd(handler: CommandKitModalBuilderOnEnd) => this;
onError(handler: EventInterceptorErrorHandler) => this;
filter(predicate: ModalKitPredicate) => this;
dispose() => ;
}
  • Extends: ModalBuilder

onSubmit

Sets the handler to run when the modal is submitted.

Example

const modal = new ModalKit()
.setTitle('My Modal')
.setCustomId('my-modal')
.filter((interaction) => interaction.user.id === '1234567890')
.onSubmit(async (interaction) => {
await interaction.reply('You submitted the modal!');
})
.addComponents(actionRow1, actionRow2);

onEnd

method
(handler: CommandKitModalBuilderOnEnd) => this

Sets the handler to run when the interaction collector ends.

onError

method
(handler: EventInterceptorErrorHandler) => this

Sets the handler to run when the interaction collector ends.

filter

method
(predicate: ModalKitPredicate) => this

Sets a filter for the interaction collector.

dispose

method
() =>