@discordjs/builders 1.13.0 → 1.13.1

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/dist/index.mjs CHANGED
@@ -153,7 +153,7 @@ var EmbedBuilder = class {
153
153
  *
154
154
  * @remarks
155
155
  * This method behaves similarly
156
- * to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
156
+ * to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
157
157
  * The maximum amount of fields that can be added is 25.
158
158
  *
159
159
  * It's useful for modifying and adjusting order of the already-existing fields of an embed.
@@ -743,7 +743,7 @@ var FileUploadBuilder = class extends ComponentBuilder {
743
743
  /**
744
744
  * Sets the maximum number of file uploads required.
745
745
  *
746
- * @param maxValues - The maximum values that must be uploaded
746
+ * @param maxValues - The maximum values that can be uploaded
747
747
  */
748
748
  setMaxValues(maxValues) {
749
749
  this.data.max_values = maxValues;
@@ -846,9 +846,9 @@ var BaseSelectMenuBuilder = class extends ComponentBuilder {
846
846
  return this;
847
847
  }
848
848
  /**
849
- * Sets the maximum values that must be selected in the select menu.
849
+ * Sets the maximum values that can be selected in the select menu.
850
850
  *
851
- * @param maxValues - The maximum values that must be selected
851
+ * @param maxValues - The maximum values that can be selected
852
852
  */
853
853
  setMaxValues(maxValues) {
854
854
  this.data.max_values = minMaxValidator.parse(maxValues);
@@ -1149,7 +1149,71 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1149
1149
  };
1150
1150
 
1151
1151
  // src/components/selectMenu/StringSelectMenu.ts
1152
- import { ComponentType as ComponentType8 } from "discord-api-types/v10";
1152
+ import { ComponentType as ComponentType9 } from "discord-api-types/v10";
1153
+
1154
+ // src/components/selectMenu/Assertions.ts
1155
+ var Assertions_exports5 = {};
1156
+ __export(Assertions_exports5, {
1157
+ selectMenuChannelPredicate: () => selectMenuChannelPredicate,
1158
+ selectMenuMentionablePredicate: () => selectMenuMentionablePredicate,
1159
+ selectMenuRolePredicate: () => selectMenuRolePredicate,
1160
+ selectMenuStringOptionPredicate: () => selectMenuStringOptionPredicate,
1161
+ selectMenuStringPredicate: () => selectMenuStringPredicate,
1162
+ selectMenuUserPredicate: () => selectMenuUserPredicate
1163
+ });
1164
+ import { Result, s as s5 } from "@sapphire/shapeshift";
1165
+ import { ChannelType as ChannelType2, ComponentType as ComponentType8, SelectMenuDefaultValueType as SelectMenuDefaultValueType4 } from "discord-api-types/v10";
1166
+ var selectMenuBasePredicate = s5.object({
1167
+ id: idValidator.optional(),
1168
+ placeholder: s5.string().lengthLessThanOrEqual(150).optional(),
1169
+ min_values: s5.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
1170
+ max_values: s5.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
1171
+ custom_id: customIdValidator,
1172
+ disabled: s5.boolean().optional()
1173
+ });
1174
+ var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
1175
+ type: s5.literal(ComponentType8.ChannelSelect),
1176
+ channel_types: s5.nativeEnum(ChannelType2).array().optional(),
1177
+ default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType4.Channel) }).array().lengthLessThanOrEqual(25).optional()
1178
+ }).setValidationEnabled(isValidationEnabled);
1179
+ var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
1180
+ type: s5.literal(ComponentType8.MentionableSelect),
1181
+ default_values: s5.object({
1182
+ id: s5.string(),
1183
+ type: s5.union([s5.literal(SelectMenuDefaultValueType4.Role), s5.literal(SelectMenuDefaultValueType4.User)])
1184
+ }).array().lengthLessThanOrEqual(25).optional()
1185
+ }).setValidationEnabled(isValidationEnabled);
1186
+ var selectMenuRolePredicate = selectMenuBasePredicate.extend({
1187
+ type: s5.literal(ComponentType8.RoleSelect),
1188
+ default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType4.Role) }).array().lengthLessThanOrEqual(25).optional()
1189
+ }).setValidationEnabled(isValidationEnabled);
1190
+ var selectMenuUserPredicate = selectMenuBasePredicate.extend({
1191
+ type: s5.literal(ComponentType8.UserSelect),
1192
+ default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType4.User) }).array().lengthLessThanOrEqual(25).optional()
1193
+ }).setValidationEnabled(isValidationEnabled);
1194
+ var selectMenuStringOptionPredicate = s5.object({
1195
+ label: s5.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
1196
+ value: s5.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
1197
+ description: s5.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
1198
+ emoji: emojiValidator.optional(),
1199
+ default: s5.boolean().optional()
1200
+ }).setValidationEnabled(isValidationEnabled);
1201
+ var selectMenuStringPredicate = selectMenuBasePredicate.extend({
1202
+ type: s5.literal(ComponentType8.StringSelect),
1203
+ options: selectMenuStringOptionPredicate.array().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(25)
1204
+ }).reshape((value) => {
1205
+ if (value.min_values !== void 0 && value.options.length < value.min_values) {
1206
+ return Result.err(new RangeError(`The number of options must be greater than or equal to min_values`));
1207
+ }
1208
+ if (value.min_values !== void 0 && value.max_values !== void 0 && value.min_values > value.max_values) {
1209
+ return Result.err(
1210
+ new RangeError(`The maximum amount of options must be greater than or equal to the minimum amount of options`)
1211
+ );
1212
+ }
1213
+ return Result.ok(value);
1214
+ }).setValidationEnabled(isValidationEnabled);
1215
+
1216
+ // src/components/selectMenu/StringSelectMenu.ts
1153
1217
  var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1154
