updates for random and catgories
This commit is contained in:
11
commands/category.js
Normal file
11
commands/category.js
Normal file
@@ -0,0 +1,11 @@
|
||||
var libFlayer = require("../libFlayer.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'categories',
|
||||
description: 'Categories',
|
||||
async execute(message) {
|
||||
message.reply(
|
||||
`Categories: [General, Entertainment, Sports, Tech]`
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -7,12 +7,14 @@ module.exports = {
|
||||
message.reply(
|
||||
`!help - Lists the available commands
|
||||
**!key** - Testing remote Airtable: *!key url*
|
||||
**!categories** - Displays Categories: *!categories*
|
||||
**!search** - Searches the RSS Sources: *!search google*
|
||||
**!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: *!quote*
|
||||
**!random** - Selects a random article: *!random*
|
||||
**!random category** - Selects a random article by category: *!random sports*
|
||||
`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,11 +4,20 @@ var libFlayer = require("../libFlayer.js");
|
||||
module.exports = {
|
||||
name: 'random',
|
||||
description: 'Random',
|
||||
execute(message) {
|
||||
execute(message, args) {
|
||||
let category = "";
|
||||
let catName = "All";
|
||||
if (args.length == 1) {
|
||||
category = args[0];
|
||||
catName = category;
|
||||
}
|
||||
|
||||
message.reply(
|
||||
`Selecting a random article...`
|
||||
`Random article - loading...
|
||||
Category: ${catName}
|
||||
`
|
||||
);
|
||||
var feedArray = libFlayer.getFeeds();
|
||||
var feedArray = libFlayer.getFeeds(category);
|
||||
var i = Math.floor(Math.random() * (feedArray.length - 0) + 0 );
|
||||
|
||||
message.reply(`Retrieving: [Link](${feedArray[i].link})`);
|
||||
|
||||
Reference in New Issue
Block a user