TextCommandRejectionHandler

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

Processes text command rejections returned by text command filters.

Requirements

Example - Replying the error string returned by the TextCommandFilter example

@BService
class MyTextCommandRejectionHandler : TextCommandRejectionHandler<String>, ApplicationCommandRejectionHandler<String> {
override suspend fun handleSuspend(event: MessageReceivedEvent, variation: TextCommandVariation, args: String, userData: String) {
event.message.reply(userData).await()
}
}

@BService
public class MyTextCommandRejectionHandler implements TextCommandRejectionHandler<String> {
@Override
public void handle(@NotNull MessageReceivedEvent event, @NotNull TextCommandVariation variation, @NotNull String args, @NotNull String userData) {
event.getMessage().reply(userData).queue();
}
}

Parameters

T

Type of the error object returned by TextCommandFilter

See also

Functions

Link copied to clipboard
open fun handle(event: MessageReceivedEvent, variation: TextCommandVariation, args: String, userData: T)
Link copied to clipboard
open suspend fun handleSuspend(event: MessageReceivedEvent, variation: TextCommandVariation, args: String, userData: T)