discord.js 15.0.0-dev.1740679933-8a37b7b93 → 15.0.0-dev.1740744303-88bfeaab2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "discord.js",
4
- "version": "15.0.0-dev.1740679933-8a37b7b93",
4
+ "version": "15.0.0-dev.1740744303-88bfeaab2",
5
5
  "description": "A powerful library for interacting with the Discord API",
6
6
  "main": "./src/index.js",
7
7
  "types": "./typings/index.d.ts",
@@ -52,6 +52,7 @@
52
52
  "homepage": "https://discord.js.org",
53
53
  "funding": "https://github.com/discordjs/discord.js?sponsor",
54
54
  "dependencies": {
55
+ "@discordjs/builders": "^1.9.0",
55
56
  "@sapphire/snowflake": "3.5.5",
56
57
  "@vladfrangu/async_event_emitter": "^2.4.6",
57
58
  "discord-api-types": "^0.37.118",
@@ -59,12 +60,11 @@
59
60
  "lodash.snakecase": "4.1.1",
60
61
  "tslib": "^2.8.1",
61
62
  "undici": "6.21.1",
62
- "@discordjs/builders": "^1.9.0",
63
- "@discordjs/formatters": "^0.5.0",
64
63
  "@discordjs/collection": "^2.1.1",
65
- "@discordjs/rest": "^2.4.0",
64
+ "@discordjs/util": "^1.1.1",
65
+ "@discordjs/formatters": "^0.5.0",
66
66
  "@discordjs/ws": "^2.0.0",
67
- "@discordjs/util": "^1.1.1"
67
+ "@discordjs/rest": "^2.4.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@favware/cliff-jumper": "^4.1.0",
@@ -82,8 +82,8 @@
82
82
  "turbo": "^2.3.3",
83
83
  "typescript": "~5.5.4",
84
84
  "@discordjs/api-extractor": "^7.38.1",
85
- "@discordjs/docgen": "^0.12.1",
86
- "@discordjs/scripts": "^0.1.0"
85
+ "@discordjs/scripts": "^0.1.0",
86
+ "@discordjs/docgen": "^0.12.1"
87
87
  },
