use of com.discordbolt.api.command.exceptions.CommandStateException in project BoltBot by DiscordBolt.
the class TagModule method tagAddCommand.
@BotCommand(command = { "tag", "add" }, description = "Adds a Tag", usage = "Tag add [tag]", module = "Tag Module", minArgs = 4, maxArgs = 100)
public static void tagAddCommand(CommandContext cc) throws CommandException {
try {
TagData tagData = TagData.create(cc.getGuild().getLongID(), cc.getAuthor().getLongID(), cc.getArgument(2), cc.combineArgs(3, cc.getArgCount() - 1));
cc.replyWith("Successfully registered your new tag. Use `" + getTagPrefix(cc.getGuild()) + tagData.getName() + "` to view it.");
} catch (IllegalStateException e) {
throw new CommandStateException("That tag already exists! Please choose a different tag");
} catch (IllegalArgumentException e) {
throw new CommandArgumentException(e.getMessage());
}
}
Aggregations