JaBa/commands/Administration/delcommand.js

33 lines
909 B
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js");
class Delcommand extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "delcommand",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["delc"],
2021-12-26 19:29:37 +05:00
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 1000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-10 21:39:54 +05:00
const name = args[0];
if (!name) return message.error("administration/delcommand:MISSING_NAME");
if (!data.guild.customCommands.find((c) => c.name === name)) return message.error("administration/delcommand:UNKNOWN_COMMAND", { commandName: name });
data.guild.customCommands = data.guild.customCommands.filter((c) => c.name !== name);
data.guild.save();
2021-12-26 19:29:37 +05:00
message.success("administration/delcommand:SUCCESS", {
commandName: name
});
2021-12-10 21:39:54 +05:00
}
};
module.exports = Delcommand;