88
88
  "engines": {
89
89
  "node": ">=22.12.0"
package/src/index.js CHANGED
@@ -92,6 +92,7 @@ exports.VoiceStateManager = require('./managers/VoiceStateManager.js').VoiceStat
92
92
 
93
93
  // Structures
94
94
  exports.ActionRow = require('./structures/ActionRow.js').ActionRow;
95
+ exports.ActionRowBuilder = require('./structures/ActionRowBuilder.js').ActionRowBuilder;
95
96
  exports.Activity = require('./structures/Presence.js').Activity;
96
97
  exports.AnnouncementChannel = require('./structures/AnnouncementChannel.js').AnnouncementChannel;
97
98
  exports.AnonymousGuild = require('./structures/AnonymousGuild.js').AnonymousGuild;
@@ -114,9 +115,11 @@ exports.BaseGuildTextChannel = require('./structures/BaseGuildTextChannel.js').B
114
115
  exports.BaseGuildVoiceChannel = require('./structures/BaseGuildVoiceChannel.js').BaseGuildVoiceChannel;
115
116
  exports.BaseInteraction = require('./structures/BaseInteraction.js').BaseInteraction;
116
117
  exports.BaseSelectMenuComponent = require('./structures/BaseSelectMenuComponent.js').BaseSelectMenuComponent;
118
+ exports.ButtonBuilder = require('./structures/ButtonBuilder.js').ButtonBuilder;
117
119
  exports.ButtonComponent = require('./structures/ButtonComponent.js').ButtonComponent;
118
120
  exports.ButtonInteraction = require('./structures/ButtonInteraction.js').ButtonInteraction;
119
121
  exports.CategoryChannel = require('./structures/CategoryChannel.js').CategoryChannel;
122
+ exports.ChannelSelectMenuBuilder = require('./structures/ChannelSelectMenuBuilder.js').ChannelSelectMenuBuilder;
120
123
  exports.ChannelSelectMenuComponent = require('./structures/ChannelSelectMenuComponent.js').ChannelSelectMenuComponent;
121
124
  exports.ChannelSelectMenuInteraction =
122
125
  require('./structures/ChannelSelectMenuInteraction.js').ChannelSelectMenuInteraction;
@@ -134,6 +137,7 @@ exports.ContextMenuCommandInteraction =
134
137
  require('./structures/ContextMenuCommandInteraction.js').ContextMenuCommandInteraction;
135
138
  exports.DMChannel = require('./structures/DMChannel.js').DMChannel;
136
139
  exports.Embed = require('./structures/Embed.js').Embed;
140
+ exports.EmbedBuilder = require('./structures/EmbedBuilder.js').EmbedBuilder;
137
141
  exports.Emoji = require('./structures/Emoji.js').Emoji;
138
142
  exports.Entitlement = require('./structures/Entitlement.js').Entitlement;
139
143
  exports.ForumChannel = require('./structures/ForumChannel.js').ForumChannel;
@@ -164,6 +168,8 @@ exports.InteractionWebhook = require('./structures/InteractionWebhook.js').Inter
164
168
  exports.Invite = require('./structures/Invite.js').Invite;
165
169
  exports.InviteGuild = require('./structures/InviteGuild.js').InviteGuild;
166
170
  exports.MediaChannel = require('./structures/MediaChannel.js').MediaChannel;
171
+ exports.MentionableSelectMenuBuilder =
172
+ require('./structures/MentionableSelectMenuBuilder.js').MentionableSelectMenuBuilder;
167
173
  exports.MentionableSelectMenuComponent =
168
174
  require('./structures/MentionableSelectMenuComponent.js').MentionableSelectMenuComponent;
169
175
  exports.MentionableSelectMenuInteraction =
@@ -179,6 +185,7 @@ exports.MessageContextMenuCommandInteraction =
179
185
  exports.MessageMentions = require('./structures/MessageMentions.js').MessageMentions;
180
186
  exports.MessagePayload = require('./structures/MessagePayload.js').MessagePayload;
181
187
  exports.MessageReaction = require('./structures/MessageReaction.js').MessageReaction;
188
+ exports.ModalBuilder = require('./structures/ModalBuilder.js').ModalBuilder;
182
189
  exports.ModalSubmitFields = require('./structures/ModalSubmitFields.js').ModalSubmitFields;
183
190
  exports.ModalSubmitInteraction = require('./structures/ModalSubmitInteraction.js').ModalSubmitInteraction;
184
191
  exports.OAuth2Guild = require('./structures/OAuth2Guild.js').OAuth2Guild;
@@ -191,6 +198,7 @@ exports.ReactionCollector = require('./structures/ReactionCollector.js').Reactio
191
198
  exports.ReactionEmoji = require('./structures/ReactionEmoji.js').ReactionEmoji;
192
199
  exports.RichPresenceAssets = require('./structures/Presence.js').RichPresenceAssets;
193
200
  exports.Role = require('./structures/Role.js').Role;
201
+ exports.RoleSelectMenuBuilder = require('./structures/RoleSelectMenuBuilder.js').RoleSelectMenuBuilder;
194
202
  exports.RoleSelectMenuComponent = require('./structures/RoleSelectMenuComponent.js').RoleSelectMenuComponent;
195
203
  exports.RoleSelectMenuInteraction = require('./structures/RoleSelectMenuInteraction.js').RoleSelectMenuInteraction;
196
204
  exports.SKU = require('./structures/SKU.js').SKU;
@@ -198,13 +206,17 @@ exports.StageChannel = require('./structures/StageChannel.js').StageChannel;
198
206
  exports.StageInstance = require('./structures/StageInstance.js').StageInstance;
199
207
  exports.Sticker = require('./structures/Sticker.js').Sticker;
200
208
  exports.StickerPack = require('./structures/StickerPack.js').StickerPack;
209
+ exports.StringSelectMenuBuilder = require('./structures/StringSelectMenuBuilder.js').StringSelectMenuBuilder;
201
210
  exports.StringSelectMenuComponent = require('./structures/StringSelectMenuComponent.js').StringSelectMenuComponent;
202
211
  exports.StringSelectMenuInteraction =
203
212
  require('./structures/StringSelectMenuInteraction.js').StringSelectMenuInteraction;
213
+ exports.StringSelectMenuOptionBuilder =
214
+ require('./structures/StringSelectMenuOptionBuilder.js').StringSelectMenuOptionBuilder;
204
215
  exports.Subscription = require('./structures/Subscription.js').Subscription;
205
216
  exports.Team = require('./structures/Team.js').Team;
206
217
  exports.TeamMember = require('./structures/TeamMember.js').TeamMember;
207
218
  exports.TextChannel = require('./structures/TextChannel.js').TextChannel;
219
+ exports.TextInputBuilder = require('./structures/TextInputBuilder.js').TextInputBuilder;
208
220
  exports.TextInputComponent = require('./structures/TextInputComponent.js').TextInputComponent;
209
221
  exports.ThreadChannel = require('./structures/ThreadChannel.js').ThreadChannel;
210
222
  exports.ThreadMember = require('./structures/ThreadMember.js').ThreadMember;
@@ -213,6 +225,7 @@ exports.Typing = require('./structures/Typing.js').Typing;
213
225
  exports.User = require('./structures/User.js').User;
214
226
  exports.UserContextMenuCommandInteraction =
215
227
  require('./structures/UserContextMenuCommandInteraction.js').UserContextMenuCommandInteraction;
228
+ exports.UserSelectMenuBuilder = require('./structures/UserSelectMenuBuilder.js').UserSelectMenuBuilder;
216
229
  exports.UserSelectMenuComponent = require('./structures/UserSelectMenuComponent.js').UserSelectMenuComponent;
217
230
  exports.UserSelectMenuInteraction = require('./structures/UserSelectMenuInteraction.js').UserSelectMenuInteraction;
218
231
  exports.VoiceChannel = require('./structures/VoiceChannel.js').VoiceChannel;
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ const { ActionRowBuilder: BuildersActionRow } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+
6
+ /**
7
+ * Represents an action row builder.
8
+ * @extends {BuildersActionRow}
9
+ */
10
+ class ActionRowBuilder extends BuildersActionRow {
11
+ constructor({ components, ...data } = {}) {
12
+ super({
13
+ ...toSnakeCase(data),
14
+ components: components?.map(component => createComponentBuilder(component)),
15
+ });
16
+ }
17
+
18
+ /**
19
+ * Creates a new action row builder from JSON data
20
+ * @param {ActionRow|ActionRowBuilder|APIActionRowComponent} other The other data
21
+ * @returns {ActionRowBuilder}
22
+ */
23
+ static from(other) {
24
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
25
+ }
26
+ }
27
+
28
+ exports.ActionRowBuilder = ActionRowBuilder;
29
+
30
+ const { createComponentBuilder } = require('../util/Components.js');
31
+ const { toSnakeCase } = require('../util/Transformers.js');
32
+
33
+ /**
34
+ * @external BuildersActionRow
35
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/ActionRowBuilder:Class}
36
+ */
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ const { ButtonBuilder: BuildersButton } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+ const { resolvePartialEmoji } = require('../util/Util.js');
7
+
8
+ /**
9
+ * Represents a button builder.
10
+ * @extends {BuildersButton}
11
+ */
12
+ class ButtonBuilder extends BuildersButton {
13
+ constructor({ emoji, ...data } = {}) {
14
+ super(toSnakeCase({ ...data, emoji: emoji && typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji }));
15
+ }
16
+
17
+ /**
18
+ * Sets the emoji to display on this button
19
+ * @param {string|APIMessageComponentEmoji} emoji The emoji to display on this button
20
+ * @returns {ButtonBuilder}
21
+ */
22
+ setEmoji(emoji) {
23
+ if (typeof emoji === 'string') {
24
+ return super.setEmoji(resolvePartialEmoji(emoji));
25
+ }
26
+ return super.setEmoji(emoji);
27
+ }
28
+
29
+ /**
30
+ * Creates a new button builder from JSON data
31
+ * @param {ButtonBuilder|ButtonComponent|APIButtonComponent} other The other data
32
+ * @returns {ButtonBuilder}
33
+ */
34
+ static from(other) {
35
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
36
+ }
37
+ }
38
+
39
+ exports.ButtonBuilder = ButtonBuilder;
40
+
41
+ /**
42
+ * @external BuildersButton
43
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/ButtonBuilder:Class}
44
+ */
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const { ChannelSelectMenuBuilder: BuildersChannelSelectMenu } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+
7
+ /**
8
+ * Class used to build select menu components to be sent through the API
9
+ * @extends {BuildersChannelSelectMenu}
10
+ */
11
+ class ChannelSelectMenuBuilder extends BuildersChannelSelectMenu {
12
+ constructor(data = {}) {
13
+ super(toSnakeCase(data));
14
+ }
15
+
16
+ /**
17
+ * Creates a new select menu builder from JSON data
18
+ * @param {ChannelSelectMenuBuilder|ChannelSelectMenuComponent|APIChannelSelectComponent} other The other data
19
+ * @returns {ChannelSelectMenuBuilder}
20
+ */
21
+ static from(other) {
22
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
23
+ }
24
+ }
25
+
26
+ exports.ChannelSelectMenuBuilder = ChannelSelectMenuBuilder;
27
+
28
+ /**
29
+ * @external BuildersChannelSelectMenu
30
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/ChannelSelectMenuBuilder:Class}
31
+ */
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ const { EmbedBuilder: BuildersEmbed, embedLength } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+ const { resolveColor } = require('../util/Util.js');
7
+
8
+ /**
9
+ * Represents an embed builder.
10
+ * @extends {BuildersEmbed}
11
+ */
12
+ class EmbedBuilder extends BuildersEmbed {
13
+ constructor(data) {
14
+ super(toSnakeCase(data));
15
+ }
16
+
17
+ /**
18
+ * Sets the color of this embed
19
+ * @param {?ColorResolvable} color The color of the embed
20
+ * @returns {EmbedBuilder}
21
+ */
22
+ setColor(color) {
23
+ return super.setColor(color && resolveColor(color));
24
+ }
25
+
26
+ /**
27
+ * Creates a new embed builder from JSON data
28
+ * @param {EmbedBuilder|Embed|APIEmbed} other The other data
29
+ * @returns {EmbedBuilder}
30
+ */
31
+ static from(other) {
32
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
33
+ }
34
+
35
+ /**
36
+ * The accumulated length for the embed title, description, fields, footer text, and author name.
37
+ * @type {number}
38
+ * @readonly
39
+ */
40
+ get length() {
41
+ return embedLength(this.data);
42
+ }
43
+ }
44
+
45
+ exports.EmbedBuilder = EmbedBuilder;
46
+
47
+ /**
48
+ * @external BuildersEmbed
49
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/EmbedBuilder:Class}
50
+ */
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ const { MentionableSelectMenuBuilder: BuildersMentionableSelectMenu } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+
7
+ /**
8
+ * Class used to build select menu components to be sent through the API
9
+ * @extends {BuildersMentionableSelectMenu}
10
+ */
11
+ class MentionableSelectMenuBuilder extends BuildersMentionableSelectMenu {
12
+ constructor(data = {}) {
13
+ super(toSnakeCase(data));
14
+ }
15
+
16
+ /**
17
+ * Creates a new select menu builder from JSON data
18
+ * @param {MentionableSelectMenuBuilder|MentionableSelectMenuComponent|APIMentionableSelectComponent} other
19
+ * The other data
20
+ * @returns {MentionableSelectMenuBuilder}
21
+ */
22
+ static from(other) {
23
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
24
+ }
25
+ }
26
+
27
+ exports.MentionableSelectMenuBuilder = MentionableSelectMenuBuilder;
28
+
29
+ /**
30
+ * @external BuildersMentionableSelectMenu
31
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/MentionableSelectMenuBuilder:Class}
32
+ */
@@ -3,6 +3,7 @@
3
3
  const { Buffer } = require('node:buffer');
4
4
  const { isJSONEncodable } = require('@discordjs/util');
5
5
  const { DiscordSnowflake } = require('@sapphire/snowflake');
6
+ const { ActionRowBuilder } = require('./ActionRowBuilder.js');
6
7
  const { DiscordjsError, DiscordjsRangeError, ErrorCodes } = require('../errors/index.js');
7
8
  const { resolveFile } = require('../util/DataResolver.js');
8
9
  const { MessageFlagsBitField } = require('../util/MessageFlagsBitField.js');
@@ -132,7 +133,7 @@ class MessagePayload {
132
133
  }
133
134
 
134
135
  const components = this.options.components?.map(component =>
135
- isJSONEncodable(component) ? component.toJSON() : this.target.client.options.jsonTransformer(component),
136
+ (isJSONEncodable(component) ? component : new ActionRowBuilder(component)).toJSON(),
136
137
  );
137
138
 
138
139
  let username;
@@ -191,17 +192,19 @@ class MessagePayload {
191
192
 
192
193
  let poll;
193
194
  if (this.options.poll) {
194
- poll = {
195
- question: {
196
- text: this.options.poll.question.text,
197
- },
198
- answers: this.options.poll.answers.map(answer => ({
199
- poll_media: { text: answer.text, emoji: resolvePartialEmoji(answer.emoji) },
200
- })),
201
- duration: this.options.poll.duration,
202
- allow_multiselect: this.options.poll.allowMultiselect,
203
- layout_type: this.options.poll.layoutType,
204
- };
195
+ poll = isJSONEncodable(this.options.poll)
196
+ ? this.options.poll.toJSON()
197
+ : {
198
+ question: {
199
+ text: this.options.poll.question.text,
200
+ },
201
+ answers: this.options.poll.answers.map(answer => ({
202
+ poll_media: { text: answer.text, emoji: resolvePartialEmoji(answer.emoji) },
203
+ })),
204
+ duration: this.options.poll.duration,
205
+ allow_multiselect: this.options.poll.allowMultiselect,
206
+ layout_type: this.options.poll.layoutType,
207
+ };
205
208
  }
206
209
 
207
210
  this.body = {
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ const { ModalBuilder: BuildersModal, ComponentBuilder } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+
7
+ /**
8
+ * Represents a modal builder.
9
+ * @extends {BuildersModal}
10
+ */
11
+ class ModalBuilder extends BuildersModal {
12
+ constructor({ components, ...data } = {}) {
13
+ super({
14
+ ...toSnakeCase(data),
15
+ components: components?.map(component =>
16
+ component instanceof ComponentBuilder ? component : toSnakeCase(component),
17
+ ),
18
+ });
19
+ }
20
+
21
+ /**
22
+ * Creates a new modal builder from JSON data
23
+ * @param {ModalBuilder|APIModalComponent} other The other data
24
+ * @returns {ModalBuilder}
25
+ */
26
+ static from(other) {
27
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
28
+ }
29
+ }
30
+
31
+ exports.ModalBuilder = ModalBuilder;
32
+
33
+ /**
34
+ * @external BuildersModal
35
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/ModalBuilder:Class}
36
+ */
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const { RoleSelectMenuBuilder: BuildersRoleSelectMenu } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+
7
+ /**
8
+ * Class used to build select menu components to be sent through the API
9
+ * @extends {BuildersRoleSelectMenu}
10
+ */
11
+ class RoleSelectMenuBuilder extends BuildersRoleSelectMenu {
12
+ constructor(data = {}) {
13
+ super(toSnakeCase(data));
14
+ }
15
+
16
+ /**
17
+ * Creates a new select menu builder from JSON data
18
+ * @param {RoleSelectMenuBuilder|RoleSelectMenuComponent|APIRoleSelectComponent} other The other data
19
+ * @returns {RoleSelectMenuBuilder}
20
+ */
21
+ static from(other) {
22
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
23
+ }
24
+ }
25
+
26
+ exports.RoleSelectMenuBuilder = RoleSelectMenuBuilder;
27
+
28
+ /**
29
+ * @external BuildersRoleSelectMenu
30
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/RoleSelectMenuBuilder:Class}
31
+ */
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ const { SelectMenuBuilder: BuildersSelectMenu, normalizeArray } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+ const { resolvePartialEmoji } = require('../util/Util.js');
7
+
8
+ /**
9
+ * Class used to build select menu components to be sent through the API
10
+ * @extends {BuildersSelectMenu}
11
+ */
12
+ class StringSelectMenuBuilder extends BuildersSelectMenu {
13
+ constructor({ options, ...data } = {}) {
14
+ super(
15
+ toSnakeCase({
16
+ ...data,
17
+ options: options?.map(({ emoji, ...option }) => ({
18
+ ...option,
19
+ emoji: emoji && typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji,
20
+ })),
21
+ }),
22
+ );
23
+ }
24
+
25
+ /**
26
+ * Normalizes a select menu option emoji
27
+ * @param {SelectMenuComponentOptionData|APISelectMenuOption} selectMenuOption The option to normalize
28
+ * @returns {StringSelectMenuOptionBuilder|APISelectMenuOption}
29
+ * @private
30
+ */
31
+ static normalizeEmoji(selectMenuOption) {
32
+ if (isJSONEncodable(selectMenuOption)) {
33
+ return selectMenuOption;
34
+ }
35
+
36
+ const { emoji, ...option } = selectMenuOption;
37
+ return {
38
+ ...option,
39
+ emoji: typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji,
40
+ };
41
+ }
42
+
43
+ /**
44
+ * Adds options to this select menu
45
+ * @param {RestOrArray<APISelectMenuOption>} options The options to add to this select menu
46
+ * @returns {StringSelectMenuBuilder}
47
+ */
48
+ addOptions(...options) {
49
+ return super.addOptions(normalizeArray(options).map(option => StringSelectMenuBuilder.normalizeEmoji(option)));
50
+ }
51
+
52
+ /**
53
+ * Sets the options on this select menu
54
+ * @param {RestOrArray<APISelectMenuOption>} options The options to set on this select menu
55
+ * @returns {StringSelectMenuBuilder}
56
+ */
57
+ setOptions(...options) {
58
+ return super.setOptions(normalizeArray(options).map(option => StringSelectMenuBuilder.normalizeEmoji(option)));
59
+ }
60
+
61
+ /**
62
+ * Creates a new select menu builder from json data
63
+ * @param {StringSelectMenuBuilder|StringSelectMenuComponent|APIStringSelectComponent} other The other data
64
+ * @returns {StringSelectMenuBuilder}
65
+ */
66
+ static from(other) {
67
+ if (isJSONEncodable(other)) {
68
+ return new this(other.toJSON());
69
+ }
70
+ return new this(other);
71
+ }
72
+ }
73
+
74
+ exports.StringSelectMenuBuilder = StringSelectMenuBuilder;
75
+
76
+ /**
77
+ * @external BuildersSelectMenu
78
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/StringSelectMenuBuilder:Class}
79
+ */
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ const { SelectMenuOptionBuilder: BuildersSelectMenuOption } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+ const { resolvePartialEmoji } = require('../util/Util.js');
7
+
8
+ /**
9
+ * Represents a select menu option builder.
10
+ * @extends {BuildersSelectMenuOption}
11
+ */
12
+ class StringSelectMenuOptionBuilder extends BuildersSelectMenuOption {
13
+ constructor({ emoji, ...data } = {}) {
14
+ super(
15
+ toSnakeCase({
16
+ ...data,
17
+ emoji: emoji && typeof emoji === 'string' ? resolvePartialEmoji(emoji) : emoji,
18
+ }),
19
+ );
20
+ }
21
+
22
+ /**
23
+ * Sets the emoji to display on this option
24
+ * @param {ComponentEmojiResolvable} emoji The emoji to display on this option
25
+ * @returns {StringSelectMenuOptionBuilder}
26
+ */
27
+ setEmoji(emoji) {
28
+ if (typeof emoji === 'string') {
29
+ return super.setEmoji(resolvePartialEmoji(emoji));
30
+ }
31
+ return super.setEmoji(emoji);
32
+ }
33
+
34
+ /**
35
+ * Creates a new select menu option builder from JSON data
36
+ * @param {StringSelectMenuOptionBuilder|APISelectMenuOption} other The other data
37
+ * @returns {StringSelectMenuOptionBuilder}
38
+ */
39
+ static from(other) {
40
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
41
+ }
42
+ }
43
+
44
+ exports.StringSelectMenuOptionBuilder = StringSelectMenuOptionBuilder;
45
+
46
+ /**
47
+ * @external BuildersSelectMenuOption
48
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/StringSelectMenuOptionBuilder:Class}
49
+ */
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const { TextInputBuilder: BuildersTextInput } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+
7
+ /**
8
+ * Represents a text input builder.
9
+ * @extends {BuildersTextInput}
10
+ */
11
+ class TextInputBuilder extends BuildersTextInput {
12
+ constructor(data) {
13
+ super(toSnakeCase(data));
14
+ }
15
+
16
+ /**
17
+ * Creates a new text input builder from JSON data
18
+ * @param {TextInputBuilder|TextInputComponent|APITextInputComponent} other The other data
19
+ * @returns {TextInputBuilder}
20
+ */
21
+ static from(other) {
22
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
23
+ }
24
+ }
25
+
26
+ exports.TextInputBuilder = TextInputBuilder;
27
+
28
+ /**
29
+ * @external BuildersTextInput
30
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/TextInputBuilder:Class}
31
+ */
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const { UserSelectMenuBuilder: BuildersUserSelectMenu } = require('@discordjs/builders');
4
+ const { isJSONEncodable } = require('@discordjs/util');
5
+ const { toSnakeCase } = require('../util/Transformers.js');
6
+
7
+ /**
8
+ * Class used to build select menu components to be sent through the API
9
+ * @extends {BuildersUserSelectMenu}
10
+ */
11
+ class UserSelectMenuBuilder extends BuildersUserSelectMenu {
12
+ constructor(data = {}) {
13
+ super(toSnakeCase(data));
14
+ }
15
+
16
+ /**
17
+ * Creates a new select menu builder from JSON data
18
+ * @param {UserSelectMenuBuilder|UserSelectMenuComponent|APIUserSelectComponent} other The other data
19
+ * @returns {UserSelectMenuBuilder}
20
+ */
21
+ static from(other) {
22
+ return new this(isJSONEncodable(other) ? other.toJSON() : other);
23
+ }
24
+ }
25
+
26
+ exports.UserSelectMenuBuilder = UserSelectMenuBuilder;
27
+
28
+ /**
29
+ * @external BuildersUserSelectMenu
30
+ * @see {@link https://discord.js.org/docs/packages/builders/stable/UserSelectMenuBuilder:Class}
31
+ */