alerts added

This commit is contained in:
John Facey
2022-07-05 10:58:46 -05:00
parent 3d6747f72b
commit 89ab911ccd
4 changed files with 52 additions and 2 deletions

28
commands/alert.js Normal file
View File

@@ -0,0 +1,28 @@
var libFlayer = require("../libFlayer.js");
module.exports = {
name: 'alert',
description: 'Alert',
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 libFlayer.weatherAlert(question);
answerData.forEach(feature => {
message.reply(`
${feature.properties.areaDesc}
${feature.properties.headline}
${feature.properties.description}
`);
})
} catch (err) {
message.reply(err.toString());
}
}
};

View File

@@ -8,7 +8,7 @@ module.exports = {
`**!help** - *Lists the available commands*
**!key** - Testing remote Airtable: *!key url*
**!categories** - Displays Categories: *!categories*
**!search** - Searches the RSS Sources: *!search google*
**!find** - Searches the RSS Sources: *!find google*
**!get** - Retrieves Search By Index: *!get 25*
**!add** - Add a new RSS Source: *!add http://www.engadget.com/rss.xml*
**!update** - Updates all current RSS Feeds: *!update*
@@ -20,6 +20,7 @@ module.exports = {
**!stock** - AlphaVantage Stock Search: *!stock IBM*
**!play** - Plays a trivia game question: *!play*
**!answer** - Answers for a question above: *!answer 1*
**!alert** - Gets weather alerts for an area: *!alert TX*
`
);
}