@discordjs/builders 2.0.0-dev.1745194448-8f35dfd03 → 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
@@ -954,229 +970,1077 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
954
970
  /**
955
971
  * Adds default users to this auto populated select menu.
956
972
  *
957
- * @param users - The users to add
973
+ * @param users - The users to add
974
+ */
975
+ addDefaultUsers(...users) {
976
+ const normalizedValues = normalizeArray(users);
977
+ this.data.default_values ??= [];
978
+ this.data.default_values.push(
979
+ ...normalizedValues.map((id) => ({
980
+ id,
981
+ type: SelectMenuDefaultValueType5.User
982
+ }))
983
+ );
984
+ return this;
985
+ }
986
+ /**
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
958
1749
  */
959
- addDefaultUsers(...users) {
960
- const normalizedValues = normalizeArray(users);
961
- this.data.default_values ??= [];
962
- this.data.default_values.push(
963
- ...normalizedValues.map((id) => ({
964
- id,
965
- type: SelectMenuDefaultValueType5.User
966
- }))
967
- );
1750
+ setThumbnailAccessory(input) {
1751
+ const builder = resolveBuilder(input, ThumbnailBuilder);
1752
+ this.data.accessory = builder;
968
1753
  return this;
969
1754
  }
970
1755
  /**
971
- * Sets default users for this auto populated select menu.
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);
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);
1180
2044
  default:
1181
2045
  throw new Error(`Cannot properly serialize component type: ${data.type}`);
1182
2046
  }
@@ -1201,6 +2065,17 @@ function createButtonBuilder(data) {
1201
2065
  }
1202
2066
  }
1203
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");
1204
2079
 
1205
2080
  // src/components/ActionRow.ts
1206
2081
  var ActionRowBuilder = class extends ComponentBuilder {
@@ -1252,7 +2127,7 @@ var ActionRowBuilder = class extends ComponentBuilder {
1252
2127
  super();
1253
2128
  this.data = {
1254
2129
  ...structuredClone(data),
1255
- type: ComponentType13.ActionRow,
2130
+ type: ComponentType21.ActionRow,
1256
2131
  components: components.map((component) => createComponentBuilder(component))
1257
2132
  };
1258
2133
  }
@@ -1666,35 +2541,35 @@ import {
1666
2541
  InteractionContextType,
1667
2542
  ApplicationCommandOptionType
1668
2543
  } from "discord-api-types/v10";
1669
- import { z as z4 } from "zod";
1670
- var namePredicate = z4.string().min(1).max(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
1671
- var descriptionPredicate = z4.string().min(1).max(100);
1672
- 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({
1673
2548
  name: namePredicate,
1674
2549
  name_localizations: localeMapPredicate.optional(),
1675
2550
  description: descriptionPredicate,
1676
2551
  description_localizations: localeMapPredicate.optional()
1677
2552
  });
1678
- var numericMixinNumberOptionPredicate = z4.object({
1679
- max_value: z4.number().safe().optional(),
1680
- 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()
1681
2556
  });
1682
- var numericMixinIntegerOptionPredicate = z4.object({
1683
- max_value: z4.number().safe().int().optional(),
1684
- 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()
1685
2560
  });
1686
- var channelMixinOptionPredicate = z4.object({
1687
- channel_types: z4.union(
1688
- ApplicationCommandOptionAllowedChannelTypes.map((type) => z4.literal(type))
2561
+ var channelMixinOptionPredicate = z5.object({
2562
+ channel_types: z5.union(
2563
+ ApplicationCommandOptionAllowedChannelTypes.map((type) => z5.literal(type))
1689
2564
  ).array().optional()
1690
2565
  });
1691
- var autocompleteMixinOptionPredicate = z4.object({
1692
- autocomplete: z4.literal(true),
1693
- 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()])
1694
2569
  });
1695
- var choiceValueStringPredicate = z4.string().min(1).max(100);
1696
- var choiceValueNumberPredicate = z4.number().safe();
1697
- var choiceBasePredicate = z4.object({
2570
+ var choiceValueStringPredicate = z5.string().min(1).max(100);
2571
+ var choiceValueNumberPredicate = z5.number().safe();
2572
+ var choiceBasePredicate = z5.object({
1698
2573
  name: choiceValueStringPredicate,
1699
2574
  name_localizations: localeMapPredicate.optional()
1700
2575
  });
@@ -1704,8 +2579,8 @@ var choiceStringPredicate = choiceBasePredicate.extend({
1704
2579
  var choiceNumberPredicate = choiceBasePredicate.extend({
1705
2580
  value: choiceValueNumberPredicate
1706
2581
  });
1707
- var choiceBaseMixinPredicate = z4.object({
1708
- autocomplete: z4.literal(false).optional()
2582
+ var choiceBaseMixinPredicate = z5.object({
2583
+ autocomplete: z5.literal(false).optional()
1709
2584
  });
1710
2585
  var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
1711
2586
  choices: choiceStringPredicate.array().max(25).optional()
@@ -1724,18 +2599,18 @@ var basicOptionTypes = [
1724
2599
  ApplicationCommandOptionType.String,
1725
2600
  ApplicationCommandOptionType.User
1726
2601
  ];
1727
- var basicOptionTypesPredicate = z4.union(
1728
- basicOptionTypes.map((type) => z4.literal(type))
2602
+ var basicOptionTypesPredicate = z5.union(
2603
+ basicOptionTypes.map((type) => z5.literal(type))
1729
2604
  );
1730
2605
  var basicOptionPredicate = sharedNameAndDescriptionPredicate.extend({
1731
- required: z4.boolean().optional(),
2606
+ required: z5.boolean().optional(),
1732
2607
  type: basicOptionTypesPredicate
1733
2608
  });
1734
- var autocompleteOrStringChoicesMixinOptionPredicate = z4.discriminatedUnion("autocomplete", [
2609
+ var autocompleteOrStringChoicesMixinOptionPredicate = z5.discriminatedUnion("autocomplete", [
1735
2610
  autocompleteMixinOptionPredicate,
1736
2611
  choiceStringMixinPredicate
1737
2612
  ]);
1738
- var autocompleteOrNumberChoicesMixinOptionPredicate = z4.discriminatedUnion("autocomplete", [
2613
+ var autocompleteOrNumberChoicesMixinOptionPredicate = z5.discriminatedUnion("autocomplete", [
1739
2614
  autocompleteMixinOptionPredicate,
1740
2615
  choiceNumberMixinPredicate
1741
2616
  ]);
@@ -1743,30 +2618,30 @@ var channelOptionPredicate = basicOptionPredicate.merge(channelMixinOptionPredic
1743
2618
  var integerOptionPredicate = basicOptionPredicate.merge(numericMixinIntegerOptionPredicate).and(autocompleteOrNumberChoicesMixinOptionPredicate);
1744
2619
  var numberOptionPredicate = basicOptionPredicate.merge(numericMixinNumberOptionPredicate).and(autocompleteOrNumberChoicesMixinOptionPredicate);
1745
2620
  var stringOptionPredicate = basicOptionPredicate.extend({
1746
- max_length: z4.number().min(0).max(6e3).optional(),
1747
- 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()
1748
2623
  }).and(autocompleteOrStringChoicesMixinOptionPredicate);
1749
2624
  var baseChatInputCommandPredicate = sharedNameAndDescriptionPredicate.extend({
1750
- contexts: z4.array(z4.nativeEnum(InteractionContextType)).optional(),
2625
+ contexts: z5.array(z5.nativeEnum(InteractionContextType)).optional(),
1751
2626
  default_member_permissions: memberPermissionsPredicate.optional(),
1752
- integration_types: z4.array(z4.nativeEnum(ApplicationIntegrationType)).optional(),
1753
- nsfw: z4.boolean().optional()
2627
+ integration_types: z5.array(z5.nativeEnum(ApplicationIntegrationType)).optional(),
2628
+ nsfw: z5.boolean().optional()
1754
2629
  });
1755
- var chatInputCommandOptionsPredicate = z4.union([
1756
- z4.object({ type: basicOptionTypesPredicate }).array(),
1757
- z4.object({ type: z4.literal(ApplicationCommandOptionType.Subcommand) }).array(),
1758
- 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()
1759
2634
  ]);
1760
2635
  var chatInputCommandPredicate = baseChatInputCommandPredicate.extend({
1761
2636
  options: chatInputCommandOptionsPredicate.optional()
1762
2637
  });
1763
2638
  var chatInputCommandSubcommandGroupPredicate = sharedNameAndDescriptionPredicate.extend({
1764
- type: z4.literal(ApplicationCommandOptionType.SubcommandGroup),
1765
- 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)
1766
2641
  });
1767
2642
  var chatInputCommandSubcommandPredicate = sharedNameAndDescriptionPredicate.extend({
1768
- type: z4.literal(ApplicationCommandOptionType.Subcommand),
1769
- 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)
1770
2645
  });
1771
2646
 
1772
2647
  // src/interactions/commands/chatInput/options/ApplicationCommandOptionBase.ts
@@ -2262,23 +3137,23 @@ var ChatInputCommandBuilder = class extends Mixin8(
2262
3137
 
2263
3138
  // src/interactions/commands/contextMenu/Assertions.ts
2264
3139
  import { ApplicationCommandType as ApplicationCommandType2, ApplicationIntegrationType as ApplicationIntegrationType2, InteractionContextType as InteractionContextType2 } from "discord-api-types/v10";
2265
- import { z as z5 } from "zod";
2266
- 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);
2267
- var contextsPredicate = z5.array(z5.nativeEnum(InteractionContextType2));
2268
- var integrationTypesPredicate = z5.array(z5.nativeEnum(ApplicationIntegrationType2));
2269
- 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({
2270
3145
  contexts: contextsPredicate.optional(),
2271
3146
  default_member_permissions: memberPermissionsPredicate.optional(),
2272
3147
  name: namePredicate2,
2273
3148
  name_localizations: localeMapPredicate.optional(),
2274
3149
  integration_types: integrationTypesPredicate.optional(),
2275
- nsfw: z5.boolean().optional()
3150
+ nsfw: z6.boolean().optional()
2276
3151
  });
2277
3152
  var userCommandPredicate = baseContextMenuCommandPredicate.extend({
2278
- type: z5.literal(ApplicationCommandType2.User)
3153
+ type: z6.literal(ApplicationCommandType2.User)
2279
3154
  });
2280
3155
  var messageCommandPredicate = baseContextMenuCommandPredicate.extend({
2281
- type: z5.literal(ApplicationCommandType2.Message)
3156
+ type: z6.literal(ApplicationCommandType2.Message)
2282
3157
  });
2283
3158
 
2284
3159
  // src/interactions/commands/contextMenu/ContextMenuCommand.ts
@@ -2330,15 +3205,15 @@ var UserContextCommandBuilder = class extends ContextMenuCommandBuilder {
2330
3205
  };
2331
3206
 
2332
3207
  // src/interactions/modals/Assertions.ts
2333
- import { ComponentType as ComponentType14 } from "discord-api-types/v10";
2334
- import { z as z6 } from "zod";
2335
- var titlePredicate = z6.string().min(1).max(45);
2336
- 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({
2337
3212
  title: titlePredicate,
2338
3213
  custom_id: customIdPredicate,
2339
- components: z6.object({
2340
- type: z6.literal(ComponentType14.ActionRow),
2341
- 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)
2342
3217
  }).array().min(1).max(5)
2343
3218
  });
2344
3219
 
@@ -2460,7 +3335,7 @@ var ModalBuilder = class {
2460
3335
  };
2461
3336
 
2462
3337
  // src/messages/embed/Assertions.ts
2463
- import { z as z7 } from "zod";
3338
+ import { z as z8 } from "zod";
2464
3339
 
2465
3340
  // src/util/componentUtil.ts
2466
3341
  function embedLength(data) {
@@ -2469,36 +3344,36 @@ function embedLength(data) {
2469
3344
  __name(embedLength, "embedLength");
2470
3345
 
2471
3346
  // src/messages/embed/Assertions.ts
2472
- var namePredicate3 = z7.string().max(256);
2473
- var URLPredicate = z7.string().url().refine(refineURLPredicate(["http:", "https:"]), { message: "Invalid protocol for URL. Must be http: or https:" });
2474
- 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:"]), {
2475
3350
  message: "Invalid protocol for URL. Must be http:, https:, or attachment:"
2476
3351
  });
2477
- var embedFieldPredicate = z7.object({
3352
+ var embedFieldPredicate = z8.object({
2478
3353
  name: namePredicate3,
2479
- value: z7.string().max(1024),
2480
- inline: z7.boolean().optional()
3354
+ value: z8.string().max(1024),
3355
+ inline: z8.boolean().optional()
2481
3356
  });
2482
- var embedAuthorPredicate = z7.object({
3357
+ var embedAuthorPredicate = z8.object({
2483
3358
  name: namePredicate3.min(1),
2484
3359
  icon_url: URLWithAttachmentProtocolPredicate.optional(),
2485
3360
  url: URLPredicate.optional()
2486
3361
  });
2487
- var embedFooterPredicate = z7.object({
2488
- text: z7.string().min(1).max(2048),
3362
+ var embedFooterPredicate = z8.object({
3363
+ text: z8.string().min(1).max(2048),
2489
3364
  icon_url: URLWithAttachmentProtocolPredicate.optional()
2490
3365
  });
2491
- var embedPredicate = z7.object({
3366
+ var embedPredicate = z8.object({
2492
3367
  title: namePredicate3.min(1).optional(),
2493
- description: z7.string().min(1).max(4096).optional(),
3368
+ description: z8.string().min(1).max(4096).optional(),
2494
3369
  url: URLPredicate.optional(),
2495
- timestamp: z7.string().optional(),
2496
- color: z7.number().int().min(0).max(16777215).optional(),
3370
+ timestamp: z8.string().optional(),
3371
+ color: z8.number().int().min(0).max(16777215).optional(),
2497
3372
  footer: embedFooterPredicate.optional(),
2498
- image: z7.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
2499
- thumbnail: z7.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
3373
+ image: z8.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
3374
+ thumbnail: z8.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
2500
3375
  author: embedAuthorPredicate.optional(),
2501
- fields: z7.array(embedFieldPredicate).max(25).optional()
3376
+ fields: z8.array(embedFieldPredicate).max(25).optional()
2502
3377
  }).refine(
2503
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,
2504
3379
  {
@@ -2974,19 +3849,19 @@ var EmbedBuilder = class {
2974
3849
 
2975
3850
  // src/messages/poll/Assertions.ts
2976
3851
  import { PollLayoutType } from "discord-api-types/v10";
2977
- import { z as z8 } from "zod";
2978
- var pollQuestionPredicate = z8.object({ text: z8.string().min(1).max(300) });
2979
- var pollAnswerMediaPredicate = z8.object({
2980
- 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),
2981
3856
  emoji: emojiPredicate.optional()
2982
3857
  });
2983
- var pollAnswerPredicate = z8.object({ poll_media: pollAnswerMediaPredicate });
2984
- var pollPredicate = z8.object({
3858
+ var pollAnswerPredicate = z9.object({ poll_media: pollAnswerMediaPredicate });
3859
+ var pollPredicate = z9.object({
2985
3860
  question: pollQuestionPredicate,
2986
- answers: z8.array(pollAnswerPredicate).min(1).max(10),
2987
- duration: z8.number().min(1).max(768).optional(),
2988
- allow_multiselect: z8.boolean().optional(),
2989
- 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()
2990
3865
  });
2991
3866
 
2992
3867
  // src/messages/poll/PollMedia.ts
@@ -3311,60 +4186,91 @@ var PollBuilder = class {
3311
4186
  };
3312
4187
 
3313
4188
  // src/messages/Assertions.ts
3314
- import { AllowedMentionsTypes, ComponentType as ComponentType15, MessageReferenceType } from "discord-api-types/v10";
3315
- import { z as z9 } from "zod";
3316
- var attachmentPredicate = z9.object({
3317
- id: z9.union([z9.string(), z9.number()]),
3318
- description: z9.string().optional(),
3319
- duration_secs: z9.number().optional(),
3320
- filename: z9.string().optional(),
3321
- title: z9.string().optional(),
3322
- 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()
3323
4198
  });
3324
- var allowedMentionPredicate = z9.object({
3325
- parse: z9.nativeEnum(AllowedMentionsTypes).array().optional(),
3326
- roles: z9.string().array().optional(),
3327
- users: z9.string().array().optional(),
3328
- 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()
3329
4204
  });
3330
- var messageReferencePredicate = z9.object({
3331
- channel_id: z9.string().optional(),
3332
- fail_if_not_exists: z9.boolean().optional(),
3333
- guild_id: z9.string().optional(),
3334
- message_id: z9.string(),
3335
- 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()
3336
4211
  });
3337
- var messagePredicate = z9.object({
3338
- content: z9.string().optional(),
3339
- nonce: z9.union([z9.string().max(25), z9.number()]).optional(),
3340
- tts: z9.boolean().optional(),
3341
- 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(),
3342
4215
  allowed_mentions: allowedMentionPredicate.optional(),
3343
4216
  message_reference: messageReferencePredicate.optional(),
3344
- // Partial validation here to ensure the components are valid,
3345
- // rest of the validation is done in the action row predicate
3346
- components: z9.object({
3347
- type: z9.literal(ComponentType15.ActionRow),
3348
- components: z9.object({
3349
- type: z9.union([
3350
- z9.literal(ComponentType15.Button),
3351
- z9.literal(ComponentType15.ChannelSelect),
3352
- z9.literal(ComponentType15.MentionableSelect),
3353
- z9.literal(ComponentType15.RoleSelect),
3354
- z9.literal(ComponentType15.StringSelect),
3355
- z9.literal(ComponentType15.UserSelect)
3356
- ])
3357
- }).array()
3358
- }).array().max(5).optional(),
3359
- sticker_ids: z9.array(z9.string()).min(0).max(3).optional(),
3360
4217
  attachments: attachmentPredicate.array().max(10).optional(),
3361
- flags: z9.number().optional(),
3362
- enforce_nonce: z9.boolean().optional(),
3363
- 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
+ })
3364
4245
  }).refine(
3365
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,
3366
- { 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" }
3367
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]);
3368
4274
 
3369
4275
  // src/messages/AllowedMentions.ts
3370
4276
  var AllowedMentionsBuilder = class {
@@ -3758,7 +4664,7 @@ var MessageBuilder = class {
3758
4664
  attachments: data.attachments?.map((attachment) => new AttachmentBuilder(attachment)) ?? [],
3759
4665
  embeds: data.embeds?.map((embed) => new EmbedBuilder(embed)) ?? [],
3760
4666
  poll: data.poll ? new PollBuilder(data.poll) : void 0,
3761
- components: data.components?.map((component) => new ActionRowBuilder(component)) ?? [],
4667
+ components: data.components?.map((component) => createComponentBuilder(component)) ?? [],
3762
4668
  message_reference: data.message_reference ? new MessageReferenceBuilder(data.message_reference) : void 0
3763
4669
  };
3764
4670
  }
@@ -3915,16 +4821,82 @@ var MessageBuilder = class {
3915
4821
  return this;
3916
4822
  }
3917
4823
  /**
3918
- * Adds components to this message.
4824
+ * Adds action row components to this message.
3919
4825
  *
3920
- * @param components - The components to add
4826
+ * @param components - The action row components to add
3921
4827
  */
3922
- addComponents(...components) {
4828
+ addActionRowComponents(...components) {
3923
4829
  this.data.components ??= [];
3924
4830
  const resolved = normalizeArray(components).map((component) => resolveBuilder(component, ActionRowBuilder));
3925
4831
  this.data.components.push(...resolved);
3926
4832
  return this;
3927
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
+ }
3928
4900
  /**
3929
4901
  * Removes, replaces, or inserts components for this message.
3930
4902
  *
@@ -3955,19 +4927,12 @@ var MessageBuilder = class {
3955
4927
  */
3956
4928
  spliceComponents(start, deleteCount, ...components) {
3957
4929
  this.data.components ??= [];
3958
- const resolved = normalizeArray(components).map((component) => resolveBuilder(component, ActionRowBuilder));
4930
+ const resolved = normalizeArray(components).map(
4931
+ (component) => component instanceof ComponentBuilder ? component : createComponentBuilder(component)
4932
+ );
3959
4933
  this.data.components.splice(start, deleteCount, ...resolved);
3960
4934
  return this;
3961
4935
  }
3962
- /**
3963
- * Sets the components of this message.
3964
- *
3965
- * @param components - The components to set
3966
- */
3967
- setComponents(...components) {
3968
- this.data.components = normalizeArray(components).map((component) => resolveBuilder(component, ActionRowBuilder));
3969
- return this;
3970
- }
3971
4936
  /**
3972
4937
  * Sets the sticker ids of this message.
3973
4938
  *
@@ -4145,7 +5110,7 @@ var MessageBuilder = class {
4145
5110
  };
4146
5111
 
4147
5112
  // src/index.ts
4148
- var version = "2.0.0-dev.1745194448-8f35dfd03";
5113
+ var version = "2.0.0-dev.1745453588-abc5d99ce";
4149
5114
  export {
4150
5115
  ActionRowBuilder,
4151
5116
  AllowedMentionsBuilder,
@@ -4181,7 +5146,10 @@ export {
4181
5146
  EmbedFieldBuilder,
4182
5147
  EmbedFooterBuilder,
4183
5148
  EmojiOrLabelButtonMixin,
5149
+ FileBuilder,
4184
5150
  LinkButtonBuilder,
5151
+ MediaGalleryBuilder,
5152
+ MediaGalleryItemBuilder,
4185
5153
  MentionableSelectMenuBuilder,
4186
5154
  MessageBuilder,
4187
5155
  MessageContextCommandBuilder,
@@ -4196,6 +5164,8 @@ export {
4196
5164
  PrimaryButtonBuilder,
4197
5165
  RoleSelectMenuBuilder,
4198
5166
  SecondaryButtonBuilder,
5167
+ SectionBuilder,
5168
+ SeparatorBuilder,
4199
5169
  SharedChatInputCommandOptions,
4200
5170
  SharedChatInputCommandSubcommands,
4201
5171
  SharedName,
@@ -4203,7 +5173,9 @@ export {
4203
5173
  StringSelectMenuBuilder,
4204
5174
  StringSelectMenuOptionBuilder,
4205
5175
  SuccessButtonBuilder,
5176
+ TextDisplayBuilder,
4206
5177
  TextInputBuilder,
5178
+ ThumbnailBuilder,
4207
5179
  UserContextCommandBuilder,
4208
5180
  UserSelectMenuBuilder,
4209
5181
  actionRowPredicate,
@@ -4215,6 +5187,7 @@ export {
4215
5187
  chatInputCommandPredicate,
4216
5188
  chatInputCommandSubcommandGroupPredicate,
4217
5189
  chatInputCommandSubcommandPredicate,
5190
+ containerPredicate,
4218
5191
  createComponentBuilder,
4219
5192
  customIdPredicate,
4220
5193
  disableValidators,
@@ -4225,9 +5198,12 @@ export {
4225
5198
  embedPredicate,
4226
5199
  emojiPredicate,
4227
5200
  enableValidators,
5201
+ filePredicate,
4228
5202
  integerOptionPredicate,
4229
5203
  isValidationEnabled,
4230
5204
  localeMapPredicate,
5205
+ mediaGalleryItemPredicate,
5206
+ mediaGalleryPredicate,
4231
5207
  memberPermissionsPredicate,
4232
5208
  messageCommandPredicate,
4233
5209
  messagePredicate,
@@ -4240,15 +5216,20 @@ export {
4240
5216
  pollPredicate,
4241
5217
  pollQuestionPredicate,
4242
5218
  refineURLPredicate,
5219
+ resolveAccessoryComponent,
4243
5220
  resolveBuilder,
5221
+ sectionPredicate,
4244
5222
  selectMenuChannelPredicate,
4245
5223
  selectMenuMentionablePredicate,
4246
5224
  selectMenuRolePredicate,
4247
5225
  selectMenuStringOptionPredicate,
4248
5226
  selectMenuStringPredicate,
4249
5227
  selectMenuUserPredicate,
5228
+ separatorPredicate,
4250
5229
  stringOptionPredicate,
5230
+ textDisplayPredicate,
4251
5231
  textInputPredicate,
5232
+ thumbnailPredicate,
4252
5233
  userCommandPredicate,
4253
5234
  validate,
4254
5235
  version