added a response for when nothing gets returned from the API
All checks were successful
NodBot Production Dockerization / build (pull_request) Successful in 7s

This commit is contained in:
Skylar Grant 2024-09-26 19:55:12 -04:00
parent e0c0dff82d
commit 28bd2f46cb

View File

@ -10,6 +10,10 @@ module.exports = {
// Also checks for validity of ICAOs // Also checks for validity of ICAOs
const icaoList = fn.avWx.parseICAOs(commandData); const icaoList = fn.avWx.parseICAOs(commandData);
const metarData = await fn.avWx.metar.getData(icaoList); const metarData = await fn.avWx.metar.getData(icaoList);
if (metarData.length === 0) {
message.reply('No METAR data found for the provided ICAOs.');
return;
}
const messages = fn.avWx.metar.parseData(metarData); const messages = fn.avWx.metar.parseData(metarData);
messages.forEach(messagePayload => { messages.forEach(messagePayload => {
message.reply(messagePayload); message.reply(messagePayload);