25 lines
789 B
JavaScript
25 lines
789 B
JavaScript
const schema = require("../../models/custom-commands");
|
|
|
|
module.exports = {
|
|
name: "cc-delete",
|
|
UserPerm: "ADMINISTRATOR",
|
|
usage: "(command)",
|
|
description: "Delete a custom command for a server",
|
|
category: "Config",
|
|
/**
|
|
* @param {Client} client
|
|
* @param {Message} message
|
|
* @param {String[]} args
|
|
*/
|
|
run: async (client, message, args) => {
|
|
const name = args[0];
|
|
if (!name) return client.err(message, "Config", "cc-delete", 47);
|
|
const data = await schema.findOne({
|
|
Guild: message.guild.id,
|
|
Command: name,
|
|
});
|
|
if (!data) return client.err(message, "Config", "cc-delete", 404);
|
|
await schema.findOneAndDelete({ Guild: message.guild.id, Command: name });
|
|
message.inlineReply(`Removed **${name}** from custom commands.`);
|
|
},
|
|
};
|