mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 04:26:57 +00:00
do not show common name text when no common names exist - either nil or empty list
This commit is contained in:
@@ -116,7 +116,7 @@ defmodule PlantIdDiscordBot.PlantNet.Parser do
|
||||
defp get_common_names(data) do
|
||||
common_names = data["species"]["commonNames"]
|
||||
|
||||
if length(common_names) > 0 do
|
||||
if is_list(common_names) && not Enum.empty?(common_names) do
|
||||
" Common names include **" <>
|
||||
Enum.join(common_names, ", ") <> "**."
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user