pushing exception handling

This commit is contained in:
John Facey
2022-06-21 22:02:36 -05:00
parent 24b3700775
commit 462dca403f
7 changed files with 143 additions and 122 deletions

View File

@@ -1,27 +1,29 @@
var libFlayer = require("../libFlayer.js");
module.exports = {
name: 'add',
description: 'Add RSS Source',
execute(message,args) {
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];
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];
var result = libFlayer.addSource(title,link,category);
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 = libFlayer.getSources();
libFlayer.loadFeeds();
var result = libFlayer.addSource(title, link, category);
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 = libFlayer.getSources();
libFlayer.loadFeeds();
} catch (err) {
message.reply(err.toString());
}
}
};