Initial Emmelia merge
This commit is contained in:
36
Server/commands/remove.js
Normal file
36
Server/commands/remove.js
Normal file
@@ -0,0 +1,36 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user