UNPKG

discord-bot-cli

Version:

An easy way to build a command-based discord bot with discord.js.

30 lines (29 loc) 934 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getListRawData = void 0; /** * Extracts raw data for list command. * @category Utils * @param commandSet * @param localization * @returns List command raw datas. */ function getListRawData(commandSet, localization) { const commands = Array.from(commandSet.commands) .sort((a, b) => { if (a.name < b.name) return -1; if (a.name > b.name) return 1; return 0; }) .map(c => getCommandRaw(c, localization)); return { commands }; } exports.getListRawData = getListRawData; /** @internal */ function getCommandRaw(command, localization) { var _a, _b; const description = (_b = (_a = localization.commands[command.name]) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : command.description; return { command, description }; }