Fixed bug on listing empty subtitle lists
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
f692df6ce0
commit
2746c81466
@ -54,10 +54,12 @@ public class ListLang extends Command {
|
|||||||
embed.setTitle("Results")
|
embed.setTitle("Results")
|
||||||
.setDescription("Found " + subtitles.getData().size() + " results.")
|
.setDescription("Found " + subtitles.getData().size() + " results.")
|
||||||
.setColor(Color.BISMARK);
|
.setColor(Color.BISMARK);
|
||||||
|
if (!subtitles.getData().isEmpty()) {
|
||||||
StringBuilder s = new StringBuilder();
|
StringBuilder s = new StringBuilder();
|
||||||
for (SubtitleInfo info : subtitles.getData().subList(0, Math.min(10, subtitles.getData().size())))
|
for (SubtitleInfo info : subtitles.getData().subList(0, Math.min(10, subtitles.getData().size())))
|
||||||
s.append(info.getId()).append(" - ").append(info.getLanguage()).append("\n");
|
s.append(info.getId()).append(" - ").append(info.getLanguage()).append("\n");
|
||||||
embed.addField("Languages found", s.toString(), false);
|
embed.addField("Languages found", s.toString(), false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else if (subtitles.getStatus().getCode() == ResponseStatus.INVALID_PARAMETERS.getCode()) {
|
} else if (subtitles.getStatus().getCode() == ResponseStatus.INVALID_PARAMETERS.getCode()) {
|
||||||
return messageChannel.createMessage("It looks like it is an invalid IMDB identifier.");
|
return messageChannel.createMessage("It looks like it is an invalid IMDB identifier.");
|
||||||
|
@ -16,7 +16,7 @@ public class Version extends Command {
|
|||||||
return event.getMessage().getChannel()
|
return event.getMessage().getChannel()
|
||||||
.flatMap(channel -> channel
|
.flatMap(channel -> channel
|
||||||
.createEmbed(embedCreateSpec -> embedCreateSpec
|
.createEmbed(embedCreateSpec -> embedCreateSpec
|
||||||
.setColor(Color.RED)
|
.setColor(Color.BISMARK)
|
||||||
.setTitle(MovieQuoteBot.NAME)
|
.setTitle(MovieQuoteBot.NAME)
|
||||||
.setDescription(MovieQuoteBot.DESCRIPTION)
|
.setDescription(MovieQuoteBot.DESCRIPTION)
|
||||||
.addField("Version", MovieQuoteBot.VERSION, true)
|
.addField("Version", MovieQuoteBot.VERSION, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user