bindTo

@CheckReturnValue
open fun bindTo(handler: Consumer<E>): T(source)

Binds the given handler to this component.

Captured entities

Pay extra attention to not capture JDA entities in such handlers as they can stop being updated by JDA.

Parameters

handler

The handler to run when the button is clicked


open fun bindTo(handler: suspend (E) -> Unit): T(source)

Binds the given handler to this component.

Captured entities

Pay extra attention to not capture JDA entities in such handlers as they can stop being updated by JDA.

You can still use User.ref and such from JDA-KTX to attenuate this issue, even though it will return you an outdated object if the entity cannot be found anymore.

Parameters

handler

The handler to run when the button is clicked


@CheckReturnValue
open fun bindTo(handler: Consumer<E>, block: ReceiverConsumer<EphemeralHandlerBuilder<E>>): T(source)

Deprecated

Nothing to be configured, will be removed

Replace with

bindTo(handler)

Binds the given handler to this component.

Captured entities

Pay extra attention to not capture JDA entities in such handlers as they can stop being updated by JDA.

Parameters

handler

The handler to run when the button is clicked


abstract fun bindTo(handler: suspend (E) -> Unit, block: ReceiverConsumer<EphemeralHandlerBuilder<E>>): T(source)

Deprecated

Nothing to be configured, will be removed

Replace with

bindTo(handler)

Binds the given handler to this component.

Captured entities

Pay extra attention to not capture JDA entities in such handlers as they can stop being updated by JDA.

You can still use User.ref and such from JDA-KTX to attenuate this issue, even though it will return you an outdated object if the entity cannot be found anymore.

Parameters

handler

The handler to run when the button is clicked