enabling auto complete for youtube command

This commit is contained in:
Sheldan
2022-07-27 22:13:48 +02:00
parent 51edb50eee
commit f9b85feeaf
17 changed files with 238 additions and 7 deletions

View File

@@ -4,8 +4,11 @@ import dev.sheldan.abstracto.core.FeatureAware;
import dev.sheldan.abstracto.core.command.config.CommandConfiguration;
import dev.sheldan.abstracto.core.command.execution.CommandContext;
import dev.sheldan.abstracto.core.command.execution.CommandResult;
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
public interface Command extends FeatureAware {
@@ -13,5 +16,6 @@ public interface Command extends FeatureAware {
default CommandResult execute(CommandContext commandContext) {return CommandResult.fromSuccess();}
default CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {return CompletableFuture.completedFuture(CommandResult.fromSuccess());}
default CompletableFuture<CommandResult> executeSlash(SlashCommandInteractionEvent event) { return CompletableFuture.completedFuture(CommandResult.fromSuccess());}
default List<String> performAutoComplete(CommandAutoCompleteInteractionEvent event) { return new ArrayList<>(); }
CommandConfiguration getConfiguration();
}

View File

@@ -29,6 +29,8 @@ public class Parameter implements Serializable {
@Builder.Default
private Integer listSize = 0;
@Builder.Default
private Boolean supportsAutoComplete = false;
@Builder.Default
private List<ParameterValidator> validators = new ArrayList<>();
@Builder.Default
private Map<String, Object> additionalInfo = new HashMap<>();

View File

@@ -0,0 +1,7 @@
package dev.sheldan.abstracto.core.interaction.slash.parameter;
import net.dv8tion.jda.api.interactions.AutoCompleteQuery;
public interface SlashCommandAutoCompleteService {
boolean matchesParameter(AutoCompleteQuery query, String parameterName);
}