better parsing for boolean options

This commit is contained in:
anthorob committed 2024-12-19 12:03:16 -05:00
1 parent 04bdb75087
commit b15ed9d577
1 file changed
+9 -1
@@ -177,7 +177,15 @@ public class MessageCommandContext extends CommandContext {
value = num;
}
case BOOLEAN -> value = Boolean.parseBoolean(args[index]);
case BOOLEAN -> {
String str = args[index];
if (str.equalsIgnoreCase("true") || str.equalsIgnoreCase("false")) {
value = Boolean.parseBoolean(str);
break;
}
invalidateContext(data, "expected true or false");
}
case NUMBER -> {
double num = Long.parseLong(args[index]);
if (!choices.isEmpty()) {