Compare commits
No commits in common. "2ff7a2522a6576979be32e8395a249231816d52f" and "70cce9e2ba6e2e9e3df5ec9af9a76652ca4839df" have entirely different histories.
2ff7a2522a
...
70cce9e2ba
7
funcs.js
7
funcs.js
|
@ -91,9 +91,10 @@ const generateDiscordEmbeds = (forecastData, numOfDays) => {
|
|||
if (period.icon?.startsWith("/")) {
|
||||
period.icon = `https://api.weather.gov${period.icon}`
|
||||
}
|
||||
console.log(period.icon)
|
||||
const embed = {
|
||||
title: `${period.name} in ${forecastData.properties.relativeLocation.properties.city} ${forecastData.properties.relativeLocation.properties.state}`,
|
||||
description: `Valid <t:${new Date(period.startTime)/1000}:f> - <t:${new Date(period.endTime)/1000}:f>\n${period.detailedForecast}`,
|
||||
description: period.detailedForecast,
|
||||
timestamp: new Date(period.startTime),
|
||||
thumbnail: {
|
||||
url: period.icon,
|
||||
|
@ -106,7 +107,7 @@ const generateDiscordEmbeds = (forecastData, numOfDays) => {
|
|||
},
|
||||
{
|
||||
name: 'Wind',
|
||||
value: `${period.windDirection}@${period.windSpeed}`,
|
||||
value: `${period.windDirection} ${period.windSpeed}`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
|
@ -121,7 +122,7 @@ const generateDiscordEmbeds = (forecastData, numOfDays) => {
|
|||
|
||||
],
|
||||
footer: {
|
||||
text: `Data provided by the National Weather Service · Elevation ${forecastData.properties.elevation.value}m`
|
||||
text: 'Data provided by the National Weather Service'
|
||||
}
|
||||
};
|
||||
embeds.push(embed);
|
||||
|
|
1
index.js
1
index.js
|
@ -1285,7 +1285,6 @@ discord.on("interactionCreate", async (interaction) => {
|
|||
await interaction.deferReply();
|
||||
periods = interaction.options.getInteger("periods") || 1;
|
||||
funcs.getWeatherBySearch(interaction.options.getString("location")).then((weather) => {
|
||||
if (config.debug >= 1) console.log(JSON.stringify(weather, null, 2))
|
||||
embeds = funcs.generateDiscordEmbeds(weather, periods);
|
||||
interaction.editReply({ embeds });
|
||||
}).catch((err) => {
|
||||
|
|
Loading…
Reference in a new issue