1218
  static {
1155
1219
  __name(this, "StringSelectMenuBuilder");
@@ -1191,7 +1255,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1191
1255
  */
1192
1256
  constructor(data) {
1193
1257
  const { options, ...initData } = data ?? {};
1194
- super({ ...initData, type: ComponentType8.StringSelect });
1258
+ super({ ...initData, type: ComponentType9.StringSelect });
1195
1259
  this.options = options?.map((option) => new StringSelectMenuOptionBuilder(option)) ?? [];
1196
1260
  }
1197
1261
  /**
@@ -1204,7 +1268,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1204
1268
  optionsLengthValidator.parse(this.options.length + normalizedOptions.length);
1205
1269
  this.options.push(
1206
1270
  ...normalizedOptions.map(
1207
- (normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption))
1271
+ (normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(selectMenuStringOptionPredicate.parse(normalizedOption))
1208
1272
  )
1209
1273
  );
1210
1274
  return this;
@@ -1251,7 +1315,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1251
1315
  index,
1252
1316
  deleteCount,
1253
1317
  ...normalizedOptions.map(
1254
- (normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(jsonOptionValidator.parse(normalizedOption))
1318
+ (normalizedOption) => normalizedOption instanceof StringSelectMenuOptionBuilder ? normalizedOption : new StringSelectMenuOptionBuilder(selectMenuStringOptionPredicate.parse(normalizedOption))
1255
1319
  )
1256
1320
  );
1257
1321
  optionsLengthValidator.parse(clone.length);
@@ -1272,8 +1336,8 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1272
1336
 
1273
1337
  // src/components/selectMenu/UserSelectMenu.ts
1274
1338
  import {
1275
- ComponentType as ComponentType9,
1276
- SelectMenuDefaultValueType as SelectMenuDefaultValueType4
1339
+ ComponentType as ComponentType10,
1340
+ SelectMenuDefaultValueType as SelectMenuDefaultValueType5
1277
1341
  } from "discord-api-types/v10";
1278
1342
  var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1279
1343
  static {
@@ -1302,7 +1366,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1302
1366
  * ```
1303
1367
  */
1304
1368
  constructor(data) {
1305
- super({ ...data, type: ComponentType9.UserSelect });
1369
+ super({ ...data, type: ComponentType10.UserSelect });
1306
1370
  }
1307
1371
  /**
1308
1372
  * Adds default users to this auto populated select menu.
@@ -1316,7 +1380,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1316
1380
  this.data.default_values.push(
1317
1381
  ...normalizedValues.map((id) => ({
1318
1382
  id,
1319
- type: SelectMenuDefaultValueType4.User
1383
+ type: SelectMenuDefaultValueType5.User
1320
1384
  }))
1321
1385
  );
1322
1386
  return this;
@@ -1331,7 +1395,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1331
1395
  optionsLengthValidator.parse(normalizedValues.length);
1332
1396
  this.data.default_values = normalizedValues.map((id) => ({
1333
1397
  id,
1334
- type: SelectMenuDefaultValueType4.User
1398
+ type: SelectMenuDefaultValueType5.User
1335
1399
  }));
1336
1400
  return this;
1337
1401
  }
@@ -1339,7 +1403,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
1339
1403
 
1340
1404
  // src/components/textInput/TextInput.ts
1341
1405
  import { isJSONEncodable } from "@discordjs/util";
1342
- import { ComponentType as ComponentType10 } from "discord-api-types/v10";
1406
+ import { ComponentType as ComponentType11 } from "discord-api-types/v10";
1343
1407
  import isEqual from "fast-deep-equal";
1344
1408
  var TextInputBuilder = class extends ComponentBuilder {
1345
1409
  static {
@@ -1369,7 +1433,7 @@ var TextInputBuilder = class extends ComponentBuilder {
1369
1433
  * ```
1370
1434
  */
1371
1435
  constructor(data) {
1372
- super({ type: ComponentType10.TextInput, ...data });
1436
+ super({ type: ComponentType11.TextInput, ...data });
1373
1437
  }
1374
1438
  /**
1375
1439
  * Sets the custom id for this text input.
@@ -1465,67 +1529,12 @@ var TextInputBuilder = class extends ComponentBuilder {
1465
1529
  };
1466
1530
 
1467
1531
  // src/components/label/Assertions.ts
1468
- var Assertions_exports5 = {};
1469
- __export(Assertions_exports5, {
1532
+ var Assertions_exports6 = {};
1533
+ __export(Assertions_exports6, {
1470
1534
  labelPredicate: () => labelPredicate
1471
1535
  });
1472
1536
  import { s as s6 } from "@sapphire/shapeshift";
1473
1537
  import { ComponentType as ComponentType12 } from "discord-api-types/v10";
1474
-
1475
- // src/components/selectMenu/Assertions.ts
1476
- import { Result, s as s5 } from "@sapphire/shapeshift";
1477
- import { ChannelType as ChannelType2, ComponentType as ComponentType11, SelectMenuDefaultValueType as SelectMenuDefaultValueType5 } from "discord-api-types/v10";
1478
- var selectMenuBasePredicate = s5.object({
1479
- id: idValidator.optional(),
1480
- placeholder: s5.string().lengthLessThanOrEqual(150).optional(),
1481
- min_values: s5.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
1482
- max_values: s5.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
1483
- custom_id: customIdValidator,
1484
- disabled: s5.boolean().optional()
1485
- });
1486
- var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
1487
- type: s5.literal(ComponentType11.ChannelSelect),
1488
- channel_types: s5.nativeEnum(ChannelType2).array().optional(),
1489
- default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType5.Channel) }).array().lengthLessThanOrEqual(25).optional()
1490
- }).setValidationEnabled(isValidationEnabled);
1491
- var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
1492
- type: s5.literal(ComponentType11.MentionableSelect),
1493
- default_values: s5.object({
1494
- id: s5.string(),
1495
- type: s5.union([s5.literal(SelectMenuDefaultValueType5.Role), s5.literal(SelectMenuDefaultValueType5.User)])
1496
- }).array().lengthLessThanOrEqual(25).optional()
1497
- }).setValidationEnabled(isValidationEnabled);
1498
- var selectMenuRolePredicate = selectMenuBasePredicate.extend({
1499
- type: s5.literal(ComponentType11.RoleSelect),
1500
- default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType5.Role) }).array().lengthLessThanOrEqual(25).optional()
1501
- }).setValidationEnabled(isValidationEnabled);
1502
- var selectMenuUserPredicate = selectMenuBasePredicate.extend({
1503
- type: s5.literal(ComponentType11.UserSelect),
1504
- default_values: s5.object({ id: s5.string(), type: s5.literal(SelectMenuDefaultValueType5.User) }).array().lengthLessThanOrEqual(25).optional()
1505
- }).setValidationEnabled(isValidationEnabled);
1506
- var selectMenuStringOptionPredicate = s5.object({
1507
- label: labelValidator,
1508
- value: s5.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
1509
- description: s5.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
1510
- emoji: emojiValidator.optional(),
1511
- default: s5.boolean().optional()
1512
- }).setValidationEnabled(isValidationEnabled);
1513
- var selectMenuStringPredicate = selectMenuBasePredicate.extend({
1514
- type: s5.literal(ComponentType11.StringSelect),
1515
- options: selectMenuStringOptionPredicate.array().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(25)
1516
- }).reshape((value) => {
1517
- if (value.min_values !== void 0 && value.options.length < value.min_values) {
1518
- return Result.err(new RangeError(`The number of options must be greater than or equal to min_values`));
1519
- }
1520
- if (value.min_values !== void 0 && value.max_values !== void 0 && value.min_values > value.max_values) {
1521
- return Result.err(
1522
- new RangeError(`The maximum amount of options must be greater than or equal to the minimum amount of options`)
1523
- );
1524
- }
1525
- return Result.ok(value);
1526
- }).setValidationEnabled(isValidationEnabled);
1527
-
1528
- // src/components/label/Assertions.ts
1529
1538
  var labelPredicate = s6.object({
1530
1539
  id: idValidator.optional(),
1531
1540
  type: s6.literal(ComponentType12.Label),
@@ -1688,8 +1697,8 @@ var LabelBuilder = class extends ComponentBuilder {
1688
1697
  import { ComponentType as ComponentType18 } from "discord-api-types/v10";
1689
1698
 
1690
1699
  // src/components/v2/Assertions.ts
1691
- var Assertions_exports6 = {};
1692
- __export(Assertions_exports6, {
1700
+ var Assertions_exports7 = {};
1701
+ __export(Assertions_exports7, {
1693
1702
  accessoryPredicate: () => accessoryPredicate,
1694
1703
  assertReturnOfBuilder: () => assertReturnOfBuilder,
1695
1704
  containerColorPredicate: () => containerColorPredicate,
@@ -2025,7 +2034,8 @@ var ContainerBuilder = class extends ComponentBuilder {
2025
2034
  * },
2026
2035
  * ],
2027
2036
  * })
2028
- * .addComponents(separator, section);
2037
+ * .addSeparatorComponents(separator)
2038
+ * .addSectionComponents(section);
2029
2039
  * ```
2030
2040
  */
2031
2041
  constructor({ components, ...data } = {}) {
@@ -2590,8 +2600,8 @@ var ActionRowBuilder = class extends ComponentBuilder {
2590
2600
  import { ComponentType as ComponentType23 } from "discord-api-types/v10";
2591
2601
 
2592
2602
  // src/interactions/modals/Assertions.ts
2593
- var Assertions_exports7 = {};
2594
- __export(Assertions_exports7, {
2603
+ var Assertions_exports8 = {};
2604
+ __export(Assertions_exports8, {
2595
2605
  componentsValidator: () => componentsValidator,
2596
2606
  titleValidator: () => titleValidator,
2597
2607
  validateRequiredParameters: () => validateRequiredParameters2
@@ -2783,8 +2793,8 @@ var ModalBuilder = class {
2783
2793
  };
2784
2794
 
2785
2795
  // src/interactions/slashCommands/Assertions.ts
2786
- var Assertions_exports8 = {};
2787
- __export(Assertions_exports8, {
2796
+ var Assertions_exports9 = {};
2797
+ __export(Assertions_exports9, {
2788
2798
  assertReturnOfBuilder: () => assertReturnOfBuilder2,
2789
2799
  contextsPredicate: () => contextsPredicate,
2790
2800
  integrationTypesPredicate: () => integrationTypesPredicate,
@@ -3844,8 +3854,8 @@ SlashCommandBuilder = __decorateClass([
3844
3854
  ], SlashCommandBuilder);
3845
3855
 
3846
3856
  // src/interactions/contextMenuCommands/Assertions.ts
3847
- var Assertions_exports9 = {};
3848
- __export(Assertions_exports9, {
3857
+ var Assertions_exports10 = {};
3858
+ __export(Assertions_exports10, {
3849
3859
  contextsPredicate: () => contextsPredicate2,
3850
3860
  integrationTypesPredicate: () => integrationTypesPredicate2,
3851
3861
  validateDMPermission: () => validateDMPermission2,
@@ -4076,7 +4086,7 @@ function embedLength(data) {
4076
4086
  __name(embedLength, "embedLength");
4077
4087
 
4078
4088
  // src/index.ts
4079
- var version = "1.13.0";
4089
+ var version = "1.13.1";
4080
4090
  export {
4081
4091
  ActionRowBuilder,
4082
4092
  ApplicationCommandNumericOptionMinMaxValueMixin,
@@ -4089,24 +4099,25 @@ export {
4089
4099
  ChannelSelectMenuBuilder,
4090
4100
  Assertions_exports2 as ComponentAssertions,
4091
4101
  ComponentBuilder,
4092
- Assertions_exports6 as ComponentsV2Assertions,
4102
+ Assertions_exports7 as ComponentsV2Assertions,
4093
4103
  ContainerBuilder,
4094
- Assertions_exports9 as ContextMenuCommandAssertions,
4104
+ Assertions_exports10 as ContextMenuCommandAssertions,
4095
4105
  ContextMenuCommandBuilder,
4096
4106
  Assertions_exports as EmbedAssertions,
4097
4107
  EmbedBuilder,
4098
4108
  FileBuilder,
4099
4109
  Assertions_exports3 as FileUploadAssertions,
4100
4110
  FileUploadBuilder,
4101
- Assertions_exports5 as LabelAssertions,
4111
+ Assertions_exports6 as LabelAssertions,
4102
4112
  LabelBuilder,
4103
4113
  MediaGalleryBuilder,
4104
4114
  MediaGalleryItemBuilder,
4105
4115
  MentionableSelectMenuBuilder,
4106
- Assertions_exports7 as ModalAssertions,
4116
+ Assertions_exports8 as ModalAssertions,
4107
4117
  ModalBuilder,
4108
4118
  RoleSelectMenuBuilder,
4109
4119
  SectionBuilder,
4120
+ Assertions_exports5 as SelectMenuAssertions,
4110
4121
  StringSelectMenuBuilder as SelectMenuBuilder,
4111
4122
  StringSelectMenuOptionBuilder as SelectMenuOptionBuilder,
4112
4123
  SeparatorBuilder,
@@ -4114,7 +4125,7 @@ export {
4114
4125
  SharedSlashCommand,
4115
4126
  SharedSlashCommandOptions,
4116
4127
  SharedSlashCommandSubcommands,
4117
- Assertions_exports8 as SlashCommandAssertions,
4128
+ Assertions_exports9 as SlashCommandAssertions,
4118
4129
  SlashCommandAttachmentOption,
4119
4130
  SlashCommandBooleanOption,
4120
4131
  SlashCommandBuilder,