nyx/commands/Config/delete.js
2021-06-24 15:53:19 +08:00

20 lines
691 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",
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.`);
},
};