Refactor command packages
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-20 18:56:57 +01:00
parent 3474593dc9
commit 913e8e023a
10 changed files with 44 additions and 31 deletions

View File

@@ -0,0 +1,33 @@
package wtf.beatrice.hidekobot.commands.completer;
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
import net.dv8tion.jda.api.interactions.commands.Command;
import org.jetbrains.annotations.NotNull;
import wtf.beatrice.hidekobot.commands.slash.AvatarCommand;
import java.util.ArrayList;
import java.util.List;
public class AvatarCompleter
{
public AvatarCompleter(@NotNull CommandAutoCompleteInteractionEvent event)
{
if(event.getFocusedOption().getName().equals("size"))
{
List<Command.Choice> options = new ArrayList<>();
for(int res : AvatarCommand.acceptedSizes)
{
String resString = String.valueOf(res);
String userInput = event.getFocusedOption().getValue();
if(resString.startsWith(userInput))
options.add(new Command.Choice(resString, res));
}
event.replyChoices(options).queue();
}
}
}