From 95f838c392920c71fb829f518bb8d2494e398a1c Mon Sep 17 00:00:00 2001 From: Nekojimi Date: Tue, 27 Feb 2024 20:07:16 +0000 Subject: [PATCH] Fix play command search result selection. --- .../nekojimi/chords/commands/PlayCommand.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/moe/nekojimi/chords/commands/PlayCommand.java b/src/main/java/moe/nekojimi/chords/commands/PlayCommand.java index cca433b..4ecd490 100644 --- a/src/main/java/moe/nekojimi/chords/commands/PlayCommand.java +++ b/src/main/java/moe/nekojimi/chords/commands/PlayCommand.java @@ -35,7 +35,7 @@ public class PlayCommand extends Command private static final double SEARCH_SCORE_THRESHOLD_DISPLAY = 0.6; private static final double SEARCH_SCORE_THRESHOLD_AUTOPLAY = 9999; // disable autoplay it sucks -// private List lastSearchResults; + private List lastSearchResults; public PlayCommand(Chords main) { @@ -56,15 +56,15 @@ public class PlayCommand extends Command } catch (MalformedURLException mux) { // not a URL, try parsing it as a search result - if (request.getSearchResults() != null && !request.getSearchResults().isEmpty()) + if (lastSearchResults != null && !lastSearchResults.isEmpty()) { try { int index = Integer.parseInt(invocation.getArgs().get(0)); - int size = request.getSearchResults().size(); + int size = lastSearchResults.size(); if (index >= 1 && index <= size) { - Result result = request.getSearchResults().get(index - 1); + Result result = lastSearchResults.get(index - 1); request.setResult(result); bot.queueDownload(request); // event.getChannel().sendMessage("Track removed.").queue(); @@ -91,8 +91,7 @@ public class PlayCommand extends Command return; } - request.setSearchResults(results); -// lastSearchResults = results; + lastSearchResults = results; if (results.isEmpty()) { @@ -130,4 +129,9 @@ public class PlayCommand extends Command } } + @Override + public String argumentDescription() + { + return ""; + } }