Renamed alert to weather

This commit is contained in:
Logan Cusano
2023-02-24 20:21:12 -05:00
parent 893221424f
commit fb9fda1b07

29
commands/weather.js Normal file
View File

@@ -0,0 +1,29 @@
var libCore = require("../libCore.js");
module.exports = {
name: 'alert',
description: 'Get any current weather alerts in the state specified.',
example: "alert [state]",
async execute(message, args) {
try {
if (args.length < 1) {
message.reply(`Please use in !alert [state]`);
return;
}
var question = encodeURIComponent(args.join(" "));
var answerData = await libCore.weatherAlert(question);
answerData.forEach(feature => {
message.reply(`
${feature.properties.areaDesc}
${feature.properties.headline}
${feature.properties.description}
`);
})
} catch (err) {
message.reply(err.toString());
}
}
};