blob: 962a378c2a41d083d96d6e20756091de2496d9d8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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}
*/
|