Files
Emmelia-Link-Flayer-Rewrite/commands/remove.js
2023-02-24 20:21:52 -05:00

31 lines
816 B
JavaScript

var libCore = require("../libCore.js");
module.exports = {
name: 'remove',
description: 'Remove RSS Source',
execute(message, args) {
try {
if (args.length < 1) {
message.reply(`Please use in '${process.env.prefix}remove [title]' format`);
return;
}
var title = args[0];
libCore.deleteSource(title, (err, result) => {
console.log("Result from removing entry", result);
if (result) {
message.reply(`Removing ${title} from the list of RSS sources`);
} else {
message.reply(`${title} does not exist in the list of RSS sources`);
}
var sources = libCore.getSources();
libCore.loadFeeds();
});
} catch (err) {
console.log(err);
message.reply(err.toString());
}
}
};