add special weather warning icons

This commit is contained in:
bignutty 2024-08-04 17:54:31 +02:00
parent d4879275e2
commit 6ad7afe8f8
3 changed files with 12 additions and 2 deletions

View file

@ -38,7 +38,7 @@ function renderWeatherCard(context, data, units){
if(data.result.warnings.length >= 1){ if(data.result.warnings.length >= 1){
for(const w of data.result.warnings.splice(0, 1)){ for(const w of data.result.warnings.splice(0, 1)){
if(description.includes(stringwrap(w.label, 50))) continue; if(description.includes(stringwrap(w.label, 50))) continue;
description += `\n\n${icon("warning")} **${stringwrap(w.label, 50)}**\n-# ${stringwrap(w.source, 50)}${link(w.url, "Learn More", "Learn more about this alert")}` 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")}`
} }
} }

View file

@ -38,7 +38,7 @@ function renderWeatherCard(context, data, units){
if(data.result.warnings.length >= 1){ if(data.result.warnings.length >= 1){
for(const w of data.result.warnings.splice(0, 1)){ for(const w of data.result.warnings.splice(0, 1)){
if(description.includes(stringwrap(w.label, 50))) continue; if(description.includes(stringwrap(w.label, 50))) continue;
description += `\n\n${icon("warning")} **${stringwrap(w.label, 50)}**\n-# ${stringwrap(w.source, 50)}${link(w.url, "Learn More", "Learn more about this alert")}` 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")}`
} }
} }

View file

@ -154,6 +154,7 @@ module.exports.ICONS = Object.freeze({
"exclaim_4": "<:ico_exclaim_4:1263588879307640883>", "exclaim_4": "<:ico_exclaim_4:1263588879307640883>",
"question_large": "<:ico_question_large:1263589058999750787>", "question_large": "<:ico_question_large:1263589058999750787>",
// These icon names (weather_:conditionId) have to be synced with the server.
"weather_blizzard": "<:ico_w_blizzard:1263583584850022460>", "weather_blizzard": "<:ico_w_blizzard:1263583584850022460>",
"weather_blowing_snow": "<:ico_w_blowing_snow:1263583671726903377>", "weather_blowing_snow": "<:ico_w_blowing_snow:1263583671726903377>",
"weather_clear_day": "<:ico_w_clear_day:1263583684158820383>", "weather_clear_day": "<:ico_w_clear_day:1263583684158820383>",
@ -190,6 +191,15 @@ module.exports.ICONS = Object.freeze({
"weather_very_hot": "<:very_hot:1263588713838018652>", "weather_very_hot": "<:very_hot:1263588713838018652>",
"weather_windy": "<:ico_w_windy_breezy:1263585171849084968>", "weather_windy": "<:ico_w_windy_breezy:1263585171849084968>",
"weather_warning_generic": "<:ico_weather_warning:1269684384966119444>",
// These icon names (weather_warning_:warningId) have to be synced with the server.
"weather_warning_storm": "<:ico_weather_wind:1269680554140242066>",
"weather_warning_tropical_storm": "<:ico_weather_tropicalstorm:1269680544430428312>",
"weather_warning_tornado": "<:ico_weather_tornado:1269680535517794334>",
"weather_warning_heat": "<:ico_weather_heat:1269680524897681564>",
"weather_warning_frost": "<:ico_weather_frost:1269680515145797652>",
"weather_warning_flood": "<:ico_weather_flood:1269680505519865982>",
"information": "<:ico_information:1263590946226835510>", "information": "<:ico_information:1263590946226835510>",
"question": "<:ico_question:1263590898906697800>", "question": "<:ico_question:1263590898906697800>",
"warning": "<:ico_warning:1263590857072967832>", "warning": "<:ico_warning:1263590857072967832>",