ComponentRegistry

Component registry, keeps track of components and handles incoming interaction events, dispatching as needed to registered component actions.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Mapping of registered modal IDs to their form objects.

Link copied to clipboard

Scheduler that can be used to schedule timeout tasks. All ComponentContainer objects use this scheduler.

Link copied to clipboard

Mapping of registered component IDs to their components.

Functions

Link copied to clipboard
suspend fun handle(event: ButtonInteractionCreateEvent)

Dispatch a ButtonInteractionCreateEvent to its button component object.

suspend fun handle(event: ModalSubmitInteractionCreateEvent)

Dispatch a ModalSubmitInteractionCreateEvent to its modal form object.

suspend fun handle(event: SelectMenuInteractionCreateEvent)

Dispatch a SelectMenuInteractionCreateEvent to its select (dropdown) menu component object.

Link copied to clipboard
open suspend fun register(component: ComponentWithID)

Register a component. Only components with IDs need registering.

open suspend fun register(modal: ModalForm)

Register a modal form.

Link copied to clipboard
open suspend fun unregister(component: ComponentWithID): Component?

Unregister a registered component.

open suspend fun unregister(id: String): Component?

Unregister a registered component, by ID.

Link copied to clipboard
open suspend fun unregisterModal(modal: ModalForm): ModalForm?

Unregister a registered modal form.

open suspend fun unregisterModal(id: String): ModalForm?

Unregister a registered modal form, by ID.