summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/structures/ActionRow.js
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
commite4450c8417624b71d779cb4f41692538f9165e10 (patch)
treeb70826542223ecdf8a7a259f61b0a1abb8a217d8 /node_modules/discord.js/src/structures/ActionRow.js
downloadsowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.gz
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.bz2
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.zip
first commit
Diffstat (limited to 'node_modules/discord.js/src/structures/ActionRow.js')
-rw-r--r--node_modules/discord.js/src/structures/ActionRow.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/structures/ActionRow.js b/node_modules/discord.js/src/structures/ActionRow.js
new file mode 100644
index 0000000..3f39691
--- /dev/null
+++ b/node_modules/discord.js/src/structures/ActionRow.js
@@ -0,0 +1,46 @@
+'use strict';
+
+const { deprecate } = require('node:util');
+const { isJSONEncodable } = require('@discordjs/util');
+const Component = require('./Component');
+const { createComponent } = require('../util/Components');
+
+/**
+ * Represents an action row
+ * @extends {Component}
+ */
+class ActionRow extends Component {
+ constructor({ components, ...data }) {
+ super(data);
+
+ /**
+ * The components in this action row
+ * @type {Component[]}
+ * @readonly
+ */
+ this.components = components.map(c => createComponent(c));
+ }
+
+ /**
+ * Creates a new action row builder from JSON data
+ * @method from
+ * @memberof ActionRow
+ * @param {ActionRowBuilder|ActionRow|APIActionRowComponent} other The other data
+ * @returns {ActionRowBuilder}
+ * @deprecated Use {@link ActionRowBuilder.from} instead.
+ */
+ static from = deprecate(
+ other => new this(isJSONEncodable(other) ? other.toJSON() : other),
+ 'ActionRow.from() is deprecated. Use ActionRowBuilder.from() instead.',
+ );
+
+ /**
+ * Returns the API-compatible JSON for this component
+ * @returns {APIActionRowComponent}
+ */
+ toJSON() {
+ return { ...this.data, components: this.components.map(c => c.toJSON()) };
+ }
+}
+
+module.exports = ActionRow;