diff options
Diffstat (limited to 'node_modules/discord.js/src/structures/ActionRowBuilder.js')
-rw-r--r-- | node_modules/discord.js/src/structures/ActionRowBuilder.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/structures/ActionRowBuilder.js b/node_modules/discord.js/src/structures/ActionRowBuilder.js new file mode 100644 index 0000000..962a378 --- /dev/null +++ b/node_modules/discord.js/src/structures/ActionRowBuilder.js @@ -0,0 +1,35 @@ +'use strict'; + +const { ActionRowBuilder: BuildersActionRow } = require('@discordjs/builders'); +const { isJSONEncodable } = require('@discordjs/util'); +const { createComponentBuilder } = require('../util/Components'); +const { toSnakeCase } = require('../util/Transformers'); + +/** + * Represents an action row builder. + * @extends {BuildersActionRow} + */ +class ActionRowBuilder extends BuildersActionRow { + constructor({ components, ...data } = {}) { + super({ + ...toSnakeCase(data), + components: components?.map(c => createComponentBuilder(c)), + }); + } + + /** + * Creates a new action row builder from JSON data + * @param {ActionRow|ActionRowBuilder|APIActionRowComponent} other The other data + * @returns {ActionRowBuilder} + */ + static from(other) { + return new this(isJSONEncodable(other) ? other.toJSON() : other); + } +} + +module.exports = ActionRowBuilder; + +/** + * @external BuildersActionRow + * @see {@link https://discord.js.org/docs/packages/builders/stable/ActionRowBuilder:Class} + */ |