ApplicationCommandRejectionHandler

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

Processes application command rejections returned by application command filters.

Requirements

Example - Replying the error string returned by the ApplicationCommandFilter example

@BService
class MyApplicationCommandRejectionHandler : ApplicationCommandRejectionHandler<String> {
override suspend fun handleSuspend(event: GenericCommandInteractionEvent, commandInfo: ApplicationCommandInfo, userData: String) {
event.reply_(userData, ephemeral = true).await()
}
}

@BService
public class MyApplicationCommandRejectionHandler implements ApplicationCommandRejectionHandler<String> {
@Override
public void handle(@NotNull GenericCommandInteractionEvent event, @NotNull ApplicationCommandInfo commandInfo, @NotNull String userData) {
event.reply(userData).setEphemeral(true).queue();
}
}

Parameters

T

Type of the error object returned by ApplicationCommandFilter

See also

Functions

Link copied to clipboard
open fun handle(event: GenericCommandInteractionEvent, commandInfo: ApplicationCommandInfo, userData: T)
Link copied to clipboard
open suspend fun handleSuspend(event: GenericCommandInteractionEvent, commandInfo: ApplicationCommandInfo, userData: T)