ComponentInteractionRejectionHandler

@InterfacedService(acceptMultiple = false)
interface ComponentInteractionRejectionHandler<T : Any>(source)

Processes component interaction rejections returned by component interaction filters.

Requirements

Example - Replying the error string returned by the ComponentInteractionFilter example

@BService
class MyComponentRejectionHandler : ComponentInteractionRejectionHandler<String> {
override suspend fun handleSuspend(event: GenericComponentInteractionCreateEvent, handlerName: String?, userData: String) {
event.reply_(userData, ephemeral = true).await()
}
}

@BService
public class MyComponentRejectionHandler implements ComponentInteractionRejectionHandler<String> {
@Override
public void handle(@NotNull GenericComponentInteractionCreateEvent event, @Nullable String handlerName, @NotNull String userData) {
event.reply(userData).setEphemeral(true).queue();
}
}

Parameters

T

Type of the error object returned by ComponentInteractionFilter

See also

Functions

Link copied to clipboard
open fun handle(event: GenericComponentInteractionCreateEvent, handlerName: String?, userData: T)
Link copied to clipboard
open suspend fun handleSuspend(event: GenericComponentInteractionCreateEvent, handlerName: String?, userData: T)