random and feed saving started

This commit is contained in:
John Facey
2021-12-13 17:38:47 -06:00
parent 164fdea08a
commit 5c91571300
7 changed files with 130 additions and 7 deletions

View File

@@ -13,8 +13,8 @@ module.exports = {
var link = args[1];
libFlayer.addSource(title,link);
message.reply(
`Adding ${title} to the list of RSS sources`);
message.reply(`Adding ${title} to the list of RSS sources`);
libFlayer.writeFeed();
libFlayer.loadFeeds();
},

View File

@@ -7,11 +7,11 @@ module.exports = {
message.reply(
`!help - Lists the available commands
**!search** - Searches the RSS Sources: *!search google*
**!get**- Retrieves Search By Index: *!get 25*
**!get** - Retrieves Search By Index: *!get 25*
**!add** - Add a new RSS Source Feed dynamically: *!add http://www.engadget.com/rss.xml*
**!update** - Updates all current RSS Feeds: *!update*
**!quote** - Selects a random quote: *!update*
**!exit** - Force kills bot: *!exit*
**!quote** - Selects a random quote: *!quote*
**!random** - Selects a random article: *!random*
`
);
}

16
commands/random.js Normal file
View File

@@ -0,0 +1,16 @@
var libFlayer = require("../libFlayer.js");
module.exports = {
name: 'random',
description: 'Random',
async execute(message) {
message.reply(
`Selecting a random article...`
);
var i = Math.floor(Math.random() * (max - min + 1) + min );
var feedArray = libFlayer.getFeeds();
message.reply(`Retrieving: [Link](${feedArray[i].link})`);
}
};