added scheduling support

added remind command
added support for parameters with spaces (they are contained by ")
fixed support for remainder parameters
added maxlength support for parameters
added ability to embed templates, to have a text as well
moved properties to a more appropriate position
added method do parse a duration
This commit is contained in:
Sheldan
2020-03-28 20:12:59 +01:00
parent e0474a4c98
commit 03e81a025b
64 changed files with 1318 additions and 125 deletions

View File

@@ -11,4 +11,5 @@ public class Parameter {
private String description;
private boolean optional;
private boolean remainder;
private Integer maxLength;
}

View File

@@ -1,11 +1,38 @@
package dev.sheldan.abstracto.command.meta;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Getter @Setter
@Getter
public class UnParsedCommandParameter {
private static Pattern SPLIT_REGEX = Pattern.compile("\"([^\"]*)\"|(\\S+)");
public UnParsedCommandParameter(String parameters) {
this.parameters = new ArrayList<>();
Matcher m = SPLIT_REGEX.matcher(parameters);
boolean skippedCommand = false;
while (m.find()) {
if(!skippedCommand) {
skippedCommand = true;
continue;
}
if (m.group(1) != null) {
String group = m.group(1);
if(!group.equals("")) {
this.parameters.add(group);
}
} else {
String group = m.group(2);
if(!group.equals("")) {
this.parameters.add(group);
}
}
}
}
private List<String> parameters;
}