@discordjs/builders 2.0.0-dev.1745367189-42ce11622 → 2.0.0-dev.1745453588-abc5d99ce

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
@@ -200,6 +200,22 @@ var ComponentBuilder = class {
200
200
  static {
201
201
  __name(this, "ComponentBuilder");
202
202
  }
203
+ /**
204
+ * Sets the id of this component.
205
+ *
206
+ * @param id - The id to use
207
+ */
208
+ setId(id) {
209
+ this.data.id = id;
210
+ return this;
211
+ }
212
+ /**
213
+ * Clears the id of this component, defaulting to a default incremented id.
214
+ */
215
+ clearId() {
216
+ this.data.id = void 0;
217
+ return this;
218
+ }
203
219
  };
204
220
 
205
221
  // src/components/button/Button.ts
@@ -968,237 +984,1063 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
968
984
  return this;
969
985
  }
970
986
  /**
971
- * Sets default users for this auto populated select menu.
987
+ * Sets default users for this auto populated select menu.
988
+ *
989
+ * @param users - The users to set
990
+ */
991
+ setDefaultUsers(...users) {
992
+ const normalizedValues = normalizeArray(users);
993
+ this.data.default_values = normalizedValues.map((id) => ({
994
+ id,
995
+ type: SelectMenuDefaultValueType5.User
996
+ }));
997
+ return this;
998
+ }
999
+ /**
1000
+ * {@inheritDoc ComponentBuilder.toJSON}
1001
+ */
1002
+ toJSON(validationOverride) {
1003
+ const clone = structuredClone(this.data);
1004
+ validate(selectMenuUserPredicate, clone, validationOverride);
1005
+ return clone;
1006
+ }
1007
+ };
1008
+
1009
+ // src/components/textInput/TextInput.ts
1010
+ import { ComponentType as ComponentType11 } from "discord-api-types/v10";
1011
+
1012
+ // src/components/textInput/Assertions.ts
1013
+ import { ComponentType as ComponentType10, TextInputStyle } from "discord-api-types/v10";
1014
+ import { z as z3 } from "zod";
1015
+ var textInputPredicate = z3.object({
1016
+ type: z3.literal(ComponentType10.TextInput),
1017
+ custom_id: customIdPredicate,
1018
+ label: z3.string().min(1).max(45),
1019
+ style: z3.nativeEnum(TextInputStyle),
1020
+ min_length: z3.number().min(0).max(4e3).optional(),
1021
+ max_length: z3.number().min(1).max(4e3).optional(),
1022
+ placeholder: z3.string().max(100).optional(),
1023
+ value: z3.string().min(1).max(4e3).optional(),
1024
+ required: z3.boolean().optional()
1025
+ });
1026
+
1027
+ // src/components/textInput/TextInput.ts
1028
+ var TextInputBuilder = class extends ComponentBuilder {
1029
+ static {
1030
+ __name(this, "TextInputBuilder");
1031
+ }
1032
+ data;
1033
+ /**
1034
+ * Creates a new text input from API data.
1035
+ *
1036
+ * @param data - The API data to create this text input with
1037
+ * @example
1038
+ * Creating a text input from an API data object:
1039
+ * ```ts
1040
+ * const textInput = new TextInputBuilder({
1041
+ * custom_id: 'a cool text input',
1042
+ * label: 'Type something',
1043
+ * style: TextInputStyle.Short,
1044
+ * });
1045
+ * ```
1046
+ * @example
1047
+ * Creating a text input using setters and API data:
1048
+ * ```ts
1049
+ * const textInput = new TextInputBuilder({
1050
+ * label: 'Type something else',
1051
+ * })
1052
+ * .setCustomId('woah')
1053
+ * .setStyle(TextInputStyle.Paragraph);
1054
+ * ```
1055
+ */
1056
+ constructor(data = {}) {
1057
+ super();
1058
+ this.data = { ...structuredClone(data), type: ComponentType11.TextInput };
1059
+ }
1060
+ /**
1061
+ * Sets the custom id for this text input.
1062
+ *
1063
+ * @param customId - The custom id to use
1064
+ */
1065
+ setCustomId(customId) {
1066
+ this.data.custom_id = customId;
1067
+ return this;
1068
+ }
1069
+ /**
1070
+ * Sets the label for this text input.
1071
+ *
1072
+ * @param label - The label to use
1073
+ */
1074
+ setLabel(label) {
1075
+ this.data.label = label;
1076
+ return this;
1077
+ }
1078
+ /**
1079
+ * Sets the style for this text input.
1080
+ *
1081
+ * @param style - The style to use
1082
+ */
1083
+ setStyle(style) {
1084
+ this.data.style = style;
1085
+ return this;
1086
+ }
1087
+ /**
1088
+ * Sets the minimum length of text for this text input.
1089
+ *
1090
+ * @param minLength - The minimum length of text for this text input
1091
+ */
1092
+ setMinLength(minLength) {
1093
+ this.data.min_length = minLength;
1094
+ return this;
1095
+ }
1096
+ /**
1097
+ * Clears the minimum length of text for this text input.
1098
+ */
1099
+ clearMinLength() {
1100
+ this.data.min_length = void 0;
1101
+ return this;
1102
+ }
1103
+ /**
1104
+ * Sets the maximum length of text for this text input.
1105
+ *
1106
+ * @param maxLength - The maximum length of text for this text input
1107
+ */
1108
+ setMaxLength(maxLength) {
1109
+ this.data.max_length = maxLength;
1110
+ return this;
1111
+ }
1112
+ /**
1113
+ * Clears the maximum length of text for this text input.
1114
+ */
1115
+ clearMaxLength() {
1116
+ this.data.max_length = void 0;
1117
+ return this;
1118
+ }
1119
+ /**
1120
+ * Sets the placeholder for this text input.
1121
+ *
1122
+ * @param placeholder - The placeholder to use
1123
+ */
1124
+ setPlaceholder(placeholder) {
1125
+ this.data.placeholder = placeholder;
1126
+ return this;
1127
+ }
1128
+ /**
1129
+ * Clears the placeholder for this text input.
1130
+ */
1131
+ clearPlaceholder() {
1132
+ this.data.placeholder = void 0;
1133
+ return this;
1134
+ }
1135
+ /**
1136
+ * Sets the value for this text input.
1137
+ *
1138
+ * @param value - The value to use
1139
+ */
1140
+ setValue(value) {
1141
+ this.data.value = value;
1142
+ return this;
1143
+ }
1144
+ /**
1145
+ * Clears the value for this text input.
1146
+ */
1147
+ clearValue() {
1148
+ this.data.value = void 0;
1149
+ return this;
1150
+ }
1151
+ /**
1152
+ * Sets whether this text input is required.
1153
+ *
1154
+ * @param required - Whether this text input is required
1155
+ */
1156
+ setRequired(required = true) {
1157
+ this.data.required = required;
1158
+ return this;
1159
+ }
1160
+ /**
1161
+ * {@inheritDoc ComponentBuilder.toJSON}
1162
+ */
1163
+ toJSON(validationOverride) {
1164
+ const clone = structuredClone(this.data);
1165
+ validate(textInputPredicate, clone, validationOverride);
1166
+ return clone;
1167
+ }
1168
+ };
1169
+
1170
+ // src/components/ActionRow.ts
1171
+ import { ComponentType as ComponentType21 } from "discord-api-types/v10";
1172
+
1173
+ // src/components/Components.ts
1174
+ import { ButtonStyle as ButtonStyle5, ComponentType as ComponentType20 } from "discord-api-types/v10";
1175
+
1176
+ // src/components/v2/Container.ts
1177
+ import { ComponentType as ComponentType19 } from "discord-api-types/v10";
1178
+
1179
+ // src/components/v2/Assertions.ts
1180
+ import { ComponentType as ComponentType12, SeparatorSpacingSize } from "discord-api-types/v10";
1181
+ import { z as z4 } from "zod";
1182
+ var unfurledMediaItemPredicate = z4.object({
1183
+ url: z4.string().url().refine(refineURLPredicate(["http:", "https:", "attachment:"]), {
1184
+ message: "Invalid protocol for media URL. Must be http:, https:, or attachment:"
1185
+ })
1186
+ });
1187
+ var thumbnailPredicate = z4.object({
1188
+ media: unfurledMediaItemPredicate,
1189
+ description: z4.string().min(1).max(1024).nullish(),
1190
+ spoiler: z4.boolean().optional()
1191
+ });
1192
+ var unfurledMediaItemAttachmentOnlyPredicate = z4.object({
1193
+ url: z4.string().url().refine(refineURLPredicate(["attachment:"]), {
1194
+ message: "Invalid protocol for file URL. Must be attachment:"
1195
+ })
1196
+ });
1197
+ var filePredicate = z4.object({
1198
+ file: unfurledMediaItemAttachmentOnlyPredicate,
1199
+ spoiler: z4.boolean().optional()
1200
+ });
1201
+ var separatorPredicate = z4.object({
1202
+ divider: z4.boolean().optional(),
1203
+ spacing: z4.nativeEnum(SeparatorSpacingSize).optional()
1204
+ });
1205
+ var textDisplayPredicate = z4.object({
1206
+ content: z4.string().min(1).max(4e3)
1207
+ });
1208
+ var mediaGalleryItemPredicate = z4.object({
1209
+ media: unfurledMediaItemPredicate,
1210
+ description: z4.string().min(1).max(1024).nullish(),
1211
+ spoiler: z4.boolean().optional()
1212
+ });
1213
+ var mediaGalleryPredicate = z4.object({
1214
+ items: z4.array(mediaGalleryItemPredicate).min(1).max(10)
1215
+ });
1216
+ var sectionPredicate = z4.object({
1217
+ components: z4.array(textDisplayPredicate).min(1).max(3),
1218
+ accessory: z4.union([
1219
+ z4.object({ type: z4.literal(ComponentType12.Button) }),
1220
+ z4.object({ type: z4.literal(ComponentType12.Thumbnail) })
1221
+ ])
1222
+ });
1223
+ var containerPredicate = z4.object({
1224
+ components: z4.array(
1225
+ z4.union([
1226
+ actionRowPredicate,
1227
+ filePredicate,
1228
+ mediaGalleryPredicate,
1229
+ sectionPredicate,
1230
+ separatorPredicate,
1231
+ textDisplayPredicate
1232
+ ])
1233
+ ).min(1).max(10),
1234
+ spoiler: z4.boolean().optional(),
1235
+ accent_color: z4.number().int().min(0).max(16777215).nullish()
1236
+ });
1237
+
1238
+ // src/components/v2/File.ts
1239
+ import { ComponentType as ComponentType13 } from "discord-api-types/v10";
1240
+ var FileBuilder = class extends ComponentBuilder {
1241
+ static {
1242
+ __name(this, "FileBuilder");
1243
+ }
1244
+ data;
1245
+ /**
1246
+ * Creates a new file from API data.
1247
+ *
1248
+ * @param data - The API data to create this file with
1249
+ * @example
1250
+ * Creating a file from an API data object:
1251
+ * ```ts
1252
+ * const file = new FileBuilder({
1253
+ * spoiler: true,
1254
+ * file: {
1255
+ * url: 'attachment://file.png',
1256
+ * },
1257
+ * });
1258
+ * ```
1259
+ * @example
1260
+ * Creating a file using setters and API data:
1261
+ * ```ts
1262
+ * const file = new FileBuilder({
1263
+ * file: {
1264
+ * url: 'attachment://image.jpg',
1265
+ * },
1266
+ * })
1267
+ * .setSpoiler(false);
1268
+ * ```
1269
+ */
1270
+ constructor(data = {}) {
1271
+ super();
1272
+ this.data = {
1273
+ ...structuredClone(data),
1274
+ file: data.file ? { url: data.file.url } : void 0,
1275
+ type: ComponentType13.File
1276
+ };
1277
+ }
1278
+ /**
1279
+ * Sets the spoiler status of this file.
1280
+ *
1281
+ * @param spoiler - The spoiler status to use
1282
+ */
1283
+ setSpoiler(spoiler = true) {
1284
+ this.data.spoiler = spoiler;
1285
+ return this;
1286
+ }
1287
+ /**
1288
+ * Sets the media URL of this file.
1289
+ *
1290
+ * @param url - The URL to use
1291
+ */
1292
+ setURL(url) {
1293
+ this.data.file = { url };
1294
+ return this;
1295
+ }
1296
+ /**
1297
+ * {@inheritDoc ComponentBuilder.toJSON}
1298
+ */
1299
+ toJSON(validationOverride) {
1300
+ const clone = structuredClone(this.data);
1301
+ validate(filePredicate, clone, validationOverride);
1302
+ return clone;
1303
+ }
1304
+ };
1305
+
1306
+ // src/components/v2/MediaGallery.ts
1307
+ import { ComponentType as ComponentType14 } from "discord-api-types/v10";
1308
+
1309
+ // src/components/v2/MediaGalleryItem.ts
1310
+ var MediaGalleryItemBuilder = class {
1311
+ static {
1312
+ __name(this, "MediaGalleryItemBuilder");
1313
+ }
1314
+ data;
1315
+ /**
1316
+ * Creates a new media gallery item from API data.
1317
+ *
1318
+ * @param data - The API data to create this media gallery item with
1319
+ * @example
1320
+ * Creating a media gallery item from an API data object:
1321
+ * ```ts
1322
+ * const item = new MediaGalleryItemBuilder({
1323
+ * description: "Some text here",
1324
+ * media: {
1325
+ * url: 'https://cdn.discordapp.com/embed/avatars/2.png',
1326
+ * },
1327
+ * });
1328
+ * ```
1329
+ * @example
1330
+ * Creating a media gallery item using setters and API data:
1331
+ * ```ts
1332
+ * const item = new MediaGalleryItemBuilder({
1333
+ * media: {
1334
+ * url: 'https://cdn.discordapp.com/embed/avatars/5.png',
1335
+ * },
1336
+ * })
1337
+ * .setDescription("alt text");
1338
+ * ```
1339
+ */
1340
+ constructor(data = {}) {
1341
+ this.data = {
1342
+ ...structuredClone(data)
1343
+ };
1344
+ }
1345
+ /**
1346
+ * Sets the source URL of this media gallery item.
1347
+ *
1348
+ * @param url - The URL to use
1349
+ */
1350
+ setURL(url) {
1351
+ this.data.media = { url };
1352
+ return this;
1353
+ }
1354
+ /**
1355
+ * Sets the description of this thumbnail.
1356
+ *
1357
+ * @param description - The description to use
1358
+ */
1359
+ setDescription(description) {
1360
+ this.data.description = description;
1361
+ return this;
1362
+ }
1363
+ /**
1364
+ * Clears the description of this thumbnail.
1365
+ */
1366
+ clearDescription() {
1367
+ this.data.description = void 0;
1368
+ return this;
1369
+ }
1370
+ /**
1371
+ * Sets the spoiler status of this thumbnail.
1372
+ *
1373
+ * @param spoiler - The spoiler status to use
1374
+ */
1375
+ setSpoiler(spoiler = true) {
1376
+ this.data.spoiler = spoiler;
1377
+ return this;
1378
+ }
1379
+ /**
1380
+ * Transforms this object to its JSON format
1381
+ */
1382
+ toJSON(validationOverride) {
1383
+ const clone = structuredClone(this.data);
1384
+ validate(mediaGalleryItemPredicate, clone, validationOverride);
1385
+ return clone;
1386
+ }
1387
+ };
1388
+
1389
+ // src/components/v2/MediaGallery.ts
1390
+ var MediaGalleryBuilder = class extends ComponentBuilder {
1391
+ static {
1392
+ __name(this, "MediaGalleryBuilder");
1393
+ }
1394
+ data;
1395
+ /**
1396
+ * Creates a new media gallery from API data.
1397
+ *
1398
+ * @param data - The API data to create this container with
1399
+ * @example
1400
+ * Creating a media gallery from an API data object:
1401
+ * ```ts
1402
+ * const mediaGallery = new MediaGalleryBuilder({
1403
+ * items: [
1404
+ * {
1405
+ * description: "Some text here",
1406
+ * media: {
1407
+ * url: 'https://cdn.discordapp.com/embed/avatars/2.png',
1408
+ * },
1409
+ * },
1410
+ * ],
1411
+ * });
1412
+ * ```
1413
+ * @example
1414
+ * Creating a media gallery using setters and API data:
1415
+ * ```ts
1416
+ * const mediaGallery = new MediaGalleryBuilder({
1417
+ * items: [
1418
+ * {
1419
+ * description: "alt text",
1420
+ * media: {
1421
+ * url: 'https://cdn.discordapp.com/embed/avatars/5.png',
1422
+ * },
1423
+ * },
1424
+ * ],
1425
+ * })
1426
+ * .addItems(item2, item3);
1427
+ * ```
1428
+ */
1429
+ constructor(data = {}) {
1430
+ super();
1431
+ this.data = {
1432
+ items: data?.items?.map((item) => new MediaGalleryItemBuilder(item)) ?? [],
1433
+ type: ComponentType14.MediaGallery
1434
+ };
1435
+ }
1436
+ /**
1437
+ * The items in this media gallery.
1438
+ */
1439
+ get items() {
1440
+ return this.data.items;
1441
+ }
1442
+ /**
1443
+ * Adds a media gallery item to this media gallery.
1444
+ *
1445
+ * @param input - The items to add
1446
+ */
1447
+ addItems(...input) {
1448
+ const normalized = normalizeArray(input);
1449
+ const resolved = normalized.map((item) => resolveBuilder(item, MediaGalleryItemBuilder));
1450
+ this.data.items.push(...resolved);
1451
+ return this;
1452
+ }
1453
+ /**
1454
+ * Removes, replaces, or inserts media gallery items for this media gallery.
1455
+ *
1456
+ * @param index - The index to start removing, replacing or inserting items
1457
+ * @param deleteCount - The amount of items to remove
1458
+ * @param items - The items to insert
1459
+ */
1460
+ spliceItems(index, deleteCount, ...items) {
1461
+ const normalized = normalizeArray(items);
1462
+ const resolved = normalized.map((item) => resolveBuilder(item, MediaGalleryItemBuilder));
1463
+ this.data.items.splice(index, deleteCount, ...resolved);
1464
+ return this;
1465
+ }
1466
+ /**
1467
+ * {@inheritDoc ComponentBuilder.toJSON}
1468
+ */
1469
+ toJSON(validationOverride) {
1470
+ const { items, ...rest } = this.data;
1471
+ const data = {
1472
+ ...structuredClone(rest),
1473
+ items: items.map((item) => item.toJSON(false))
1474
+ };
1475
+ validate(mediaGalleryPredicate, data, validationOverride);
1476
+ return data;
1477
+ }
1478
+ };
1479
+
1480
+ // src/components/v2/Section.ts
1481
+ import { ComponentType as ComponentType17 } from "discord-api-types/v10";
1482
+
1483
+ // src/components/v2/TextDisplay.ts
1484
+ import { ComponentType as ComponentType15 } from "discord-api-types/v10";
1485
+ var TextDisplayBuilder = class extends ComponentBuilder {
1486
+ static {
1487
+ __name(this, "TextDisplayBuilder");
1488
+ }
1489
+ data;
1490
+ /**
1491
+ * Creates a new text display from API data.
1492
+ *
1493
+ * @param data - The API data to create this text display with
1494
+ * @example
1495
+ * Creating a text display from an API data object:
1496
+ * ```ts
1497
+ * const textDisplay = new TextDisplayBuilder({
1498
+ * content: 'some text',
1499
+ * });
1500
+ * ```
1501
+ * @example
1502
+ * Creating a text display using setters and API data:
1503
+ * ```ts
1504
+ * const textDisplay = new TextDisplayBuilder({
1505
+ * content: 'old text',
1506
+ * })
1507
+ * .setContent('new text');
1508
+ * ```
1509
+ */
1510
+ constructor(data = {}) {
1511
+ super();
1512
+ this.data = {
1513
+ ...structuredClone(data),
1514
+ type: ComponentType15.TextDisplay
1515
+ };
1516
+ }
1517
+ /**
1518
+ * Sets the text of this text display.
1519
+ *
1520
+ * @param content - The text to use
1521
+ */
1522
+ setContent(content) {
1523
+ this.data.content = content;
1524
+ return this;
1525
+ }
1526
+ /**
1527
+ * {@inheritDoc ComponentBuilder.toJSON}
1528
+ */
1529
+ toJSON(validationOverride) {
1530
+ const clone = structuredClone(this.data);
1531
+ validate(textDisplayPredicate, clone, validationOverride);
1532
+ return clone;
1533
+ }
1534
+ };
1535
+
1536
+ // src/components/v2/Thumbnail.ts
1537
+ import { ComponentType as ComponentType16 } from "discord-api-types/v10";
1538
+ var ThumbnailBuilder = class extends ComponentBuilder {
1539
+ static {
1540
+ __name(this, "ThumbnailBuilder");
1541
+ }
1542
+ data;
1543
+ /**
1544
+ * Creates a new thumbnail from API data.
1545
+ *
1546
+ * @param data - The API data to create this thumbnail with
1547
+ * @example
1548
+ * Creating a thumbnail from an API data object:
1549
+ * ```ts
1550
+ * const thumbnail = new ThumbnailBuilder({
1551
+ * description: 'some text',
1552
+ * media: {
1553
+ * url: 'https://cdn.discordapp.com/embed/avatars/4.png',
1554
+ * },
1555
+ * });
1556
+ * ```
1557
+ * @example
1558
+ * Creating a thumbnail using setters and API data:
1559
+ * ```ts
1560
+ * const thumbnail = new ThumbnailBuilder({
1561
+ * media: {
1562
+ * url: 'attachment://image.png',
1563
+ * },
1564
+ * })
1565
+ * .setDescription('alt text');
1566
+ * ```
1567
+ */
1568
+ constructor(data = {}) {
1569
+ super();
1570
+ this.data = {
1571
+ ...structuredClone(data),
1572
+ media: data.media ? { url: data.media.url } : void 0,
1573
+ type: ComponentType16.Thumbnail
1574
+ };
1575
+ }
1576
+ /**
1577
+ * Sets the description of this thumbnail.
1578
+ *
1579
+ * @param description - The description to use
1580
+ */
1581
+ setDescription(description) {
1582
+ this.data.description = description;
1583
+ return this;
1584
+ }
1585
+ /**
1586
+ * Clears the description of this thumbnail.
1587
+ */
1588
+ clearDescription() {
1589
+ this.data.description = void 0;
1590
+ return this;
1591
+ }
1592
+ /**
1593
+ * Sets the spoiler status of this thumbnail.
1594
+ *
1595
+ * @param spoiler - The spoiler status to use
1596
+ */
1597
+ setSpoiler(spoiler = true) {
1598
+ this.data.spoiler = spoiler;
1599
+ return this;
1600
+ }
1601
+ /**
1602
+ * Sets the media URL of this thumbnail.
1603
+ *
1604
+ * @param url - The URL to use
1605
+ */
1606
+ setURL(url) {
1607
+ this.data.media = { url };
1608
+ return this;
1609
+ }
1610
+ /**
1611
+ * {@inheritdoc ComponentBuilder.toJSON}
1612
+ */
1613
+ toJSON(validationOverride) {
1614
+ const clone = structuredClone(this.data);
1615
+ validate(thumbnailPredicate, clone, validationOverride);
1616
+ return clone;
1617
+ }
1618
+ };
1619
+
1620
+ // src/components/v2/Section.ts
1621
+ var SectionBuilder = class extends ComponentBuilder {
1622
+ static {
1623
+ __name(this, "SectionBuilder");
1624
+ }
1625
+ data;
1626
+ get components() {
1627
+ return this.data.components;
1628
+ }
1629
+ /**
1630
+ * Creates a new section from API data.
1631
+ *
1632
+ * @param data - The API data to create this section with
1633
+ * @example
1634
+ * Creating a section from an API data object:
1635
+ * ```ts
1636
+ * const section = new SectionBuilder({
1637
+ * components: [
1638
+ * {
1639
+ * content: "Some text here",
1640
+ * type: ComponentType.TextDisplay,
1641
+ * },
1642
+ * ],
1643
+ * accessory: {
1644
+ * media: {
1645
+ * url: 'https://cdn.discordapp.com/embed/avatars/3.png',
1646
+ * },
1647
+ * }
1648
+ * });
1649
+ * ```
1650
+ * @example
1651
+ * Creating a section using setters and API data:
1652
+ * ```ts
1653
+ * const section = new SectionBuilder({
1654
+ * components: [
1655
+ * {
1656
+ * content: "# Heading",
1657
+ * type: ComponentType.TextDisplay,
1658
+ * },
1659
+ * ],
1660
+ * })
1661
+ * .setPrimaryButtonAccessory(button);
1662
+ * ```
1663
+ */
1664
+ constructor(data = {}) {
1665
+ super();
1666
+ const { components = [], accessory, ...rest } = data;
1667
+ this.data = {
1668
+ ...structuredClone(rest),
1669
+ accessory: accessory ? resolveAccessoryComponent(accessory) : void 0,
1670
+ components: components.map((component) => new TextDisplayBuilder(component)),
1671
+ type: ComponentType17.Section
1672
+ };
1673
+ }
1674
+ /**
1675
+ * Adds text display components to this section.
1676
+ *
1677
+ * @param input - The text display components to add
1678
+ */
1679
+ addTextDisplayComponents(...input) {
1680
+ const normalized = normalizeArray(input);
1681
+ const resolved = normalized.map((component) => resolveBuilder(component, TextDisplayBuilder));
1682
+ this.data.components.push(...resolved);
1683
+ return this;
1684
+ }
1685
+ /**
1686
+ * Sets a primary button component to be the accessory of this section.
1687
+ *
1688
+ * @param input - The button to set as the accessory
1689
+ */
1690
+ setPrimaryButtonAccessory(input) {
1691
+ const builder = resolveBuilder(input, PrimaryButtonBuilder);
1692
+ this.data.accessory = builder;
1693
+ return this;
1694
+ }
1695
+ /**
1696
+ * Sets a secondary button component to be the accessory of this section.
1697
+ *
1698
+ * @param input - The button to set as the accessory
1699
+ */
1700
+ setSecondaryButtonAccessory(input) {
1701
+ const builder = resolveBuilder(input, SecondaryButtonBuilder);
1702
+ this.data.accessory = builder;
1703
+ return this;
1704
+ }
1705
+ /**
1706
+ * Sets a success button component to be the accessory of this section.
1707
+ *
1708
+ * @param input - The button to set as the accessory
1709
+ */
1710
+ setSuccessButtonAccessory(input) {
1711
+ const builder = resolveBuilder(input, SuccessButtonBuilder);
1712
+ this.data.accessory = builder;
1713
+ return this;
1714
+ }
1715
+ /**
1716
+ * Sets a danger button component to be the accessory of this section.
1717
+ *
1718
+ * @param input - The button to set as the accessory
1719
+ */
1720
+ setDangerButtonAccessory(input) {
1721
+ const builder = resolveBuilder(input, DangerButtonBuilder);
1722
+ this.data.accessory = builder;
1723
+ return this;
1724
+ }
1725
+ /**
1726
+ * Sets a SKU id button component to be the accessory of this section.
1727
+ *
1728
+ * @param input - The button to set as the accessory
1729
+ */
1730
+ setPremiumButtonAccessory(input) {
1731
+ const builder = resolveBuilder(input, PremiumButtonBuilder);
1732
+ this.data.accessory = builder;
1733
+ return this;
1734
+ }
1735
+ /**
1736
+ * Sets a URL button component to be the accessory of this section.
1737
+ *
1738
+ * @param input - The button to set as the accessory
1739
+ */
1740
+ setLinkButtonAccessory(input) {
1741
+ const builder = resolveBuilder(input, LinkButtonBuilder);
1742
+ this.data.accessory = builder;
1743
+ return this;
1744
+ }
1745
+ /**
1746
+ * Sets a thumbnail component to be the accessory of this section.
1747
+ *
1748
+ * @param input - The thumbnail to set as the accessory
1749
+ */
1750
+ setThumbnailAccessory(input) {
1751
+ const builder = resolveBuilder(input, ThumbnailBuilder);
1752
+ this.data.accessory = builder;
1753
+ return this;
1754
+ }
1755
+ /**
1756
+ * Removes, replaces, or inserts text display components for this section.
972
1757
  *
973
- * @param users - The users to set
1758
+ * @param index - The index to start removing, replacing or inserting text display components
1759
+ * @param deleteCount - The amount of text display components to remove
1760
+ * @param components - The text display components to insert
974
1761
  */
975
- setDefaultUsers(...users) {
976
- const normalizedValues = normalizeArray(users);
977
- this.data.default_values = normalizedValues.map((id) => ({
978
- id,
979
- type: SelectMenuDefaultValueType5.User
980
- }));
1762
+ spliceTextDisplayComponents(index, deleteCount, ...components) {
1763
+ const normalized = normalizeArray(components);
1764
+ const resolved = normalized.map((component) => resolveBuilder(component, TextDisplayBuilder));
1765
+ this.data.components.splice(index, deleteCount, ...resolved);
981
1766
  return this;
982
1767
  }
983
1768
  /**
984
1769
  * {@inheritDoc ComponentBuilder.toJSON}
985
1770
  */
986
1771
  toJSON(validationOverride) {
987
- const clone = structuredClone(this.data);
988
- validate(selectMenuUserPredicate, clone, validationOverride);
989
- return clone;
1772
+ const { components, accessory, ...rest } = this.data;
1773
+ const data = {
1774
+ ...structuredClone(rest),
1775
+ components: components.map((component) => component.toJSON(false)),
1776
+ accessory: accessory?.toJSON(validationOverride)
1777
+ };
1778
+ validate(sectionPredicate, data, validationOverride);
1779
+ return data;
990
1780
  }
991
1781
  };
992
1782
 
993
- // src/components/textInput/TextInput.ts
994
- import { ComponentType as ComponentType11 } from "discord-api-types/v10";
995
-
996
- // src/components/textInput/Assertions.ts
997
- import { ComponentType as ComponentType10, TextInputStyle } from "discord-api-types/v10";
998
- import { z as z3 } from "zod";
999
- var textInputPredicate = z3.object({
1000
- type: z3.literal(ComponentType10.TextInput),
1001
- custom_id: customIdPredicate,
1002
- label: z3.string().min(1).max(45),
1003
- style: z3.nativeEnum(TextInputStyle),
1004
- min_length: z3.number().min(0).max(4e3).optional(),
1005
- max_length: z3.number().min(1).max(4e3).optional(),
1006
- placeholder: z3.string().max(100).optional(),
1007
- value: z3.string().min(1).max(4e3).optional(),
1008
- required: z3.boolean().optional()
1009
- });
1010
-
1011
- // src/components/textInput/TextInput.ts
1012
- var TextInputBuilder = class extends ComponentBuilder {
1783
+ // src/components/v2/Separator.ts
1784
+ import { ComponentType as ComponentType18 } from "discord-api-types/v10";
1785
+ var SeparatorBuilder = class extends ComponentBuilder {
1013
1786
  static {
1014
- __name(this, "TextInputBuilder");
1787
+ __name(this, "SeparatorBuilder");
1015
1788
  }
1016
1789
  data;
1017
1790
  /**
1018
- * Creates a new text input from API data.
1791
+ * Creates a new separator from API data.
1019
1792
  *
1020
- * @param data - The API data to create this text input with
1793
+ * @param data - The API data to create this separator with
1021
1794
  * @example
1022
- * Creating a text input from an API data object:
1795
+ * Creating a separator from an API data object:
1023
1796
  * ```ts
1024
- * const textInput = new TextInputBuilder({
1025
- * custom_id: 'a cool text input',
1026
- * label: 'Type something',
1027
- * style: TextInputStyle.Short,
1797
+ * const separator = new SeparatorBuilder({
1798
+ * spacing: SeparatorSpacingSize.Small,
1799
+ * divider: true,
1028
1800
  * });
1029
1801
  * ```
1030
1802
  * @example
1031
- * Creating a text input using setters and API data:
1803
+ * Creating a separator using setters and API data:
1032
1804
  * ```ts
1033
- * const textInput = new TextInputBuilder({
1034
- * label: 'Type something else',
1805
+ * const separator = new SeparatorBuilder({
1806
+ * spacing: SeparatorSpacingSize.Large,
1035
1807
  * })
1036
- * .setCustomId('woah')
1037
- * .setStyle(TextInputStyle.Paragraph);
1808
+ * .setDivider(false);
1038
1809
  * ```
1039
1810
  */
1040
1811
  constructor(data = {}) {
1041
1812
  super();
1042
- this.data = { ...structuredClone(data), type: ComponentType11.TextInput };
1813
+ this.data = {
1814
+ ...structuredClone(data),
1815
+ type: ComponentType18.Separator
1816
+ };
1043
1817
  }
1044
1818
  /**
1045
- * Sets the custom id for this text input.
1819
+ * Sets whether this separator should show a divider line.
1046
1820
  *
1047
- * @param customId - The custom id to use
1821
+ * @param divider - Whether to show a divider line
1048
1822
  */
1049
- setCustomId(customId) {
1050
- this.data.custom_id = customId;
1823
+ setDivider(divider = true) {
1824
+ this.data.divider = divider;
1051
1825
  return this;
1052
1826
  }
1053
1827
  /**
1054
- * Sets the label for this text input.
1828
+ * Sets the spacing of this separator.
1055
1829
  *
1056
- * @param label - The label to use
1830
+ * @param spacing - The spacing to use
1057
1831
  */
1058
- setLabel(label) {
1059
- this.data.label = label;
1832
+ setSpacing(spacing) {
1833
+ this.data.spacing = spacing;
1060
1834
  return this;
1061
1835
  }
1062
1836
  /**
1063
- * Sets the style for this text input.
1064
- *
1065
- * @param style - The style to use
1837
+ * Clears the spacing of this separator.
1066
1838
  */
1067
- setStyle(style) {
1068
- this.data.style = style;
1839
+ clearSpacing() {
1840
+ this.data.spacing = void 0;
1069
1841
  return this;
1070
1842
  }
1071
1843
  /**
1072
- * Sets the minimum length of text for this text input.
1844
+ * {@inheritDoc ComponentBuilder.toJSON}
1845
+ */
1846
+ toJSON(validationOverride) {
1847
+ const clone = structuredClone(this.data);
1848
+ validate(separatorPredicate, clone, validationOverride);
1849
+ return clone;
1850
+ }
1851
+ };
1852
+
1853
+ // src/components/v2/Container.ts
1854
+ var ContainerBuilder = class extends ComponentBuilder {
1855
+ static {
1856
+ __name(this, "ContainerBuilder");
1857
+ }
1858
+ data;
1859
+ constructor({ components = [], ...rest } = {}) {
1860
+ super();
1861
+ this.data = {
1862
+ ...structuredClone(rest),
1863
+ components: components.map((component) => createComponentBuilder(component)),
1864
+ type: ComponentType19.Container
1865
+ };
1866
+ }
1867
+ /**
1868
+ * Sets the accent color of this container.
1073
1869
  *
1074
- * @param minLength - The minimum length of text for this text input
1870
+ * @param color - The color to use
1075
1871
  */
1076
- setMinLength(minLength) {
1077
- this.data.min_length = minLength;
1872
+ setAccentColor(color) {
1873
+ this.data.accent_color = color;
1078
1874
  return this;
1079
1875
  }
1080
1876
  /**
1081
- * Clears the minimum length of text for this text input.
1877
+ * Clears the accent color of this container.
1082
1878
  */
1083
- clearMinLength() {
1084
- this.data.min_length = void 0;
1879
+ clearAccentColor() {
1880
+ this.data.accent_color = void 0;
1085
1881
  return this;
1086
1882
  }
1087
1883
  /**
1088
- * Sets the maximum length of text for this text input.
1884
+ * Sets the spoiler status of this container.
1089
1885
  *
1090
- * @param maxLength - The maximum length of text for this text input
1886
+ * @param spoiler - The spoiler status to use
1091
1887
  */
1092
- setMaxLength(maxLength) {
1093
- this.data.max_length = maxLength;
1888
+ setSpoiler(spoiler = true) {
1889
+ this.data.spoiler = spoiler;
1094
1890
  return this;
1095
1891
  }
1096
1892
  /**
1097
- * Clears the maximum length of text for this text input.
1893
+ * Adds action row components to this container.
1894
+ *
1895
+ * @param input - The action row to add
1098
1896
  */
1099
- clearMaxLength() {
1100
- this.data.max_length = void 0;
1897
+ addActionRowComponents(...input) {
1898
+ const normalized = normalizeArray(input);
1899
+ const resolved = normalized.map((component) => resolveBuilder(component, ActionRowBuilder));
1900
+ this.data.components.push(...resolved);
1101
1901
  return this;
1102
1902
  }
1103
1903
  /**
1104
- * Sets the placeholder for this text input.
1904
+ * Adds file components to this container.
1105
1905
  *
1106
- * @param placeholder - The placeholder to use
1906
+ * @param input - The file components to add
1107
1907
  */
1108
- setPlaceholder(placeholder) {
1109
- this.data.placeholder = placeholder;
1908
+ addFileComponents(...input) {
1909
+ const normalized = normalizeArray(input);
1910
+ const resolved = normalized.map((component) => resolveBuilder(component, FileBuilder));
1911
+ this.data.components.push(...resolved);
1110
1912
  return this;
1111
1913
  }
1112
1914
  /**
1113
- * Clears the placeholder for this text input.
1915
+ * Adds media gallery components to this container.
1916
+ *
1917
+ * @param input - The media gallery components to add
1114
1918
  */
1115
- clearPlaceholder() {
1116
- this.data.placeholder = void 0;
1919
+ addMediaGalleryComponents(...input) {
1920
+ const normalized = normalizeArray(input);
1921
+ const resolved = normalized.map((component) => resolveBuilder(component, MediaGalleryBuilder));
1922
+ this.data.components.push(...resolved);
1117
1923
  return this;
1118
1924
  }
1119
1925
  /**
1120
- * Sets the value for this text input.
1926
+ * Adds section components to this container.
1121
1927
  *
1122
- * @param value - The value to use
1928
+ * @param input - The section components to add
1123
1929
  */
1124
- setValue(value) {
1125
- this.data.value = value;
1930
+ addSectionComponents(...input) {
1931
+ const normalized = normalizeArray(input);
1932
+ const resolved = normalized.map((component) => resolveBuilder(component, SectionBuilder));
1933
+ this.data.components.push(...resolved);
1126
1934
  return this;
1127
1935
  }
1128
1936
  /**
1129
- * Clears the value for this text input.
1937
+ * Adds separator components to this container.
1938
+ *
1939
+ * @param input - The separator components to add
1130
1940
  */
1131
- clearValue() {
1132
- this.data.value = void 0;
1941
+ addSeparatorComponents(...input) {
1942
+ const normalized = normalizeArray(input);
1943
+ const resolved = normalized.map((component) => resolveBuilder(component, SeparatorBuilder));
1944
+ this.data.components.push(...resolved);
1133
1945
  return this;
1134
1946
  }
1135
1947
  /**
1136
- * Sets whether this text input is required.
1948
+ * Adds text display components to this container.
1137
1949
  *
1138
- * @param required - Whether this text input is required
1950
+ * @param input - The text display components to add
1139
1951
  */
1140
- setRequired(required = true) {
1141
- this.data.required = required;
1952
+ addTextDisplayComponents(...input) {
1953
+ const normalized = normalizeArray(input);
1954
+ const resolved = normalized.map((component) => resolveBuilder(component, TextDisplayBuilder));
1955
+ this.data.components.push(...resolved);
1956
+ return this;
1957
+ }
1958
+ /**
1959
+ * Removes, replaces, or inserts components for this container
1960
+ *
1961
+ * @remarks
1962
+ * This method behaves similarly
1963
+ * to {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | Array.prototype.splice()}.
1964
+ *
1965
+ * It's useful for modifying and adjusting order of the already-existing components of a container.
1966
+ * @example
1967
+ * Remove the first component:
1968
+ * ```ts
1969
+ * container.spliceComponents(0, 1);
1970
+ * ```
1971
+ * @example
1972
+ * Remove the first n components:
1973
+ * ```ts
1974
+ * const n = 4;
1975
+ * container.spliceComponents(0, n);
1976
+ * ```
1977
+ * @example
1978
+ * Remove the last component:
1979
+ * ```ts
1980
+ * container.spliceComponents(-1, 1);
1981
+ * ```
1982
+ * @param index - The index to start at
1983
+ * @param deleteCount - The number of components to remove
1984
+ * @param components - The replacing component objects
1985
+ */
1986
+ spliceComponents(index, deleteCount, ...components) {
1987
+ const normalized = normalizeArray(components);
1988
+ const resolved = normalized.map(
1989
+ (component) => component instanceof ComponentBuilder ? component : createComponentBuilder(component)
1990
+ );
1991
+ this.data.components.splice(index, deleteCount, ...resolved);
1142
1992
  return this;
1143
1993
  }
1144
1994
  /**
1145
1995
  * {@inheritDoc ComponentBuilder.toJSON}
1146
1996
  */
1147
1997
  toJSON(validationOverride) {
1148
- const clone = structuredClone(this.data);
1149
- validate(textInputPredicate, clone, validationOverride);
1150
- return clone;
1998
+ const { components, ...rest } = this.data;
1999
+ const data = {
2000
+ ...structuredClone(rest),
2001
+ components: components.map((component) => component.toJSON(false))
2002
+ };
2003
+ validate(containerPredicate, data, validationOverride);
2004
+ return data;
1151
2005
  }
1152
2006
  };
1153
2007
 
1154
- // src/components/ActionRow.ts
1155
- import { ComponentType as ComponentType13 } from "discord-api-types/v10";
1156
-
1157
2008
  // src/components/Components.ts
1158
- import { ButtonStyle as ButtonStyle5, ComponentType as ComponentType12 } from "discord-api-types/v10";
1159
2009
  function createComponentBuilder(data) {
1160
2010
  if (data instanceof ComponentBuilder) {
1161
2011
  return data;
1162
2012
  }
1163
2013
  switch (data.type) {
1164
- case ComponentType12.ActionRow:
2014
+ case ComponentType20.ActionRow:
1165
2015
  return new ActionRowBuilder(data);
1166
- case ComponentType12.Button:
2016
+ case ComponentType20.Button:
1167
2017
  return createButtonBuilder(data);
1168
- case ComponentType12.StringSelect:
2018
+ case ComponentType20.StringSelect:
1169
2019
  return new StringSelectMenuBuilder(data);
1170
- case ComponentType12.TextInput:
2020
+ case ComponentType20.TextInput:
1171
2021
  return new TextInputBuilder(data);
1172
- case ComponentType12.UserSelect:
2022
+ case ComponentType20.UserSelect:
1173
2023
  return new UserSelectMenuBuilder(data);
1174
- case ComponentType12.RoleSelect:
2024
+ case ComponentType20.RoleSelect:
1175
2025
  return new RoleSelectMenuBuilder(data);
1176
- case ComponentType12.MentionableSelect:
2026
+ case ComponentType20.MentionableSelect:
1177
2027
  return new MentionableSelectMenuBuilder(data);
1178
- case ComponentType12.ChannelSelect:
2028
+ case ComponentType20.ChannelSelect:
1179
2029
  return new ChannelSelectMenuBuilder(data);
1180
- // Will be handled later
1181
- case ComponentType12.Section: {
1182
- throw new Error("Not implemented yet: ComponentType.Section case");
1183
- }
1184
- case ComponentType12.TextDisplay: {
1185
- throw new Error("Not implemented yet: ComponentType.TextDisplay case");
1186
- }
1187
- case ComponentType12.Thumbnail: {
1188
- throw new Error("Not implemented yet: ComponentType.Thumbnail case");
1189
- }
1190
- case ComponentType12.MediaGallery: {
1191
- throw new Error("Not implemented yet: ComponentType.MediaGallery case");
1192
- }
1193
- case ComponentType12.File: {
1194
- throw new Error("Not implemented yet: ComponentType.File case");
1195
- }
1196
- case ComponentType12.Separator: {
1197
- throw new Error("Not implemented yet: ComponentType.Separator case");
1198
- }
1199
- case ComponentType12.Container: {
1200
- throw new Error("Not implemented yet: ComponentType.Container case");
1201
- }
2030
+ case ComponentType20.Thumbnail:
2031
+ return new ThumbnailBuilder(data);
2032
+ case ComponentType20.File:
2033
+ return new FileBuilder(data);
2034
+ case ComponentType20.Separator:
2035
+ return new SeparatorBuilder(data);
2036
+ case ComponentType20.TextDisplay:
2037
+ return new TextDisplayBuilder(data);
2038
+ case ComponentType20.MediaGallery:
2039
+ return new MediaGalleryBuilder(data);
2040
+ case ComponentType20.Section:
2041
+ return new SectionBuilder(data);
2042
+ case ComponentType20.Container:
2043
+ return new ContainerBuilder(data);
1202
2044
  default:
1203
2045
  throw new Error(`Cannot properly serialize component type: ${data.type}`);
1204
2046
  }
@@ -1223,6 +2065,17 @@ function createButtonBuilder(data) {
1223
2065
  }
1224
2066
  }
1225
2067
  __name(createButtonBuilder, "createButtonBuilder");
2068
+ function resolveAccessoryComponent(component) {
2069
+ switch (component.type) {
2070
+ case ComponentType20.Button:
2071
+ return createButtonBuilder(component);
2072
+ case ComponentType20.Thumbnail:
2073
+ return new ThumbnailBuilder(component);
2074
+ default:
2075
+ throw new Error(`Cannot properly serialize section accessory component: ${component.type}`);
2076
+ }
2077
+ }
2078
+ __name(resolveAccessoryComponent, "resolveAccessoryComponent");
1226
2079
 
1227
2080
  // src/components/ActionRow.ts
1228
2081
  var ActionRowBuilder = class extends ComponentBuilder {
@@ -1274,7 +2127,7 @@ var ActionRowBuilder = class extends ComponentBuilder {
1274
2127
  super();
1275
2128
  this.data = {
1276
2129
  ...structuredClone(data),
1277
- type: ComponentType13.ActionRow,
2130
+ type: ComponentType21.ActionRow,
1278
2131
  components: components.map((component) => createComponentBuilder(component))
1279
2132
  };
1280
2133
  }
@@ -1688,35 +2541,35 @@ import {
1688
2541
  InteractionContextType,
1689
2542
  ApplicationCommandOptionType
1690
2543
  } from "discord-api-types/v10";
1691
- import { z as z4 } from "zod";
1692
- var namePredicate = z4.string().min(1).max(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
1693
- var descriptionPredicate = z4.string().min(1).max(100);
1694
- var sharedNameAndDescriptionPredicate = z4.object({
2544
+ import { z as z5 } from "zod";
2545
+ var namePredicate = z5.string().min(1).max(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
2546
+ var descriptionPredicate = z5.string().min(1).max(100);
2547
+ var sharedNameAndDescriptionPredicate = z5.object({
1695
2548
  name: namePredicate,
1696
2549
  name_localizations: localeMapPredicate.optional(),
1697
2550
  description: descriptionPredicate,
1698
2551
  description_localizations: localeMapPredicate.optional()
1699
2552
  });
1700
- var numericMixinNumberOptionPredicate = z4.object({
1701
- max_value: z4.number().safe().optional(),
1702
- min_value: z4.number().safe().optional()
2553
+ var numericMixinNumberOptionPredicate = z5.object({
2554
+ max_value: z5.number().safe().optional(),
2555
+ min_value: z5.number().safe().optional()
1703
2556
  });
1704
- var numericMixinIntegerOptionPredicate = z4.object({
1705
- max_value: z4.number().safe().int().optional(),
1706
- min_value: z4.number().safe().int().optional()
2557
+ var numericMixinIntegerOptionPredicate = z5.object({
2558
+ max_value: z5.number().safe().int().optional(),
2559
+ min_value: z5.number().safe().int().optional()
1707
2560
  });
1708
- var channelMixinOptionPredicate = z4.object({
1709
- channel_types: z4.union(
1710
- ApplicationCommandOptionAllowedChannelTypes.map((type) => z4.literal(type))
2561
+ var channelMixinOptionPredicate = z5.object({
2562
+ channel_types: z5.union(
2563
+ ApplicationCommandOptionAllowedChannelTypes.map((type) => z5.literal(type))
1711
2564
  ).array().optional()
1712
2565
  });
1713
- var autocompleteMixinOptionPredicate = z4.object({
1714
- autocomplete: z4.literal(true),
1715
- choices: z4.union([z4.never(), z4.never().array(), z4.undefined()])
2566
+ var autocompleteMixinOptionPredicate = z5.object({
2567
+ autocomplete: z5.literal(true),
2568
+ choices: z5.union([z5.never(), z5.never().array(), z5.undefined()])
1716
2569
  });
1717
- var choiceValueStringPredicate = z4.string().min(1).max(100);
1718
- var choiceValueNumberPredicate = z4.number().safe();
1719
- var choiceBasePredicate = z4.object({
2570
+ var choiceValueStringPredicate = z5.string().min(1).max(100);
2571
+ var choiceValueNumberPredicate = z5.number().safe();
2572
+ var choiceBasePredicate = z5.object({
1720
2573
  name: choiceValueStringPredicate,
1721
2574
  name_localizations: localeMapPredicate.optional()
1722
2575
  });
@@ -1726,8 +2579,8 @@ var choiceStringPredicate = choiceBasePredicate.extend({
1726
2579
  var choiceNumberPredicate = choiceBasePredicate.extend({
1727
2580
  value: choiceValueNumberPredicate
1728
2581
  });
1729
- var choiceBaseMixinPredicate = z4.object({
1730
- autocomplete: z4.literal(false).optional()
2582
+ var choiceBaseMixinPredicate = z5.object({
2583
+ autocomplete: z5.literal(false).optional()
1731
2584
  });
1732
2585
  var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
1733
2586
  choices: choiceStringPredicate.array().max(25).optional()
@@ -1746,18 +2599,18 @@ var basicOptionTypes = [
1746
2599
  ApplicationCommandOptionType.String,
1747
2600
  ApplicationCommandOptionType.User
1748
2601
  ];
1749
- var basicOptionTypesPredicate = z4.union(
1750
- basicOptionTypes.map((type) => z4.literal(type))
2602
+ var basicOptionTypesPredicate = z5.union(
2603
+ basicOptionTypes.map((type) => z5.literal(type))
1751
2604
  );
1752
2605
  var basicOptionPredicate = sharedNameAndDescriptionPredicate.extend({
1753
- required: z4.boolean().optional(),
2606
+ required: z5.boolean().optional(),
1754
2607
  type: basicOptionTypesPredicate
1755
2608
  });
1756
- var autocompleteOrStringChoicesMixinOptionPredicate = z4.discriminatedUnion("autocomplete", [
2609
+ var autocompleteOrStringChoicesMixinOptionPredicate = z5.discriminatedUnion("autocomplete", [
1757
2610
  autocompleteMixinOptionPredicate,
1758
2611
  choiceStringMixinPredicate
1759
2612
  ]);
1760
- var autocompleteOrNumberChoicesMixinOptionPredicate = z4.discriminatedUnion("autocomplete", [
2613
+ var autocompleteOrNumberChoicesMixinOptionPredicate = z5.discriminatedUnion("autocomplete", [
1761
2614
  autocompleteMixinOptionPredicate,
1762
2615
  choiceNumberMixinPredicate
1763
2616
  ]);
@@ -1765,30 +2618,30 @@ var channelOptionPredicate = basicOptionPredicate.merge(channelMixinOptionPredic
1765
2618
  var integerOptionPredicate = basicOptionPredicate.merge(numericMixinIntegerOptionPredicate).and(autocompleteOrNumberChoicesMixinOptionPredicate);
1766
2619
  var numberOptionPredicate = basicOptionPredicate.merge(numericMixinNumberOptionPredicate).and(autocompleteOrNumberChoicesMixinOptionPredicate);
1767
2620
  var stringOptionPredicate = basicOptionPredicate.extend({
1768
- max_length: z4.number().min(0).max(6e3).optional(),
1769
- min_length: z4.number().min(1).max(6e3).optional()
2621
+ max_length: z5.number().min(0).max(6e3).optional(),
2622
+ min_length: z5.number().min(1).max(6e3).optional()
1770
2623
  }).and(autocompleteOrStringChoicesMixinOptionPredicate);
1771
2624
  var baseChatInputCommandPredicate = sharedNameAndDescriptionPredicate.extend({
1772
- contexts: z4.array(z4.nativeEnum(InteractionContextType)).optional(),
2625
+ contexts: z5.array(z5.nativeEnum(InteractionContextType)).optional(),
1773
2626
  default_member_permissions: memberPermissionsPredicate.optional(),
1774
- integration_types: z4.array(z4.nativeEnum(ApplicationIntegrationType)).optional(),
1775
- nsfw: z4.boolean().optional()
2627
+ integration_types: z5.array(z5.nativeEnum(ApplicationIntegrationType)).optional(),
2628
+ nsfw: z5.boolean().optional()
1776
2629
  });
1777
- var chatInputCommandOptionsPredicate = z4.union([
1778
- z4.object({ type: basicOptionTypesPredicate }).array(),
1779
- z4.object({ type: z4.literal(ApplicationCommandOptionType.Subcommand) }).array(),
1780
- z4.object({ type: z4.literal(ApplicationCommandOptionType.SubcommandGroup) }).array()
2630
+ var chatInputCommandOptionsPredicate = z5.union([
2631
+ z5.object({ type: basicOptionTypesPredicate }).array(),
2632
+ z5.object({ type: z5.literal(ApplicationCommandOptionType.Subcommand) }).array(),
2633
+ z5.object({ type: z5.literal(ApplicationCommandOptionType.SubcommandGroup) }).array()
1781
2634
  ]);
1782
2635
  var chatInputCommandPredicate = baseChatInputCommandPredicate.extend({
1783
2636
  options: chatInputCommandOptionsPredicate.optional()
1784
2637
  });
1785
2638
  var chatInputCommandSubcommandGroupPredicate = sharedNameAndDescriptionPredicate.extend({
1786
- type: z4.literal(ApplicationCommandOptionType.SubcommandGroup),
1787
- options: z4.array(z4.object({ type: z4.literal(ApplicationCommandOptionType.Subcommand) })).min(1).max(25)
2639
+ type: z5.literal(ApplicationCommandOptionType.SubcommandGroup),
2640
+ options: z5.array(z5.object({ type: z5.literal(ApplicationCommandOptionType.Subcommand) })).min(1).max(25)
1788
2641
  });
1789
2642
  var chatInputCommandSubcommandPredicate = sharedNameAndDescriptionPredicate.extend({
1790
- type: z4.literal(ApplicationCommandOptionType.Subcommand),
1791
- options: z4.array(z4.object({ type: basicOptionTypesPredicate })).max(25)
2643
+ type: z5.literal(ApplicationCommandOptionType.Subcommand),
2644
+ options: z5.array(z5.object({ type: basicOptionTypesPredicate })).max(25)
1792
2645
  });
1793
2646
 
1794
2647
  // src/interactions/commands/chatInput/options/ApplicationCommandOptionBase.ts
@@ -2284,23 +3137,23 @@ var ChatInputCommandBuilder = class extends Mixin8(
2284
3137
 
2285
3138
  // src/interactions/commands/contextMenu/Assertions.ts
2286
3139
  import { ApplicationCommandType as ApplicationCommandType2, ApplicationIntegrationType as ApplicationIntegrationType2, InteractionContextType as InteractionContextType2 } from "discord-api-types/v10";
2287
- import { z as z5 } from "zod";
2288
- var namePredicate2 = z5.string().min(1).max(32).regex(/^(?:(?: *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}\p{Extended_Pictographic}\p{Emoji_Component}]) *)+$/u);
2289
- var contextsPredicate = z5.array(z5.nativeEnum(InteractionContextType2));
2290
- var integrationTypesPredicate = z5.array(z5.nativeEnum(ApplicationIntegrationType2));
2291
- var baseContextMenuCommandPredicate = z5.object({
3140
+ import { z as z6 } from "zod";
3141
+ var namePredicate2 = z6.string().min(1).max(32).regex(/^(?:(?: *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}\p{Extended_Pictographic}\p{Emoji_Component}]) *)+$/u);
3142
+ var contextsPredicate = z6.array(z6.nativeEnum(InteractionContextType2));
3143
+ var integrationTypesPredicate = z6.array(z6.nativeEnum(ApplicationIntegrationType2));
3144
+ var baseContextMenuCommandPredicate = z6.object({
2292
3145
  contexts: contextsPredicate.optional(),
2293
3146
  default_member_permissions: memberPermissionsPredicate.optional(),
2294
3147
  name: namePredicate2,
2295
3148
  name_localizations: localeMapPredicate.optional(),
2296
3149
  integration_types: integrationTypesPredicate.optional(),
2297
- nsfw: z5.boolean().optional()
3150
+ nsfw: z6.boolean().optional()
2298
3151
  });
2299
3152
  var userCommandPredicate = baseContextMenuCommandPredicate.extend({
2300
- type: z5.literal(ApplicationCommandType2.User)
3153
+ type: z6.literal(ApplicationCommandType2.User)
2301
3154
  });
2302
3155
  var messageCommandPredicate = baseContextMenuCommandPredicate.extend({
2303
- type: z5.literal(ApplicationCommandType2.Message)
3156
+ type: z6.literal(ApplicationCommandType2.Message)
2304
3157
  });
2305
3158
 
2306
3159
  // src/interactions/commands/contextMenu/ContextMenuCommand.ts
@@ -2352,15 +3205,15 @@ var UserContextCommandBuilder = class extends ContextMenuCommandBuilder {
2352
3205
  };
2353
3206
 
2354
3207
  // src/interactions/modals/Assertions.ts
2355
- import { ComponentType as ComponentType14 } from "discord-api-types/v10";
2356
- import { z as z6 } from "zod";
2357
- var titlePredicate = z6.string().min(1).max(45);
2358
- var modalPredicate = z6.object({
3208
+ import { ComponentType as ComponentType22 } from "discord-api-types/v10";
3209
+ import { z as z7 } from "zod";
3210
+ var titlePredicate = z7.string().min(1).max(45);
3211
+ var modalPredicate = z7.object({
2359
3212
  title: titlePredicate,
2360
3213
  custom_id: customIdPredicate,
2361
- components: z6.object({
2362
- type: z6.literal(ComponentType14.ActionRow),
2363
- components: z6.object({ type: z6.literal(ComponentType14.TextInput) }).array().length(1)
3214
+ components: z7.object({
3215
+ type: z7.literal(ComponentType22.ActionRow),
3216
+ components: z7.object({ type: z7.literal(ComponentType22.TextInput) }).array().length(1)
2364
3217
  }).array().min(1).max(5)
2365
3218
  });
2366
3219
 
@@ -2482,7 +3335,7 @@ var ModalBuilder = class {
2482
3335
  };
2483
3336
 
2484
3337
  // src/messages/embed/Assertions.ts
2485
- import { z as z7 } from "zod";
3338
+ import { z as z8 } from "zod";
2486
3339
 
2487
3340
  // src/util/componentUtil.ts
2488
3341
  function embedLength(data) {
@@ -2491,36 +3344,36 @@ function embedLength(data) {
2491
3344
  __name(embedLength, "embedLength");
2492
3345
 
2493
3346
  // src/messages/embed/Assertions.ts
2494
- var namePredicate3 = z7.string().max(256);
2495
- var URLPredicate = z7.string().url().refine(refineURLPredicate(["http:", "https:"]), { message: "Invalid protocol for URL. Must be http: or https:" });
2496
- var URLWithAttachmentProtocolPredicate = z7.string().url().refine(refineURLPredicate(["http:", "https:", "attachment:"]), {
3347
+ var namePredicate3 = z8.string().max(256);
3348
+ var URLPredicate = z8.string().url().refine(refineURLPredicate(["http:", "https:"]), { message: "Invalid protocol for URL. Must be http: or https:" });
3349
+ var URLWithAttachmentProtocolPredicate = z8.string().url().refine(refineURLPredicate(["http:", "https:", "attachment:"]), {
2497
3350
  message: "Invalid protocol for URL. Must be http:, https:, or attachment:"
2498
3351
  });
2499
- var embedFieldPredicate = z7.object({
3352
+ var embedFieldPredicate = z8.object({
2500
3353
  name: namePredicate3,
2501
- value: z7.string().max(1024),
2502
- inline: z7.boolean().optional()
3354
+ value: z8.string().max(1024),
3355
+ inline: z8.boolean().optional()
2503
3356
  });
2504
- var embedAuthorPredicate = z7.object({
3357
+ var embedAuthorPredicate = z8.object({
2505
3358
  name: namePredicate3.min(1),
2506
3359
  icon_url: URLWithAttachmentProtocolPredicate.optional(),
2507
3360
  url: URLPredicate.optional()
2508
3361
  });
2509
- var embedFooterPredicate = z7.object({
2510
- text: z7.string().min(1).max(2048),
3362
+ var embedFooterPredicate = z8.object({
3363
+ text: z8.string().min(1).max(2048),
2511
3364
  icon_url: URLWithAttachmentProtocolPredicate.optional()
2512
3365
  });
2513
- var embedPredicate = z7.object({
3366
+ var embedPredicate = z8.object({
2514
3367
  title: namePredicate3.min(1).optional(),
2515
- description: z7.string().min(1).max(4096).optional(),
3368
+ description: z8.string().min(1).max(4096).optional(),
2516
3369
  url: URLPredicate.optional(),
2517
- timestamp: z7.string().optional(),
2518
- color: z7.number().int().min(0).max(16777215).optional(),
3370
+ timestamp: z8.string().optional(),
3371
+ color: z8.number().int().min(0).max(16777215).optional(),
2519
3372
  footer: embedFooterPredicate.optional(),
2520
- image: z7.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
2521
- thumbnail: z7.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
3373
+ image: z8.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
3374
+ thumbnail: z8.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
2522
3375
  author: embedAuthorPredicate.optional(),
2523
- fields: z7.array(embedFieldPredicate).max(25).optional()
3376
+ fields: z8.array(embedFieldPredicate).max(25).optional()
2524
3377
  }).refine(
2525
3378
  (embed) => embed.title !== void 0 || embed.description !== void 0 || embed.fields !== void 0 && embed.fields.length > 0 || embed.footer !== void 0 || embed.author !== void 0 || embed.image !== void 0 || embed.thumbnail !== void 0,
2526
3379
  {
@@ -2996,19 +3849,19 @@ var EmbedBuilder = class {
2996
3849
 
2997
3850
  // src/messages/poll/Assertions.ts
2998
3851
  import { PollLayoutType } from "discord-api-types/v10";
2999
- import { z as z8 } from "zod";
3000
- var pollQuestionPredicate = z8.object({ text: z8.string().min(1).max(300) });
3001
- var pollAnswerMediaPredicate = z8.object({
3002
- text: z8.string().min(1).max(55),
3852
+ import { z as z9 } from "zod";
3853
+ var pollQuestionPredicate = z9.object({ text: z9.string().min(1).max(300) });
3854
+ var pollAnswerMediaPredicate = z9.object({
3855
+ text: z9.string().min(1).max(55),
3003
3856
  emoji: emojiPredicate.optional()
3004
3857
  });
3005
- var pollAnswerPredicate = z8.object({ poll_media: pollAnswerMediaPredicate });
3006
- var pollPredicate = z8.object({
3858
+ var pollAnswerPredicate = z9.object({ poll_media: pollAnswerMediaPredicate });
3859
+ var pollPredicate = z9.object({
3007
3860
  question: pollQuestionPredicate,
3008
- answers: z8.array(pollAnswerPredicate).min(1).max(10),
3009
- duration: z8.number().min(1).max(768).optional(),
3010
- allow_multiselect: z8.boolean().optional(),
3011
- layout_type: z8.nativeEnum(PollLayoutType).optional()
3861
+ answers: z9.array(pollAnswerPredicate).min(1).max(10),
3862
+ duration: z9.number().min(1).max(768).optional(),
3863
+ allow_multiselect: z9.boolean().optional(),
3864
+ layout_type: z9.nativeEnum(PollLayoutType).optional()
3012
3865
  });
3013
3866
 
3014
3867
  // src/messages/poll/PollMedia.ts
@@ -3333,60 +4186,91 @@ var PollBuilder = class {
3333
4186
  };
3334
4187
 
3335
4188
  // src/messages/Assertions.ts
3336
- import { AllowedMentionsTypes, ComponentType as ComponentType15, MessageReferenceType } from "discord-api-types/v10";
3337
- import { z as z9 } from "zod";
3338
- var attachmentPredicate = z9.object({
3339
- id: z9.union([z9.string(), z9.number()]),
3340
- description: z9.string().optional(),
3341
- duration_secs: z9.number().optional(),
3342
- filename: z9.string().optional(),
3343
- title: z9.string().optional(),
3344
- waveform: z9.string().optional()
4189
+ import { AllowedMentionsTypes, ComponentType as ComponentType23, MessageFlags, MessageReferenceType } from "discord-api-types/v10";
4190
+ import { z as z10 } from "zod";
4191
+ var attachmentPredicate = z10.object({
4192
+ id: z10.union([z10.string(), z10.number()]),
4193
+ description: z10.string().optional(),
4194
+ duration_secs: z10.number().optional(),
4195
+ filename: z10.string().optional(),
4196
+ title: z10.string().optional(),
4197
+ waveform: z10.string().optional()
3345
4198
  });
3346
- var allowedMentionPredicate = z9.object({
3347
- parse: z9.nativeEnum(AllowedMentionsTypes).array().optional(),
3348
- roles: z9.string().array().optional(),
3349
- users: z9.string().array().optional(),
3350
- replied_user: z9.boolean().optional()
4199
+ var allowedMentionPredicate = z10.object({
4200
+ parse: z10.nativeEnum(AllowedMentionsTypes).array().optional(),
4201
+ roles: z10.string().array().optional(),
4202
+ users: z10.string().array().optional(),
4203
+ replied_user: z10.boolean().optional()
3351
4204
  });
3352
- var messageReferencePredicate = z9.object({
3353
- channel_id: z9.string().optional(),
3354
- fail_if_not_exists: z9.boolean().optional(),
3355
- guild_id: z9.string().optional(),
3356
- message_id: z9.string(),
3357
- type: z9.nativeEnum(MessageReferenceType).optional()
4205
+ var messageReferencePredicate = z10.object({
4206
+ channel_id: z10.string().optional(),
4207
+ fail_if_not_exists: z10.boolean().optional(),
4208
+ guild_id: z10.string().optional(),
4209
+ message_id: z10.string(),
4210
+ type: z10.nativeEnum(MessageReferenceType).optional()
3358
4211
  });
3359
- var messagePredicate = z9.object({
3360
- content: z9.string().optional(),
3361
- nonce: z9.union([z9.string().max(25), z9.number()]).optional(),
3362
- tts: z9.boolean().optional(),
3363
- embeds: embedPredicate.array().max(10).optional(),
4212
+ var baseMessagePredicate = z10.object({
4213
+ nonce: z10.union([z10.string().max(25), z10.number()]).optional(),
4214
+ tts: z10.boolean().optional(),
3364
4215
  allowed_mentions: allowedMentionPredicate.optional(),
3365
4216
  message_reference: messageReferencePredicate.optional(),
3366
- // Partial validation here to ensure the components are valid,
3367
- // rest of the validation is done in the action row predicate
3368
- components: z9.object({
3369
- type: z9.literal(ComponentType15.ActionRow),
3370
- components: z9.object({
3371
- type: z9.union([
3372
- z9.literal(ComponentType15.Button),
3373
- z9.literal(ComponentType15.ChannelSelect),
3374
- z9.literal(ComponentType15.MentionableSelect),
3375
- z9.literal(ComponentType15.RoleSelect),
3376
- z9.literal(ComponentType15.StringSelect),
3377
- z9.literal(ComponentType15.UserSelect)
3378
- ])
3379
- }).array()
3380
- }).array().max(5).optional(),
3381
- sticker_ids: z9.array(z9.string()).min(0).max(3).optional(),
3382
4217
  attachments: attachmentPredicate.array().max(10).optional(),
3383
- flags: z9.number().optional(),
3384
- enforce_nonce: z9.boolean().optional(),
3385
- poll: pollPredicate.optional()
4218
+ enforce_nonce: z10.boolean().optional()
4219
+ });
4220
+ var basicActionRowPredicate = z10.object({
4221
+ type: z10.literal(ComponentType23.ActionRow),
4222
+ components: z10.object({
4223
+ type: z10.union([
4224
+ z10.literal(ComponentType23.Button),
4225
+ z10.literal(ComponentType23.ChannelSelect),
4226
+ z10.literal(ComponentType23.MentionableSelect),
4227
+ z10.literal(ComponentType23.RoleSelect),
4228
+ z10.literal(ComponentType23.StringSelect),
4229
+ z10.literal(ComponentType23.UserSelect)
4230
+ ])
4231
+ }).array()
4232
+ });
4233
+ var messageNoComponentsV2Predicate = baseMessagePredicate.extend({
4234
+ content: z10.string().optional(),
4235
+ embeds: embedPredicate.array().max(10).optional(),
4236
+ sticker_ids: z10.array(z10.string()).min(0).max(3).optional(),
4237
+ poll: pollPredicate.optional(),
4238
+ components: basicActionRowPredicate.array().max(5).optional(),
4239
+ flags: z10.number().optional().refine((flags) => {
4240
+ if (flags) {
4241
+ return (flags & MessageFlags.IsComponentsV2) === 0;
4242
+ }
4243
+ return true;
4244
+ })
3386
4245
  }).refine(
3387
4246
  (data) => data.content !== void 0 || data.embeds !== void 0 && data.embeds.length > 0 || data.poll !== void 0 || data.attachments !== void 0 && data.attachments.length > 0 || data.components !== void 0 && data.components.length > 0 || data.sticker_ids !== void 0 && data.sticker_ids.length > 0,
3388
- { message: "Messages must have content, embeds, a poll, attachments, components, or stickers" }
4247
+ { message: "Messages must have content, embeds, a poll, attachments, components or stickers" }
3389
4248
  );
4249
+ var allTopLevelComponentsPredicate = z10.union([
4250
+ basicActionRowPredicate,
4251
+ z10.object({
4252
+ type: z10.union([
4253
+ // Components v2
4254
+ z10.literal(ComponentType23.Container),
4255
+ z10.literal(ComponentType23.File),
4256
+ z10.literal(ComponentType23.MediaGallery),
4257
+ z10.literal(ComponentType23.Section),
4258
+ z10.literal(ComponentType23.Separator),
4259
+ z10.literal(ComponentType23.TextDisplay),
4260
+ z10.literal(ComponentType23.Thumbnail)
4261
+ ])
4262
+ })
4263
+ ]).array().min(1).max(10);
4264
+ var messageComponentsV2Predicate = baseMessagePredicate.extend({
4265
+ components: allTopLevelComponentsPredicate,
4266
+ flags: z10.number().refine((flags) => (flags & MessageFlags.IsComponentsV2) === MessageFlags.IsComponentsV2),
4267
+ // These fields cannot be set
4268
+ content: z10.string().length(0).nullish(),
4269
+ embeds: z10.array(z10.never()).nullish(),
4270
+ sticker_ids: z10.array(z10.never()).nullish(),
4271
+ poll: z10.null().optional()
4272
+ });
4273
+ var messagePredicate = z10.union([messageNoComponentsV2Predicate, messageComponentsV2Predicate]);
3390
4274
 
3391
4275
  // src/messages/AllowedMentions.ts
3392
4276
  var AllowedMentionsBuilder = class {
@@ -3780,9 +4664,7 @@ var MessageBuilder = class {
3780
4664
  attachments: data.attachments?.map((attachment) => new AttachmentBuilder(attachment)) ?? [],
3781
4665
  embeds: data.embeds?.map((embed) => new EmbedBuilder(embed)) ?? [],
3782
4666
  poll: data.poll ? new PollBuilder(data.poll) : void 0,
3783
- components: data.components?.map(
3784
- (component) => new ActionRowBuilder(component)
3785
- ) ?? [],
4667
+ components: data.components?.map((component) => createComponentBuilder(component)) ?? [],
3786
4668
  message_reference: data.message_reference ? new MessageReferenceBuilder(data.message_reference) : void 0
3787
4669
  };
3788
4670
  }
@@ -3939,16 +4821,82 @@ var MessageBuilder = class {
3939
4821
  return this;
3940
4822
  }
3941
4823
  /**
3942
- * Adds components to this message.
4824
+ * Adds action row components to this message.
3943
4825
  *
3944
- * @param components - The components to add
4826
+ * @param components - The action row components to add
3945
4827
  */
3946
- addComponents(...components) {
4828
+ addActionRowComponents(...components) {
3947
4829
  this.data.components ??= [];
3948
4830
  const resolved = normalizeArray(components).map((component) => resolveBuilder(component, ActionRowBuilder));
3949
4831
  this.data.components.push(...resolved);
3950
4832
  return this;
3951
4833
  }
4834
+ /**
4835
+ * Adds container components to this message.
4836
+ *
4837
+ * @param components - The container components to add
4838
+ */
4839
+ addContainerComponents(...components) {
4840
+ this.data.components ??= [];
4841
+ const resolved = normalizeArray(components).map((component) => resolveBuilder(component, ContainerBuilder));
4842
+ this.data.components.push(...resolved);
4843
+ return this;
4844
+ }
4845
+ /**
4846
+ * Adds file components to this message.
4847
+ *
4848
+ * @param components - The file components to add
4849
+ */
4850
+ addFileComponents(...components) {
4851
+ this.data.components ??= [];
4852
+ const resolved = normalizeArray(components).map((component) => resolveBuilder(component, FileBuilder));
4853
+ this.data.components.push(...resolved);
4854
+ return this;
4855
+ }
4856
+ /**
4857
+ * Adds media gallery components to this message.
4858
+ *
4859
+ * @param components - The media gallery components to add
4860
+ */
4861
+ addMediaGalleryComponents(...components) {
4862
+ this.data.components ??= [];
4863
+ const resolved = normalizeArray(components).map((component) => resolveBuilder(component, MediaGalleryBuilder));
4864
+ this.data.components.push(...resolved);
4865
+ return this;
4866
+ }
4867
+ /**
4868
+ * Adds section components to this message.
4869
+ *
4870
+ * @param components - The section components to add
4871
+ */
4872
+ addSectionComponents(...components) {
4873
+ this.data.components ??= [];
4874
+ const resolved = normalizeArray(components).map((component) => resolveBuilder(component, SectionBuilder));
4875
+ this.data.components.push(...resolved);
4876
+ return this;
4877
+ }
4878
+ /**
4879
+ * Adds separator components to this message.
4880
+ *
4881
+ * @param components - The separator components to add
4882
+ */
4883
+ addSeparatorComponents(...components) {
4884
+ this.data.components ??= [];
4885
+ const resolved = normalizeArray(components).map((component) => resolveBuilder(component, SeparatorBuilder));
4886
+ this.data.components.push(...resolved);
4887
+ return this;
4888
+ }
4889
+ /**
4890
+ * Adds text display components to this message.
4891
+ *
4892
+ * @param components - The text display components to add
4893
+ */
4894
+ addTextDisplayComponents(...components) {
4895
+ this.data.components ??= [];
4896
+ const resolved = normalizeArray(components).map((component) => resolveBuilder(component, TextDisplayBuilder));
4897
+ this.data.components.push(...resolved);
4898
+ return this;
4899
+ }
3952
4900
  /**
3953
4901
  * Removes, replaces, or inserts components for this message.
3954
4902
  *
@@ -3979,19 +4927,12 @@ var MessageBuilder = class {
3979
4927
  */
3980
4928
  spliceComponents(start, deleteCount, ...components) {
3981
4929
  this.data.components ??= [];
3982
- const resolved = normalizeArray(components).map((component) => resolveBuilder(component, ActionRowBuilder));
4930
+ const resolved = normalizeArray(components).map(
4931
+ (component) => component instanceof ComponentBuilder ? component : createComponentBuilder(component)
4932
+ );
3983
4933
  this.data.components.splice(start, deleteCount, ...resolved);
3984
4934
  return this;
3985
4935
  }
3986
- /**
3987
- * Sets the components of this message.
3988
- *
3989
- * @param components - The components to set
3990
- */
3991
- setComponents(...components) {
3992
- this.data.components = normalizeArray(components).map((component) => resolveBuilder(component, ActionRowBuilder));
3993
- return this;
3994
- }
3995
4936
  /**
3996
4937
  * Sets the sticker ids of this message.
3997
4938
  *
@@ -4169,7 +5110,7 @@ var MessageBuilder = class {
4169
5110
  };
4170
5111
 
4171
5112
  // src/index.ts
4172
- var version = "2.0.0-dev.1745367189-42ce11622";
5113
+ var version = "2.0.0-dev.1745453588-abc5d99ce";
4173
5114
  export {
4174
5115
  ActionRowBuilder,
4175
5116
  AllowedMentionsBuilder,
@@ -4205,7 +5146,10 @@ export {
4205
5146
  EmbedFieldBuilder,
4206
5147
  EmbedFooterBuilder,
4207
5148
  EmojiOrLabelButtonMixin,
5149
+ FileBuilder,
4208
5150
  LinkButtonBuilder,
5151
+ MediaGalleryBuilder,
5152
+ MediaGalleryItemBuilder,
4209
5153
  MentionableSelectMenuBuilder,
4210
5154
  MessageBuilder,
4211
5155
  MessageContextCommandBuilder,
@@ -4220,6 +5164,8 @@ export {
4220
5164
  PrimaryButtonBuilder,
4221
5165
  RoleSelectMenuBuilder,
4222
5166
  SecondaryButtonBuilder,
5167
+ SectionBuilder,
5168
+ SeparatorBuilder,
4223
5169
  SharedChatInputCommandOptions,
4224
5170
  SharedChatInputCommandSubcommands,
4225
5171
  SharedName,
@@ -4227,7 +5173,9 @@ export {
4227
5173
  StringSelectMenuBuilder,
4228
5174
  StringSelectMenuOptionBuilder,
4229
5175
  SuccessButtonBuilder,
5176
+ TextDisplayBuilder,
4230
5177
  TextInputBuilder,
5178
+ ThumbnailBuilder,
4231
5179
  UserContextCommandBuilder,
4232
5180
  UserSelectMenuBuilder,
4233
5181
  actionRowPredicate,
@@ -4239,6 +5187,7 @@ export {
4239
5187
  chatInputCommandPredicate,
4240
5188
  chatInputCommandSubcommandGroupPredicate,
4241
5189
  chatInputCommandSubcommandPredicate,
5190
+ containerPredicate,
4242
5191
  createComponentBuilder,
4243
5192
  customIdPredicate,
4244
5193
  disableValidators,
@@ -4249,9 +5198,12 @@ export {
4249
5198
  embedPredicate,
4250
5199
  emojiPredicate,
4251
5200
  enableValidators,
5201
+ filePredicate,
4252
5202
  integerOptionPredicate,
4253
5203
  isValidationEnabled,
4254
5204
  localeMapPredicate,
5205
+ mediaGalleryItemPredicate,
5206
+ mediaGalleryPredicate,
4255
5207
  memberPermissionsPredicate,
4256
5208
  messageCommandPredicate,
4257
5209
  messagePredicate,
@@ -4264,15 +5216,20 @@ export {
4264
5216
  pollPredicate,
4265
5217
  pollQuestionPredicate,
4266
5218
  refineURLPredicate,
5219
+ resolveAccessoryComponent,
4267
5220
  resolveBuilder,
5221
+ sectionPredicate,
4268
5222
  selectMenuChannelPredicate,
4269
5223
  selectMenuMentionablePredicate,
4270
5224
  selectMenuRolePredicate,
4271
5225
  selectMenuStringOptionPredicate,
4272
5226
  selectMenuStringPredicate,
4273
5227
  selectMenuUserPredicate,
5228
+ separatorPredicate,
4274
5229
  stringOptionPredicate,
5230
+ textDisplayPredicate,
4275
5231
  textInputPredicate,
5232
+ thumbnailPredicate,
4276
5233
  userCommandPredicate,
4277
5234
  validate,
4278
5235
  version