Component Interaction Rejection Handler
Processes component interaction rejections returned by component interaction filters.
Requirements
Register your instance as a service with @BService.
Implement either handle (Java) or handleSuspend (Kotlin).
Acknowledge the interaction when it is rejected.
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()
}
}
Content copied to clipboard
@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();
}
}
Content copied to clipboard
Parameters
T
Type of the error object returned by ComponentInteractionFilter
See also
Functions
Link copied to clipboard
Link copied to clipboard
open suspend fun handleSuspend(event: GenericComponentInteractionCreateEvent, handlerName: String?, userData: T)