Text Command Rejection Handler
Processes text command rejections returned by text command filters.
Requirements
Register your instance as a service with @BService.
Implement either handle (Java) or handleSuspend (Kotlin).
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()
}
}
Content copied to clipboard
@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();
}
}
Content copied to clipboard
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)