33 lines
889 B
JavaScript
33 lines
889 B
JavaScript
var libCore = require("../libCore.js");
|
|
|
|
module.exports = {
|
|
name: 'add',
|
|
description: 'Add RSS Source',
|
|
execute(message, args) {
|
|
try {
|
|
if (args.length < 3) {
|
|
message.reply(`Please use in !add [title] [https://domain.com/feed.xml] [category] format`);
|
|
return;
|
|
}
|
|
var title = args[0];
|
|
var link = args[1];
|
|
var category = args[2];
|
|
|
|
libCore.addSource(title, link, category, (err, result) => {
|
|
console.log("Result from adding entry", result);
|
|
|
|
if (result) {
|
|
message.reply(`Adding ${title} to the list of RSS sources`);
|
|
} else {
|
|
message.reply(`${title} already exists in the list of RSS sources`);
|
|
}
|
|
|
|
var sources = libCore.getSources();
|
|
libCore.loadFeeds();
|
|
});
|
|
} catch (err) {
|
|
console.log(err);
|
|
message.reply(err.toString());
|
|
}
|
|
}
|
|
}; |