fix: remove failing when empty queue

This commit is contained in:
ZtereoHYPE 2022-01-03 19:55:46 +01:00
parent bddb3b99d7
commit 1da3142ebd

View file

@ -45,6 +45,10 @@ public class Remove implements Command {
TrackManager trackManager = TrackManagers.getGuildTrackManager(guild, messageChannel); TrackManager trackManager = TrackManagers.getGuildTrackManager(guild, messageChannel);
assert trackManager != null; // the command will not execute if it is anyway because of our VoiceChecks (BOT_PLAYING) assert trackManager != null; // the command will not execute if it is anyway because of our VoiceChecks (BOT_PLAYING)
if (trackManager.trackQueue.size() == 0) {
messageChannel.sendMessage("There are no songs in queue.").queue();
}
Map<String, Integer> indexAliases = new HashMap<>(); Map<String, Integer> indexAliases = new HashMap<>();
indexAliases.put("first", 1); indexAliases.put("first", 1);
indexAliases.put("last", trackManager.trackQueue.size()); indexAliases.put("last", trackManager.trackQueue.size());
@ -69,6 +73,7 @@ public class Remove implements Command {
} }
trackManager.removeQueueItem(parsedIndex - 1); trackManager.removeQueueItem(parsedIndex - 1);
messageChannel.sendMessage("Removed the song.").queue();
} }
public static boolean isNumeric(String strNum) { public static boolean isNumeric(String strNum) {