From edd2ef52d26936a6b0c3240e93c1dc0637ec1f7b Mon Sep 17 00:00:00 2001 From: big nutty <3515180-bignutty@users.noreply.gitlab.com> Date: Sun, 18 Aug 2024 10:45:54 +0000 Subject: [PATCH] fix issue with rendering logic in weather card --- commands/interaction/slash/utils/weather.js | 2 +- commands/message/utils/weather.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/interaction/slash/utils/weather.js b/commands/interaction/slash/utils/weather.js index 88fa565..2290f8e 100644 --- a/commands/interaction/slash/utils/weather.js +++ b/commands/interaction/slash/utils/weather.js @@ -39,7 +39,7 @@ function renderWeatherCard(context, data, units){ // Render weather alerts if(data.result.warnings.length >= 1){ - for(const w of data.result.warnings.splice(0, 1)){ + for(const w of [data.result.warnings[0]]){ if(description.includes(stringwrap(w.label, 50))) continue; description += `\n\n${icon("weather_warning_" + (w.icon || "generic").toLowerCase())} **${stringwrap(w.label, 50)}**\n-# ${stringwrap(w.source, 50)} • ${link(w.url, "Learn More", "Learn more about this alert")}` } diff --git a/commands/message/utils/weather.js b/commands/message/utils/weather.js index 0d7390d..a7a89ee 100644 --- a/commands/message/utils/weather.js +++ b/commands/message/utils/weather.js @@ -39,7 +39,7 @@ function renderWeatherCard(context, data, units){ // Render weather alerts if(data.result.warnings.length >= 1){ - for(const w of data.result.warnings.splice(0, 1)){ + for(const w of [data.result.warnings[0]]){ if(description.includes(stringwrap(w.label, 50))) continue; description += `\n\n${icon("weather_warning_" + (w.icon || "generic").toLowerCase())} **${stringwrap(w.label, 50)}**\n-# ${stringwrap(w.source, 50)} • ${link(w.url, "Learn More", "Learn more about this alert")}` }