Fixed bug on listing empty subtitle lists

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2020-10-26 23:12:34 +01:00
parent f692df6ce0
commit 2746c81466
2 changed files with 7 additions and 5 deletions

View File

@ -54,10 +54,12 @@ public class ListLang extends Command {
embed.setTitle("Results")
.setDescription("Found " + subtitles.getData().size() + " results.")
.setColor(Color.BISMARK);
if (!subtitles.getData().isEmpty()) {
StringBuilder s = new StringBuilder();
for (SubtitleInfo info : subtitles.getData().subList(0, Math.min(10, subtitles.getData().size())))
s.append(info.getId()).append(" - ").append(info.getLanguage()).append("\n");
embed.addField("Languages found", s.toString(), false);
}
});
} else if (subtitles.getStatus().getCode() == ResponseStatus.INVALID_PARAMETERS.getCode()) {
return messageChannel.createMessage("It looks like it is an invalid IMDB identifier.");

View File

@ -16,7 +16,7 @@ public class Version extends Command {
return event.getMessage().getChannel()
.flatMap(channel -> channel
.createEmbed(embedCreateSpec -> embedCreateSpec
.setColor(Color.RED)
.setColor(Color.BISMARK)
.setTitle(MovieQuoteBot.NAME)
.setDescription(MovieQuoteBot.DESCRIPTION)
.addField("Version", MovieQuoteBot.VERSION, true)