1st commit Discord Bot
This commit is contained in:
18
commands/add.js
Normal file
18
commands/add.js
Normal file
@@ -0,0 +1,18 @@
|
||||
var libFlayer = require("../libFlayer.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'add',
|
||||
description: 'Add RSS Source',
|
||||
execute(message,args) {
|
||||
|
||||
if (args.length < 2) {
|
||||
message.reply(`Please use in !get [number] format`);
|
||||
return;
|
||||
}
|
||||
var command = args[0];
|
||||
var param1 = args[1];
|
||||
libFlayer.addSource(param1);
|
||||
libFlayer.loadFeeds();
|
||||
|
||||
},
|
||||
};
|
||||
18
commands/get.js
Normal file
18
commands/get.js
Normal file
@@ -0,0 +1,18 @@
|
||||
var libFlayer = require("../libFlayer.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'get',
|
||||
description: 'Get RSS Source Link',
|
||||
execute(message, args) {
|
||||
|
||||
if (args.length < 1) {
|
||||
message.reply(`Please use in !get [number] format`);
|
||||
return;
|
||||
}
|
||||
var search = args[0];
|
||||
|
||||
var feedArray = libFlayer.getFeeds();
|
||||
message.reply(`Retrieving: [Link](${feedArray[search].link})`);
|
||||
|
||||
}
|
||||
};
|
||||
9
commands/help.js
Normal file
9
commands/help.js
Normal file
@@ -0,0 +1,9 @@
|
||||
var libFlayer = require("../libFlayer.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: 'Help',
|
||||
execute(message) {
|
||||
message.reply('For a list of available commands type !commands');
|
||||
}
|
||||
};
|
||||
7
commands/ping.js
Normal file
7
commands/ping.js
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
name: 'ping',
|
||||
description: 'Ping!',
|
||||
execute(message) {
|
||||
message.channel.send('Pong.');
|
||||
}
|
||||
};
|
||||
29
commands/search.js
Normal file
29
commands/search.js
Normal file
@@ -0,0 +1,29 @@
|
||||
var libFlayer = require("../libFlayer.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'search',
|
||||
description: 'Search RSS Sources',
|
||||
execute(message, args) {
|
||||
|
||||
if (args.length < 1) {
|
||||
message.reply(`Missing arguments`);
|
||||
return;
|
||||
}
|
||||
|
||||
var search = args[0];
|
||||
|
||||
message.reply('Searching for: ' + search);
|
||||
|
||||
let i = 0;
|
||||
var feedArray = libFlayer.getFeeds();
|
||||
feedArray.forEach(linkFlay => {
|
||||
if (linkFlay.title.toLowerCase().indexOf(search.toLowerCase()) > -1) {
|
||||
console.log(linkFlay.title);
|
||||
message.reply(`Use !get ${i} to view: ${linkFlay.title}`);
|
||||
|
||||
}
|
||||
i++;
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
17
commands/sources.js
Normal file
17
commands/sources.js
Normal file
@@ -0,0 +1,17 @@
|
||||
var libFlayer = require("../libFlayer.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'sources',
|
||||
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})`);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
14
commands/update.js
Normal file
14
commands/update.js
Normal file
@@ -0,0 +1,14 @@
|
||||
var libFlayer = require("../libFlayer.js");
|
||||
|
||||
module.exports = {
|
||||
name: 'update',
|
||||
description: 'Get RSS Source Link',
|
||||
execute(message, args) {
|
||||
|
||||
message.reply(`Updating Sources`);
|
||||
libFlayer.loadFeeds();
|
||||
feedArray = libFlayer.getFeeds();
|
||||
message.reply(`Sources Updated`);
|
||||
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user