Skip to content

Commit

Permalink
fixed choice implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
codejanovic committed Apr 28, 2024
1 parent ed9fd17 commit f44680f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.zrdj</groupId>
<artifactId>javachord</artifactId>
<version>3.8.0.2</version>
<version>3.8.0.3</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/github/zrdj/javachord/Javachord.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,16 @@ static RequiredOption<String> stringOption(final String name, final String descr
return new RequiredOption<>(name, description, SlashCommandOptionType.STRING, (n, e) -> e.getArgumentStringValueByName(n).orElseThrow());
}

static RequiredOption<String> booleanOption(final String name, final String description) {
return new RequiredOption<>(name, description, SlashCommandOptionType.BOOLEAN, (n, e) -> e.getArgumentStringValueByName(n).orElseThrow());
static RequiredOption<Boolean> booleanOption(final String name, final String description) {
return new RequiredOption<>(name, description, SlashCommandOptionType.BOOLEAN, (n, e) -> e.getArgumentBooleanValueByName(n).orElseThrow());
}

static RequiredOption<String> longOption(final String name, final String description) {
return new RequiredOption<>(name, description, SlashCommandOptionType.LONG, (n, e) -> e.getArgumentStringValueByName(n).orElseThrow());
static RequiredOption<Long> longOption(final String name, final String description) {
return new RequiredOption<>(name, description, SlashCommandOptionType.LONG, (n, e) -> e.getArgumentLongValueByName(n).orElseThrow());
}

static RequiredOption<String> decimalOption(final String name, final String description) {
return new RequiredOption<>(name, description, SlashCommandOptionType.DECIMAL, (n, e) -> e.getArgumentStringValueByName(n).orElseThrow());
static RequiredOption<Double> decimalOption(final String name, final String description) {
return new RequiredOption<>(name, description, SlashCommandOptionType.DECIMAL, (n, e) -> e.getArgumentDecimalValueByName(n).orElseThrow());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ChoiceLongOptionalOption extends OptionalOption<Long> {
private final List<Choice<Long>> _choices;

public ChoiceLongOptionalOption(final String name, final String description, final List<Choice<Long>> channelTypes) {
super(name, description, SlashCommandOptionType.CHANNEL, (n, e) -> e.getArgumentLongValueByName(n));
super(name, description, SlashCommandOptionType.LONG, (n, e) -> e.getArgumentLongValueByName(n));
_choices = channelTypes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ChoiceLongRequiredOption extends RequiredOption<Long> {
private final List<Choice<Long>> _choices;

public ChoiceLongRequiredOption(final String name, final String description, final List<Choice<Long>> channelTypes) {
super(name, description, SlashCommandOptionType.CHANNEL, (n, e) -> e.getArgumentLongValueByName(n).orElseThrow());
super(name, description, SlashCommandOptionType.LONG, (n, e) -> e.getArgumentLongValueByName(n).orElseThrow());
_choices = channelTypes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ChoiceStringOptionalOption extends OptionalOption<String> {
private final List<Choice<String>> _choices;

public ChoiceStringOptionalOption(final String name, final String description, final List<Choice<String>> choices) {
super(name, description, SlashCommandOptionType.CHANNEL, (n, e) -> e.getArgumentStringValueByName(n));
super(name, description, SlashCommandOptionType.STRING, (n, e) -> e.getArgumentStringValueByName(n));
_choices = choices;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ChoiceStringRequiredOption extends RequiredOption<String> {
private final List<Choice<String>> _choices;

public ChoiceStringRequiredOption(final String name, final String description, final List<Choice<String>> channelTypes) {
super(name, description, SlashCommandOptionType.CHANNEL, (n, e) -> e.getArgumentStringValueByName(n).orElseThrow());
super(name, description, SlashCommandOptionType.STRING, (n, e) -> e.getArgumentStringValueByName(n).orElseThrow());
_choices = channelTypes;
}

Expand Down

0 comments on commit f44680f

Please sign in to comment.