[AB-66] adding mines game

fixing suggestion evaluation job not getting the correct parameters
adding feature dependent parameters
This commit is contained in:
Sheldan
2022-12-02 01:33:38 +01:00
parent 96c38763b1
commit 0d6182c5d5
38 changed files with 992 additions and 29 deletions

View File

@@ -50,7 +50,4 @@ public class CommandConfiguration {
.enabled(false)
.build();
public int getNecessaryParameterCount(){
return (int) parameters.stream().filter(parameter -> !parameter.isOptional()).count();
}
}

View File

@@ -34,6 +34,9 @@ public class Parameter implements Serializable {
private List<ParameterValidator> validators = new ArrayList<>();
@Builder.Default
private Map<String, Object> additionalInfo = new HashMap<>();
// these are the features which potentially require this parameter
@Builder.Default
private List<String> dependentFeatures = new ArrayList<>();
public String getSlashCompatibleName() {
return name.toLowerCase(Locale.ROOT);

View File

@@ -38,6 +38,13 @@ public class MaxIntegerValueValidator implements ParameterValidator {
return Arrays.asList(param);
}
public static MaxIntegerValueValidator max(Long number) {
return MaxIntegerValueValidator
.builder()
.maxValue(number)
.build();
}
@Override
public String getExceptionTemplateName() {
return "command_parameter_validation_value_too_large";

View File

@@ -2,6 +2,7 @@ package dev.sheldan.abstracto.core.command.service;
import dev.sheldan.abstracto.core.command.Command;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
import dev.sheldan.abstracto.core.command.config.ModuleDefinition;
import dev.sheldan.abstracto.core.command.execution.UnParsedCommandParameter;
import net.dv8tion.jda.api.entities.Message;
@@ -19,4 +20,5 @@ public interface CommandRegistry {
Command getCommandByName(String name, boolean searchAliases, Long serverId);
Optional<Command> getCommandByNameOptional(String name, boolean searchAliases, Long serverId);
String getCommandName(String input, Long serverId);
long getParameterCountForCommandConfig(CommandConfiguration commandConfiguration, Long serverId);
}

View File

@@ -11,6 +11,7 @@ import java.util.Optional;
public interface ComponentPayloadManagementService {
ComponentPayload createPayload(String id, String payload, Class payloadType, String buttonOrigin, AServer server, ComponentType type);
void updatePayload(String id, String payload);
ComponentPayload createButtonPayload(ButtonConfigModel buttonConfigModel, AServer server);
ComponentPayload createButtonPayload(ButtonConfigModel buttonConfigModel, Long serverId);
ComponentPayload createModalPayload(ModalConfigPayload payloadConfig, Long serverId);

View File

@@ -6,5 +6,6 @@ import dev.sheldan.abstracto.core.interaction.button.ButtonPayload;
public interface ComponentPayloadService {
ComponentPayload createButtonPayload(String componentId, ButtonPayload payload, String origin, AServer server);
void updateButtonPayload(String componentId, ButtonPayload payload);
ComponentPayload createSelectionPayload(String componentId, ButtonPayload payload, String origin, AServer server);
}

View File

@@ -10,6 +10,7 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
public interface SlashCommandService {
void convertCommandConfigToCommandData(CommandConfiguration commandConfiguration, List<Pair<List<CommandConfiguration>, SlashCommandData>> existingCommands, Long serverId);
void convertCommandConfigToCommandData(CommandConfiguration commandConfiguration, List<Pair<List<CommandConfiguration>, SlashCommandData>> existingCommands);
CompletableFuture<List<Command>> updateGuildSlashCommand(Guild guild, List<Pair<List<CommandConfiguration>, SlashCommandData>> commandData);
CompletableFuture<Void> deleteGuildSlashCommands(Guild guild, List<Long> slashCommandId, List<Long> commandInServerIdsToUnset);