added README.md clean up commands
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
config.json
|
|
||||||
53
README.md
53
README.md
@@ -1,18 +1,57 @@
|
|||||||
# Link-Flayer
|
# 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.
|
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*
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ module.exports = {
|
|||||||
message.reply(`Please use in !get [number] format`);
|
message.reply(`Please use in !get [number] format`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var command = args[0];
|
var title = args[0];
|
||||||
var param1 = args[1];
|
var link = args[1];
|
||||||
libFlayer.addSource(param1);
|
|
||||||
|
libFlayer.addSource(title,link);
|
||||||
libFlayer.loadFeeds();
|
libFlayer.loadFeeds();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module.exports = {
|
|||||||
execute(message, args) {
|
execute(message, args) {
|
||||||
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
message.reply(`Please use in !get [number] format`);
|
message.reply(`Use !get [number] Ex: !get 25`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var search = args[0];
|
var search = args[0];
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ module.exports = {
|
|||||||
name: 'help',
|
name: 'help',
|
||||||
description: 'Help',
|
description: 'Help',
|
||||||
execute(message) {
|
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*');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -11,13 +11,14 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var search = args[0];
|
var search = args[0];
|
||||||
|
var found = false;
|
||||||
message.reply('Searching for: ' + search);
|
message.reply('Searching for: ' + search);
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
var feedArray = libFlayer.getFeeds();
|
var feedArray = libFlayer.getFeeds();
|
||||||
feedArray.forEach(linkFlay => {
|
feedArray.forEach(linkFlay => {
|
||||||
if (linkFlay.title.toLowerCase().indexOf(search.toLowerCase()) > -1) {
|
if (linkFlay.title.toLowerCase().indexOf(search.toLowerCase()) > -1) {
|
||||||
|
found = true;
|
||||||
console.log(linkFlay.title);
|
console.log(linkFlay.title);
|
||||||
message.reply(`Use !get ${i} to view: ${linkFlay.title}`);
|
message.reply(`Use !get ${i} to view: ${linkFlay.title}`);
|
||||||
|
|
||||||
@@ -25,5 +26,9 @@ module.exports = {
|
|||||||
i++;
|
i++;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
message.reply(`No results found for: ${search}`);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -5,9 +5,6 @@ module.exports = {
|
|||||||
description: 'List RSS Sources',
|
description: 'List RSS Sources',
|
||||||
execute(message, args) {
|
execute(message, args) {
|
||||||
|
|
||||||
var command = args[0];
|
|
||||||
var search = args[1];
|
|
||||||
|
|
||||||
var sourceArray = libFlayer.getSources();
|
var sourceArray = libFlayer.getSources();
|
||||||
sourceArray.forEach(source => {
|
sourceArray.forEach(source => {
|
||||||
message.reply(`[${source.title}](${source.link})`);
|
message.reply(`[${source.title}](${source.link})`);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module.exports = {
|
|||||||
name: 'update',
|
name: 'update',
|
||||||
description: 'Get RSS Source Link',
|
description: 'Get RSS Source Link',
|
||||||
execute(message, args) {
|
execute(message, args) {
|
||||||
|
|
||||||
message.reply(`Updating Sources`);
|
message.reply(`Updating Sources`);
|
||||||
libFlayer.loadFeeds();
|
libFlayer.loadFeeds();
|
||||||
feedArray = libFlayer.getFeeds();
|
feedArray = libFlayer.getFeeds();
|
||||||
|
|||||||
4
index.js
4
index.js
@@ -35,5 +35,5 @@ client.on('message', message => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log("Link Flayer Bot Activating");
|
console.log("Link Flayer Bot Activating");
|
||||||
client.login(token);
|
client.login(token); //Load Client Discord Token
|
||||||
libFlayer.loadFeeds();
|
libFlayer.loadFeeds(); //Load Configured Feeds
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ let feeds = require('./feeds.json');
|
|||||||
|
|
||||||
let linkFlayerMap = [];
|
let linkFlayerMap = [];
|
||||||
|
|
||||||
exports.addSource = function(source){
|
exports.addSource = function(title,source){
|
||||||
var linkData = {
|
var linkData = {
|
||||||
title: `${source}`,
|
title: `${title}`,
|
||||||
link: `${source}`
|
link: `${source}`
|
||||||
}
|
}
|
||||||
feeds.push(linkData);
|
feeds.push(linkData);
|
||||||
|
|||||||
Reference in New Issue
Block a user