36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
var libCore = require("../libCore.js");
|
|
|
|
const { SlashCommandBuilder } = require('discord.js');
|
|
const { DebugBuilder } = require("../utilities/debugBuilder");
|
|
const log = new DebugBuilder("server", "remove");
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('remove')
|
|
.setDescription('Remove an RSS source by it\' title')
|
|
.addStringOption(option =>
|
|
option.setName('title')
|
|
.setDescription('The title of the source to remove')
|
|
.setRequired(true)),
|
|
example: "remove ['Leafly']",
|
|
isPrivileged: false,
|
|
requiresTokens: false,
|
|
async execute(interaction) {
|
|
try{
|
|
var title = interaction.options.getString("title");
|
|
|
|
libCore.deleteSource(title, (err, result) => {
|
|
log.DEBUG("Result from removing entry", result);
|
|
|
|
if (result) {
|
|
interaction.reply(`Removing ${title} from the list of RSS sources`);
|
|
} else {
|
|
interaction.reply(`${title} does not exist in the list of RSS sources`);
|
|
}
|
|
});
|
|
}catch(err){
|
|
log.ERROR(err)
|
|
interaction.reply(err.toString());
|
|
}
|
|
}
|
|
}; |