discord-bot-cli
Version:
An easy way to build a command-based discord bot with discord.js.
35 lines (34 loc) • 1.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const template_1 = require("../utils/template");
const makeCommand_1 = require("../other/makeCommand");
const reply_1 = require("../utils/reply");
const cmd = makeCommand_1.makeCommand("help", {
description: "Provide help about a command.",
rest: {
type: "string",
name: "command",
description: "The name of the command.",
},
examples: ["help", "help list", "help help", "help command subCommand", "help command subCommand1 subCommand2"],
});
cmd.executor = async (_a, _f, { rest, options, commandSet, message }) => {
if (rest.length === 0)
await reply_1.reply(message, template_1.template(options.localization.help.default, {
prefix: options.prefix,
}));
else {
const { command, args } = commandSet.resolve(rest);
if (!command || args.length != 0)
await reply_1.reply(message, template_1.template(options.localization.help.commandNotFound, {
command: rest.join(" "),
}));
else {
if ((!options.devIDs.includes(message.author.id) || !options.skipDevsPermissionsChecking) &&
!command.checkPermissions(message))
return;
await command.help(message, options);
}
}
};
exports.default = cmd;