wrap warnings

This commit is contained in:
bignutty 2024-07-15 21:47:35 +02:00
parent f4a003cc55
commit d83a4d0503
2 changed files with 7 additions and 7 deletions

View file

@ -2,7 +2,7 @@ const { darksky } = require('#api');
const { createEmbed } = require('#utils/embed');
const { acknowledge } = require('#utils/interactions');
const { pill, iconPill, smallPill, weatherIcon, timestamp, icon, link} = require('#utils/markdown');
const { pill, iconPill, smallPill, weatherIcon, timestamp, icon, link, stringwrap} = require('#utils/markdown');
const { editOrReply } = require('#utils/message');
const { STATICS } = require('#utils/statics');
@ -54,9 +54,9 @@ module.exports = {
// Render weather alerts
if(data.result.warnings.length >= 1){
for(const w of data.result.warnings.splice(0, 2)){
if(description.includes(w.label)) continue;
description += `\n\n${icon("warning")} **${w.label}**\n-# ${w.source}${link(w.url, "Learn More", "Learn more about this alert")}`
for(const w of data.result.warnings.splice(0, 1)){
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")}`
}
}

View file

@ -41,9 +41,9 @@ module.exports = {
// Render weather alerts
if(data.result.warnings.length >= 1){
for(const w of data.result.warnings.splice(0, 2)){
if(description.includes(w.label)) continue;
description += `\n\n${icon("warning")} **${w.label}**\n-# ${w.source}${link(w.url, "Learn More", "Learn more about this alert")}`
for(const w of data.result.warnings.splice(0, 1)){
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")}`
}
}