added README.md clean up commands

This commit is contained in:
johnfacey
2021-03-18 19:28:26 -05:00
parent eb818a0f39
commit c6c7661980
10 changed files with 67 additions and 22 deletions

1
.gitignore vendored
View File

@@ -1,2 +1 @@
node_modules/
config.json

View File

@@ -1,18 +1,57 @@
# Link-Flayer
Node.JS Discord RSS Bot
**Discord RSS News Bot**
Link Flayer is a Discord Bot designed to provide your Discord server with news.
Available Commands
**Setup**
- *npm install link-flayer* or *git clone https://github.com/johnfacey/link-flayer.git*
- Add your token from Discord Bot Interface to the *config.json* [https://discord.com/developers/applications/]
<pre>
Example: config.json
{
"prefix": "!",
"token": "{Your Discord Bot Token Here}"
}
</pre>
- Configure your feeds.json: Each node with a "title" and "link" attribute.
<pre>
Example: feeds.json
[
{
"title": "CNN Top Stories",
"link": "http://rss.cnn.com/rss/cnn_topstories.rss"
},
{
"title": "Reddit Front Page",
"link": "http://www.reddit.com/.rss"
},
{
"title": "Arstechnica",
"link": "http://feeds.arstechnica.com/arstechnica/index"
}
]
</pre>
**Usage**
- *npm start*
**Available Commands**
* !help - Lists the available commands: *!help*
* **!help** - Lists the available commands: *!help*
* !search - Searches the RSS Sources: *!search google*
* **!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*
* **!add** - Add a new RSS Source Feed dynamically: *!add http://www.engadget.com/rss.xml*
* !update - Updates all current RSS Feeds: *!update*
* **!update** - Updates all current RSS Feeds: *!update*

View File

@@ -9,9 +9,10 @@ module.exports = {
message.reply(`Please use in !get [number] format`);
return;
}
var command = args[0];
var param1 = args[1];
libFlayer.addSource(param1);
var title = args[0];
var link = args[1];
libFlayer.addSource(title,link);
libFlayer.loadFeeds();
},

View File

@@ -6,7 +6,7 @@ module.exports = {
execute(message, args) {
if (args.length < 1) {
message.reply(`Please use in !get [number] format`);
message.reply(`Use !get [number] Ex: !get 25`);
return;
}
var search = args[0];

View File

@@ -4,6 +4,10 @@ module.exports = {
name: 'help',
description: 'Help',
execute(message) {
message.reply('For a list of available commands type !commands');
message.reply('!help - Lists the available commands');
message.reply('**!search** - Searches the RSS Sources: *!search google*');
message.reply('**!get**- Retrieves Search By Index: *!get 25*');
message.reply('**!add** - Add a new RSS Source Feed dynamically: *!add http://www.engadget.com/rss.xml*');
message.reply('**!update** - Updates all current RSS Feeds: *!update*');
}
};

View File

@@ -11,13 +11,14 @@ module.exports = {
}
var search = args[0];
var found = false;
message.reply('Searching for: ' + search);
let i = 0;
var feedArray = libFlayer.getFeeds();
feedArray.forEach(linkFlay => {
if (linkFlay.title.toLowerCase().indexOf(search.toLowerCase()) > -1) {
found = true;
console.log(linkFlay.title);
message.reply(`Use !get ${i} to view: ${linkFlay.title}`);
@@ -25,5 +26,9 @@ module.exports = {
i++;
});
if (!found) {
message.reply(`No results found for: ${search}`);
}
}
};

View File

@@ -5,9 +5,6 @@ module.exports = {
description: 'List RSS Sources',
execute(message, args) {
var command = args[0];
var search = args[1];
var sourceArray = libFlayer.getSources();
sourceArray.forEach(source => {
message.reply(`[${source.title}](${source.link})`);

View File

@@ -4,7 +4,7 @@ module.exports = {
name: 'update',
description: 'Get RSS Source Link',
execute(message, args) {
message.reply(`Updating Sources`);
libFlayer.loadFeeds();
feedArray = libFlayer.getFeeds();

View File

@@ -35,5 +35,5 @@ client.on('message', message => {
});
console.log("Link Flayer Bot Activating");
client.login(token);
libFlayer.loadFeeds();
client.login(token); //Load Client Discord Token
libFlayer.loadFeeds(); //Load Configured Feeds

View File

@@ -5,9 +5,9 @@ let feeds = require('./feeds.json');
let linkFlayerMap = [];
exports.addSource = function(source){
exports.addSource = function(title,source){
var linkData = {
title: `${source}`,
title: `${title}`,
link: `${source}`
}
feeds.push(linkData);