🎨 Add caption for string "No input was provided"

This commit is contained in:
jmp 2020-10-16 12:18:39 -07:00 • committed by Alexander Söderberg
parent c67cc35cf6
commit fba29041e6
29 changed files with 191 additions and 31 deletions

View file

@ -27,6 +27,7 @@ import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.context.CommandContext;
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
import net.dv8tion.jda.api.entities.MessageChannel;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
@ -152,7 +153,10 @@ public final class ChannelArgument<C> extends CommandArgument<C, MessageChannel>
) {
final String input = inputQueue.peek();
if (input == null) {
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
return ArgumentParseResult.failure(new NoInputProvidedException(
MessageParser.class,
commandContext
));
}
final MessageReceivedEvent event = commandContext.get("MessageReceivedEvent");

View file

@ -27,6 +27,7 @@ import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.context.CommandContext;
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.entities.User;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -151,7 +152,10 @@ public final class UserArgument<C> extends CommandArgument<C, User> {
) {
final String input = inputQueue.peek();
if (input == null) {
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
return ArgumentParseResult.failure(new NoInputProvidedException(
UserParser.class,
commandContext
));
}
final JDA jda = commandContext.get("JDA");