I'm working on a Discord bot using JDA (Java Discord API), and I'm having trouble setting up a slash command that includes an INTEGER option with a specific range. Despite going through the official JDA documentation and searching online, I couldn't find a solution that addresses my problem.
Please note that I do not just want to implement a if clause. I want to specifically cause the error seen below.
Currently I am implementing a slash command like this:
jda.updateCommands().addCommands(
Commands.slash("casino", "casino commands.")
.addSubcommands(
new SubcommandData("slots", "Play slots in the Casino.")
.addOption(OptionType.INTEGER, "amount", "the amount of money you want to bet.")
)
).queue();
You can use addOptions to pass in an instance of OptionData with more configuration.
addOptions(new OptionData(INTEGER, "amount", "...")
.setRequiredRange(1, 10))