simplify-cord
Version:
SimplifyCord is an unofficial extension of the 'discord.js' library. Our extension aims to simplify the development of Discord bots, promoting cleaner code and easier maintenance.
18 lines (17 loc) • 722 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const discord_js_1 = require("discord.js");
function createRow(components) {
if (!components || components.length === 0) {
throw new Error('CreateRow: Components array cannot be empty');
}
const flatComponents = Array.isArray(components[0]) ? components[0] : components;
if (flatComponents.length === 0) {
throw new Error('CreateRow: Components array cannot be empty');
}
if (flatComponents.length > 5) {
throw new Error('CreateRow: ActionRow can only contain up to 5 components');
}
return new discord_js_1.ActionRowBuilder().addComponents(flatComponents);
}
exports.default = createRow;
;