nyx/commands/Config/delete.js

21 lines
685 B
JavaScript
Raw Normal View History

2021-06-12 12:53:51 +02:00
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 });
2021-09-06 12:38:25 +02:00
message.reply(`Removed **${name}** from custom commands.`);
2021-06-12 12:53:51 +02:00
},
};