added README.md clean up commands
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1 @@
|
||||
node_modules/
|
||||
config.json
|
||||
53
README.md
53
README.md
@@ -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*
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
},
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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*');
|
||||
}
|
||||
};
|
||||
@@ -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}`);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -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})`);
|
||||
|
||||
@@ -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();
|
||||
|
||||
4
index.js
4
index.js
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user