Skip to content

ComponentHandler

Defined in: handlers/ComponentHandler.ts:7

Handler for message components (buttons, select menus) based on custom ID prefix

Context extends BaseInteractionContext = BaseInteractionContext

CType extends MessageComponentType = MessageComponentType

new ComponentHandler<Context, CType>(prefix, componentType, handler?): ComponentHandler<Context, CType>

Defined in: handlers/ComponentHandler.ts:21

string

The custom ID prefix this handler matches against. See the Custom ID System guide.

CType

The message component type this handler is registered for

(interaction) => any

Optional handler function, equivalent to calling addHandler afterwards

ComponentHandler<Context, CType>

readonly componentType: CType

Defined in: handlers/ComponentHandler.ts:13


readonly handlerType: "component" = "component"

Defined in: handlers/ComponentHandler.ts:11


readonly prefix: string

Defined in: handlers/ComponentHandler.ts:12

addHandler(handler): ComponentHandler<Context, CType>

Defined in: handlers/ComponentHandler.ts:41

Adds the component handler function.

(interaction) => any

The function to handle the component interaction

ComponentHandler<Context, CType>

The current ComponentHandler instance


execute(interaction): Promise<void>

Defined in: handlers/ComponentHandler.ts:51

Executes the component handler

MessageComponentInteractionObj<Context, CType>

Promise<void>


matches(customId): boolean

Defined in: handlers/ComponentHandler.ts:61

Checks if this handler matches the given custom ID

string

boolean