@discordjs/builders 2.0.0-dev.1761523318-4c0d66777 → 2.0.0-move-client-init.1761650119-a4c0a246f
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.d.mts +5 -108
- package/dist/index.d.ts +5 -108
- package/dist/index.js +309 -434
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +244 -367
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -382,119 +382,8 @@ var PremiumButtonBuilder = class extends BaseButtonBuilder {
|
|
|
382
382
|
}
|
|
383
383
|
};
|
|
384
384
|
|
|
385
|
-
// src/components/fileUpload/FileUpload.ts
|
|
386
|
-
import { ComponentType as ComponentType6 } from "discord-api-types/v10";
|
|
387
|
-
|
|
388
|
-
// src/components/fileUpload/Assertions.ts
|
|
389
|
-
import { ComponentType as ComponentType5 } from "discord-api-types/v10";
|
|
390
|
-
import { z as z4 } from "zod";
|
|
391
|
-
var fileUploadPredicate = z4.object({
|
|
392
|
-
type: z4.literal(ComponentType5.FileUpload),
|
|
393
|
-
id: idPredicate,
|
|
394
|
-
custom_id: customIdPredicate,
|
|
395
|
-
min_values: z4.int().min(0).max(10).optional(),
|
|
396
|
-
max_values: z4.int().min(1).max(10).optional(),
|
|
397
|
-
required: z4.boolean().optional()
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
// src/components/fileUpload/FileUpload.ts
|
|
401
|
-
var FileUploadBuilder = class extends ComponentBuilder {
|
|
402
|
-
static {
|
|
403
|
-
__name(this, "FileUploadBuilder");
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* @internal
|
|
407
|
-
*/
|
|
408
|
-
data;
|
|
409
|
-
/**
|
|
410
|
-
* Creates a new file upload.
|
|
411
|
-
*
|
|
412
|
-
* @param data - The API data to create this file upload with
|
|
413
|
-
* @example
|
|
414
|
-
* Creating a file upload from an API data object:
|
|
415
|
-
* ```ts
|
|
416
|
-
* const fileUpload = new FileUploadBuilder({
|
|
417
|
-
* custom_id: "file_upload",
|
|
418
|
-
* min_values: 2,
|
|
419
|
-
* max_values: 5,
|
|
420
|
-
* });
|
|
421
|
-
* ```
|
|
422
|
-
* @example
|
|
423
|
-
* Creating a file upload using setters and API data:
|
|
424
|
-
* ```ts
|
|
425
|
-
* const fileUpload = new FileUploadBuilder({
|
|
426
|
-
* custom_id: "file_upload",
|
|
427
|
-
* min_values: 2,
|
|
428
|
-
* max_values: 5,
|
|
429
|
-
* }).setRequired();
|
|
430
|
-
* ```
|
|
431
|
-
*/
|
|
432
|
-
constructor(data = {}) {
|
|
433
|
-
super();
|
|
434
|
-
this.data = { ...structuredClone(data), type: ComponentType6.FileUpload };
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Sets the custom id for this file upload.
|
|
438
|
-
*
|
|
439
|
-
* @param customId - The custom id to use
|
|
440
|
-
*/
|
|
441
|
-
setCustomId(customId) {
|
|
442
|
-
this.data.custom_id = customId;
|
|
443
|
-
return this;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Sets the minimum number of file uploads required.
|
|
447
|
-
*
|
|
448
|
-
* @param minValues - The minimum values that must be uploaded
|
|
449
|
-
*/
|
|
450
|
-
setMinValues(minValues) {
|
|
451
|
-
this.data.min_values = minValues;
|
|
452
|
-
return this;
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Clears the minimum values.
|
|
456
|
-
*/
|
|
457
|
-
clearMinValues() {
|
|
458
|
-
this.data.min_values = void 0;
|
|
459
|
-
return this;
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Sets the maximum number of file uploads required.
|
|
463
|
-
*
|
|
464
|
-
* @param maxValues - The maximum values that must be uploaded
|
|
465
|
-
*/
|
|
466
|
-
setMaxValues(maxValues) {
|
|
467
|
-
this.data.max_values = maxValues;
|
|
468
|
-
return this;
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Clears the maximum values.
|
|
472
|
-
*/
|
|
473
|
-
clearMaxValues() {
|
|
474
|
-
this.data.max_values = void 0;
|
|
475
|
-
return this;
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Sets whether this file upload is required.
|
|
479
|
-
*
|
|
480
|
-
* @param required - Whether this file upload is required
|
|
481
|
-
*/
|
|
482
|
-
setRequired(required = true) {
|
|
483
|
-
this.data.required = required;
|
|
484
|
-
return this;
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* {@inheritDoc ComponentBuilder.toJSON}
|
|
488
|
-
*/
|
|
489
|
-
toJSON(validationOverride) {
|
|
490
|
-
const clone = structuredClone(this.data);
|
|
491
|
-
validate(fileUploadPredicate, clone, validationOverride);
|
|
492
|
-
return clone;
|
|
493
|
-
}
|
|
494
|
-
};
|
|
495
|
-
|
|
496
385
|
// src/components/label/Label.ts
|
|
497
|
-
import { ComponentType as
|
|
386
|
+
import { ComponentType as ComponentType23 } from "discord-api-types/v10";
|
|
498
387
|
|
|
499
388
|
// src/util/resolveBuilder.ts
|
|
500
389
|
function isBuilder(builder, Constructor) {
|
|
@@ -513,10 +402,10 @@ function resolveBuilder(builder, Constructor) {
|
|
|
513
402
|
__name(resolveBuilder, "resolveBuilder");
|
|
514
403
|
|
|
515
404
|
// src/components/Components.ts
|
|
516
|
-
import { ButtonStyle as ButtonStyle5, ComponentType as
|
|
405
|
+
import { ButtonStyle as ButtonStyle5, ComponentType as ComponentType21 } from "discord-api-types/v10";
|
|
517
406
|
|
|
518
407
|
// src/components/ActionRow.ts
|
|
519
|
-
import { ComponentType as
|
|
408
|
+
import { ComponentType as ComponentType12 } from "discord-api-types/v10";
|
|
520
409
|
|
|
521
410
|
// src/util/normalizeArray.ts
|
|
522
411
|
function normalizeArray(arr) {
|
|
@@ -527,7 +416,7 @@ __name(normalizeArray, "normalizeArray");
|
|
|
527
416
|
|
|
528
417
|
// src/components/selectMenu/ChannelSelectMenu.ts
|
|
529
418
|
import {
|
|
530
|
-
ComponentType as
|
|
419
|
+
ComponentType as ComponentType5,
|
|
531
420
|
SelectMenuDefaultValueType as SelectMenuDefaultValueType2
|
|
532
421
|
} from "discord-api-types/v10";
|
|
533
422
|
|
|
@@ -631,7 +520,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
631
520
|
*/
|
|
632
521
|
constructor(data = {}) {
|
|
633
522
|
super();
|
|
634
|
-
this.data = { ...structuredClone(data), type:
|
|
523
|
+
this.data = { ...structuredClone(data), type: ComponentType5.ChannelSelect };
|
|
635
524
|
}
|
|
636
525
|
/**
|
|
637
526
|
* Adds channel types to this select menu.
|
|
@@ -696,7 +585,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
696
585
|
|
|
697
586
|
// src/components/selectMenu/MentionableSelectMenu.ts
|
|
698
587
|
import {
|
|
699
|
-
ComponentType as
|
|
588
|
+
ComponentType as ComponentType6,
|
|
700
589
|
SelectMenuDefaultValueType as SelectMenuDefaultValueType3
|
|
701
590
|
} from "discord-api-types/v10";
|
|
702
591
|
var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
@@ -728,7 +617,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
728
617
|
*/
|
|
729
618
|
constructor(data = {}) {
|
|
730
619
|
super();
|
|
731
|
-
this.data = { ...structuredClone(data), type:
|
|
620
|
+
this.data = { ...structuredClone(data), type: ComponentType6.MentionableSelect };
|
|
732
621
|
}
|
|
733
622
|
/**
|
|
734
623
|
* Adds default roles to this auto populated select menu.
|
|
@@ -795,7 +684,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
795
684
|
|
|
796
685
|
// src/components/selectMenu/RoleSelectMenu.ts
|
|
797
686
|
import {
|
|
798
|
-
ComponentType as
|
|
687
|
+
ComponentType as ComponentType7,
|
|
799
688
|
SelectMenuDefaultValueType as SelectMenuDefaultValueType4
|
|
800
689
|
} from "discord-api-types/v10";
|
|
801
690
|
var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
@@ -827,7 +716,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
827
716
|
*/
|
|
828
717
|
constructor(data = {}) {
|
|
829
718
|
super();
|
|
830
|
-
this.data = { ...structuredClone(data), type:
|
|
719
|
+
this.data = { ...structuredClone(data), type: ComponentType7.RoleSelect };
|
|
831
720
|
}
|
|
832
721
|
/**
|
|
833
722
|
* Adds default roles to this auto populated select menu.
|
|
@@ -869,7 +758,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
869
758
|
};
|
|
870
759
|
|
|
871
760
|
// src/components/selectMenu/StringSelectMenu.ts
|
|
872
|
-
import { ComponentType as
|
|
761
|
+
import { ComponentType as ComponentType8 } from "discord-api-types/v10";
|
|
873
762
|
|
|
874
763
|
// src/components/selectMenu/StringSelectMenuOption.ts
|
|
875
764
|
var StringSelectMenuOptionBuilder = class {
|
|
@@ -1020,7 +909,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1020
909
|
this.data = {
|
|
1021
910
|
...structuredClone(rest),
|
|
1022
911
|
options: options.map((option) => new StringSelectMenuOptionBuilder(option)),
|
|
1023
|
-
type:
|
|
912
|
+
type: ComponentType8.StringSelect
|
|
1024
913
|
};
|
|
1025
914
|
}
|
|
1026
915
|
/**
|
|
@@ -1092,7 +981,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1092
981
|
|
|
1093
982
|
// src/components/selectMenu/UserSelectMenu.ts
|
|
1094
983
|
import {
|
|
1095
|
-
ComponentType as
|
|
984
|
+
ComponentType as ComponentType9,
|
|
1096
985
|
SelectMenuDefaultValueType as SelectMenuDefaultValueType5
|
|
1097
986
|
} from "discord-api-types/v10";
|
|
1098
987
|
var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
@@ -1124,7 +1013,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1124
1013
|
*/
|
|
1125
1014
|
constructor(data = {}) {
|
|
1126
1015
|
super();
|
|
1127
|
-
this.data = { ...structuredClone(data), type:
|
|
1016
|
+
this.data = { ...structuredClone(data), type: ComponentType9.UserSelect };
|
|
1128
1017
|
}
|
|
1129
1018
|
/**
|
|
1130
1019
|
* Adds default users to this auto populated select menu.
|
|
@@ -1166,21 +1055,21 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1166
1055
|
};
|
|
1167
1056
|
|
|
1168
1057
|
// src/components/textInput/TextInput.ts
|
|
1169
|
-
import { ComponentType as
|
|
1058
|
+
import { ComponentType as ComponentType11 } from "discord-api-types/v10";
|
|
1170
1059
|
|
|
1171
1060
|
// src/components/textInput/Assertions.ts
|
|
1172
|
-
import { ComponentType as
|
|
1173
|
-
import { z as
|
|
1174
|
-
var textInputPredicate =
|
|
1061
|
+
import { ComponentType as ComponentType10, TextInputStyle } from "discord-api-types/v10";
|
|
1062
|
+
import { z as z4 } from "zod";
|
|
1063
|
+
var textInputPredicate = z4.object({
|
|
1175
1064
|
id: idPredicate,
|
|
1176
|
-
type:
|
|
1065
|
+
type: z4.literal(ComponentType10.TextInput),
|
|
1177
1066
|
custom_id: customIdPredicate,
|
|
1178
|
-
style:
|
|
1179
|
-
min_length:
|
|
1180
|
-
max_length:
|
|
1181
|
-
placeholder:
|
|
1182
|
-
value:
|
|
1183
|
-
required:
|
|
1067
|
+
style: z4.enum(TextInputStyle),
|
|
1068
|
+
min_length: z4.number().min(0).max(4e3).optional(),
|
|
1069
|
+
max_length: z4.number().min(1).max(4e3).optional(),
|
|
1070
|
+
placeholder: z4.string().max(100).optional(),
|
|
1071
|
+
value: z4.string().min(0).max(4e3).optional(),
|
|
1072
|
+
required: z4.boolean().optional()
|
|
1184
1073
|
});
|
|
1185
1074
|
|
|
1186
1075
|
// src/components/textInput/TextInput.ts
|
|
@@ -1217,7 +1106,7 @@ var TextInputBuilder = class extends ComponentBuilder {
|
|
|
1217
1106
|
*/
|
|
1218
1107
|
constructor(data = {}) {
|
|
1219
1108
|
super();
|
|
1220
|
-
this.data = { ...structuredClone(data), type:
|
|
1109
|
+
this.data = { ...structuredClone(data), type: ComponentType11.TextInput };
|
|
1221
1110
|
}
|
|
1222
1111
|
/**
|
|
1223
1112
|
* Sets the custom id for this text input.
|
|
@@ -1375,7 +1264,7 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
1375
1264
|
this.data = {
|
|
1376
1265
|
...structuredClone(rest),
|
|
1377
1266
|
components: components.map((component) => createComponentBuilder(component)),
|
|
1378
|
-
type:
|
|
1267
|
+
type: ComponentType12.ActionRow
|
|
1379
1268
|
};
|
|
1380
1269
|
}
|
|
1381
1270
|
/**
|
|
@@ -1552,67 +1441,67 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
1552
1441
|
|
|
1553
1442
|
// src/components/v2/Container.ts
|
|
1554
1443
|
import {
|
|
1555
|
-
ComponentType as
|
|
1444
|
+
ComponentType as ComponentType20
|
|
1556
1445
|
} from "discord-api-types/v10";
|
|
1557
1446
|
|
|
1558
1447
|
// src/components/v2/Assertions.ts
|
|
1559
|
-
import { ComponentType as
|
|
1560
|
-
import { z as
|
|
1561
|
-
var unfurledMediaItemPredicate =
|
|
1562
|
-
url:
|
|
1448
|
+
import { ComponentType as ComponentType13, SeparatorSpacingSize } from "discord-api-types/v10";
|
|
1449
|
+
import { z as z5 } from "zod";
|
|
1450
|
+
var unfurledMediaItemPredicate = z5.object({
|
|
1451
|
+
url: z5.url({ protocol: /^(?:https?|attachment)$/ })
|
|
1563
1452
|
});
|
|
1564
|
-
var thumbnailPredicate =
|
|
1565
|
-
type:
|
|
1453
|
+
var thumbnailPredicate = z5.object({
|
|
1454
|
+
type: z5.literal(ComponentType13.Thumbnail),
|
|
1566
1455
|
id: idPredicate,
|
|
1567
1456
|
media: unfurledMediaItemPredicate,
|
|
1568
|
-
description:
|
|
1569
|
-
spoiler:
|
|
1457
|
+
description: z5.string().min(1).max(1024).nullish(),
|
|
1458
|
+
spoiler: z5.boolean().optional()
|
|
1570
1459
|
});
|
|
1571
|
-
var unfurledMediaItemAttachmentOnlyPredicate =
|
|
1572
|
-
url:
|
|
1460
|
+
var unfurledMediaItemAttachmentOnlyPredicate = z5.object({
|
|
1461
|
+
url: z5.url({ protocol: /^attachment$/ })
|
|
1573
1462
|
});
|
|
1574
|
-
var filePredicate =
|
|
1575
|
-
type:
|
|
1463
|
+
var filePredicate = z5.object({
|
|
1464
|
+
type: z5.literal(ComponentType13.File),
|
|
1576
1465
|
id: idPredicate,
|
|
1577
1466
|
file: unfurledMediaItemAttachmentOnlyPredicate,
|
|
1578
|
-
spoiler:
|
|
1467
|
+
spoiler: z5.boolean().optional()
|
|
1579
1468
|
});
|
|
1580
|
-
var separatorPredicate =
|
|
1581
|
-
type:
|
|
1469
|
+
var separatorPredicate = z5.object({
|
|
1470
|
+
type: z5.literal(ComponentType13.Separator),
|
|
1582
1471
|
id: idPredicate,
|
|
1583
|
-
divider:
|
|
1584
|
-
spacing:
|
|
1472
|
+
divider: z5.boolean().optional(),
|
|
1473
|
+
spacing: z5.enum(SeparatorSpacingSize).optional()
|
|
1585
1474
|
});
|
|
1586
|
-
var textDisplayPredicate =
|
|
1587
|
-
type:
|
|
1475
|
+
var textDisplayPredicate = z5.object({
|
|
1476
|
+
type: z5.literal(ComponentType13.TextDisplay),
|
|
1588
1477
|
id: idPredicate,
|
|
1589
|
-
content:
|
|
1478
|
+
content: z5.string().min(1).max(4e3)
|
|
1590
1479
|
});
|
|
1591
|
-
var mediaGalleryItemPredicate =
|
|
1480
|
+
var mediaGalleryItemPredicate = z5.object({
|
|
1592
1481
|
id: idPredicate,
|
|
1593
1482
|
media: unfurledMediaItemPredicate,
|
|
1594
|
-
description:
|
|
1595
|
-
spoiler:
|
|
1483
|
+
description: z5.string().min(1).max(1024).nullish(),
|
|
1484
|
+
spoiler: z5.boolean().optional()
|
|
1596
1485
|
});
|
|
1597
|
-
var mediaGalleryPredicate =
|
|
1598
|
-
type:
|
|
1486
|
+
var mediaGalleryPredicate = z5.object({
|
|
1487
|
+
type: z5.literal(ComponentType13.MediaGallery),
|
|
1599
1488
|
id: idPredicate,
|
|
1600
|
-
items:
|
|
1489
|
+
items: z5.array(mediaGalleryItemPredicate).min(1).max(10)
|
|
1601
1490
|
});
|
|
1602
|
-
var sectionPredicate =
|
|
1603
|
-
type:
|
|
1491
|
+
var sectionPredicate = z5.object({
|
|
1492
|
+
type: z5.literal(ComponentType13.Section),
|
|
1604
1493
|
id: idPredicate,
|
|
1605
|
-
components:
|
|
1606
|
-
accessory:
|
|
1607
|
-
|
|
1608
|
-
|
|
1494
|
+
components: z5.array(textDisplayPredicate).min(1).max(3),
|
|
1495
|
+
accessory: z5.union([
|
|
1496
|
+
z5.object({ type: z5.literal(ComponentType13.Button) }),
|
|
1497
|
+
z5.object({ type: z5.literal(ComponentType13.Thumbnail) })
|
|
1609
1498
|
])
|
|
1610
1499
|
});
|
|
1611
|
-
var containerPredicate =
|
|
1612
|
-
type:
|
|
1500
|
+
var containerPredicate = z5.object({
|
|
1501
|
+
type: z5.literal(ComponentType13.Container),
|
|
1613
1502
|
id: idPredicate,
|
|
1614
|
-
components:
|
|
1615
|
-
|
|
1503
|
+
components: z5.array(
|
|
1504
|
+
z5.union([
|
|
1616
1505
|
actionRowPredicate,
|
|
1617
1506
|
filePredicate,
|
|
1618
1507
|
mediaGalleryPredicate,
|
|
@@ -1621,12 +1510,12 @@ var containerPredicate = z6.object({
|
|
|
1621
1510
|
textDisplayPredicate
|
|
1622
1511
|
])
|
|
1623
1512
|
).min(1),
|
|
1624
|
-
spoiler:
|
|
1625
|
-
accent_color:
|
|
1513
|
+
spoiler: z5.boolean().optional(),
|
|
1514
|
+
accent_color: z5.int().min(0).max(16777215).nullish()
|
|
1626
1515
|
});
|
|
1627
1516
|
|
|
1628
1517
|
// src/components/v2/File.ts
|
|
1629
|
-
import { ComponentType as
|
|
1518
|
+
import { ComponentType as ComponentType14 } from "discord-api-types/v10";
|
|
1630
1519
|
var FileBuilder = class extends ComponentBuilder {
|
|
1631
1520
|
static {
|
|
1632
1521
|
__name(this, "FileBuilder");
|
|
@@ -1666,7 +1555,7 @@ var FileBuilder = class extends ComponentBuilder {
|
|
|
1666
1555
|
this.data = {
|
|
1667
1556
|
...structuredClone(rest),
|
|
1668
1557
|
file: file && { url: file.url },
|
|
1669
|
-
type:
|
|
1558
|
+
type: ComponentType14.File
|
|
1670
1559
|
};
|
|
1671
1560
|
}
|
|
1672
1561
|
/**
|
|
@@ -1698,7 +1587,7 @@ var FileBuilder = class extends ComponentBuilder {
|
|
|
1698
1587
|
};
|
|
1699
1588
|
|
|
1700
1589
|
// src/components/v2/MediaGallery.ts
|
|
1701
|
-
import { ComponentType as
|
|
1590
|
+
import { ComponentType as ComponentType15 } from "discord-api-types/v10";
|
|
1702
1591
|
|
|
1703
1592
|
// src/components/v2/MediaGalleryItem.ts
|
|
1704
1593
|
var MediaGalleryItemBuilder = class {
|
|
@@ -1833,7 +1722,7 @@ var MediaGalleryBuilder = class extends ComponentBuilder {
|
|
|
1833
1722
|
this.data = {
|
|
1834
1723
|
...structuredClone(rest),
|
|
1835
1724
|
items: items.map((item) => new MediaGalleryItemBuilder(item)),
|
|
1836
|
-
type:
|
|
1725
|
+
type: ComponentType15.MediaGallery
|
|
1837
1726
|
};
|
|
1838
1727
|
}
|
|
1839
1728
|
/**
|
|
@@ -1875,10 +1764,10 @@ var MediaGalleryBuilder = class extends ComponentBuilder {
|
|
|
1875
1764
|
};
|
|
1876
1765
|
|
|
1877
1766
|
// src/components/v2/Section.ts
|
|
1878
|
-
import { ComponentType as
|
|
1767
|
+
import { ComponentType as ComponentType18 } from "discord-api-types/v10";
|
|
1879
1768
|
|
|
1880
1769
|
// src/components/v2/TextDisplay.ts
|
|
1881
|
-
import { ComponentType as
|
|
1770
|
+
import { ComponentType as ComponentType16 } from "discord-api-types/v10";
|
|
1882
1771
|
var TextDisplayBuilder = class extends ComponentBuilder {
|
|
1883
1772
|
static {
|
|
1884
1773
|
__name(this, "TextDisplayBuilder");
|
|
@@ -1911,7 +1800,7 @@ var TextDisplayBuilder = class extends ComponentBuilder {
|
|
|
1911
1800
|
super();
|
|
1912
1801
|
this.data = {
|
|
1913
1802
|
...structuredClone(data),
|
|
1914
|
-
type:
|
|
1803
|
+
type: ComponentType16.TextDisplay
|
|
1915
1804
|
};
|
|
1916
1805
|
}
|
|
1917
1806
|
/**
|
|
@@ -1934,7 +1823,7 @@ var TextDisplayBuilder = class extends ComponentBuilder {
|
|
|
1934
1823
|
};
|
|
1935
1824
|
|
|
1936
1825
|
// src/components/v2/Thumbnail.ts
|
|
1937
|
-
import { ComponentType as
|
|
1826
|
+
import { ComponentType as ComponentType17 } from "discord-api-types/v10";
|
|
1938
1827
|
var ThumbnailBuilder = class extends ComponentBuilder {
|
|
1939
1828
|
static {
|
|
1940
1829
|
__name(this, "ThumbnailBuilder");
|
|
@@ -1974,7 +1863,7 @@ var ThumbnailBuilder = class extends ComponentBuilder {
|
|
|
1974
1863
|
this.data = {
|
|
1975
1864
|
...structuredClone(rest),
|
|
1976
1865
|
media: media && { url: media.url },
|
|
1977
|
-
type:
|
|
1866
|
+
type: ComponentType17.Thumbnail
|
|
1978
1867
|
};
|
|
1979
1868
|
}
|
|
1980
1869
|
/**
|
|
@@ -2078,7 +1967,7 @@ var SectionBuilder = class extends ComponentBuilder {
|
|
|
2078
1967
|
...structuredClone(rest),
|
|
2079
1968
|
accessory: accessory && resolveAccessoryComponent(accessory),
|
|
2080
1969
|
components: components.map((component) => new TextDisplayBuilder(component)),
|
|
2081
|
-
type:
|
|
1970
|
+
type: ComponentType18.Section
|
|
2082
1971
|
};
|
|
2083
1972
|
}
|
|
2084
1973
|
/**
|
|
@@ -2191,7 +2080,7 @@ var SectionBuilder = class extends ComponentBuilder {
|
|
|
2191
2080
|
};
|
|
2192
2081
|
|
|
2193
2082
|
// src/components/v2/Separator.ts
|
|
2194
|
-
import { ComponentType as
|
|
2083
|
+
import { ComponentType as ComponentType19 } from "discord-api-types/v10";
|
|
2195
2084
|
var SeparatorBuilder = class extends ComponentBuilder {
|
|
2196
2085
|
static {
|
|
2197
2086
|
__name(this, "SeparatorBuilder");
|
|
@@ -2225,7 +2114,7 @@ var SeparatorBuilder = class extends ComponentBuilder {
|
|
|
2225
2114
|
super();
|
|
2226
2115
|
this.data = {
|
|
2227
2116
|
...structuredClone(data),
|
|
2228
|
-
type:
|
|
2117
|
+
type: ComponentType19.Separator
|
|
2229
2118
|
};
|
|
2230
2119
|
}
|
|
2231
2120
|
/**
|
|
@@ -2289,7 +2178,7 @@ var ContainerBuilder = class extends ComponentBuilder {
|
|
|
2289
2178
|
this.data = {
|
|
2290
2179
|
...structuredClone(rest),
|
|
2291
2180
|
components: components.map((component) => createComponentBuilder(component)),
|
|
2292
|
-
type:
|
|
2181
|
+
type: ComponentType20.Container
|
|
2293
2182
|
};
|
|
2294
2183
|
}
|
|
2295
2184
|
/**
|
|
@@ -2439,40 +2328,38 @@ function createComponentBuilder(data) {
|
|
|
2439
2328
|
return data;
|
|
2440
2329
|
}
|
|
2441
2330
|
switch (data.type) {
|
|
2442
|
-
case
|
|
2331
|
+
case ComponentType21.ActionRow:
|
|
2443
2332
|
return new ActionRowBuilder(data);
|
|
2444
|
-
case
|
|
2333
|
+
case ComponentType21.Button:
|
|
2445
2334
|
return createButtonBuilder(data);
|
|
2446
|
-
case
|
|
2335
|
+
case ComponentType21.StringSelect:
|
|
2447
2336
|
return new StringSelectMenuBuilder(data);
|
|
2448
|
-
case
|
|
2337
|
+
case ComponentType21.TextInput:
|
|
2449
2338
|
return new TextInputBuilder(data);
|
|
2450
|
-
case
|
|
2339
|
+
case ComponentType21.UserSelect:
|
|
2451
2340
|
return new UserSelectMenuBuilder(data);
|
|
2452
|
-
case
|
|
2341
|
+
case ComponentType21.RoleSelect:
|
|
2453
2342
|
return new RoleSelectMenuBuilder(data);
|
|
2454
|
-
case
|
|
2343
|
+
case ComponentType21.MentionableSelect:
|
|
2455
2344
|
return new MentionableSelectMenuBuilder(data);
|
|
2456
|
-
case
|
|
2345
|
+
case ComponentType21.ChannelSelect:
|
|
2457
2346
|
return new ChannelSelectMenuBuilder(data);
|
|
2458
|
-
case
|
|
2347
|
+
case ComponentType21.Thumbnail:
|
|
2459
2348
|
return new ThumbnailBuilder(data);
|
|
2460
|
-
case
|
|
2349
|
+
case ComponentType21.File:
|
|
2461
2350
|
return new FileBuilder(data);
|
|
2462
|
-
case
|
|
2351
|
+
case ComponentType21.Separator:
|
|
2463
2352
|
return new SeparatorBuilder(data);
|
|
2464
|
-
case
|
|
2353
|
+
case ComponentType21.TextDisplay:
|
|
2465
2354
|
return new TextDisplayBuilder(data);
|
|
2466
|
-
case
|
|
2355
|
+
case ComponentType21.MediaGallery:
|
|
2467
2356
|
return new MediaGalleryBuilder(data);
|
|
2468
|
-
case
|
|
2357
|
+
case ComponentType21.Section:
|
|
2469
2358
|
return new SectionBuilder(data);
|
|
2470
|
-
case
|
|
2359
|
+
case ComponentType21.Container:
|
|
2471
2360
|
return new ContainerBuilder(data);
|
|
2472
|
-
case
|
|
2361
|
+
case ComponentType21.Label:
|
|
2473
2362
|
return new LabelBuilder(data);
|
|
2474
|
-
case ComponentType23.FileUpload:
|
|
2475
|
-
return new FileUploadBuilder(data);
|
|
2476
2363
|
default:
|
|
2477
2364
|
throw new Error(`Cannot properly serialize component type: ${data.type}`);
|
|
2478
2365
|
}
|
|
@@ -2499,9 +2386,9 @@ function createButtonBuilder(data) {
|
|
|
2499
2386
|
__name(createButtonBuilder, "createButtonBuilder");
|
|
2500
2387
|
function resolveAccessoryComponent(component) {
|
|
2501
2388
|
switch (component.type) {
|
|
2502
|
-
case
|
|
2389
|
+
case ComponentType21.Button:
|
|
2503
2390
|
return createButtonBuilder(component);
|
|
2504
|
-
case
|
|
2391
|
+
case ComponentType21.Thumbnail:
|
|
2505
2392
|
return new ThumbnailBuilder(component);
|
|
2506
2393
|
default:
|
|
2507
2394
|
throw new Error(`Cannot properly serialize section accessory component: ${component.type}`);
|
|
@@ -2510,21 +2397,20 @@ function resolveAccessoryComponent(component) {
|
|
|
2510
2397
|
__name(resolveAccessoryComponent, "resolveAccessoryComponent");
|
|
2511
2398
|
|
|
2512
2399
|
// src/components/label/Assertions.ts
|
|
2513
|
-
import { ComponentType as
|
|
2514
|
-
import { z as
|
|
2515
|
-
var labelPredicate2 =
|
|
2400
|
+
import { ComponentType as ComponentType22 } from "discord-api-types/v10";
|
|
2401
|
+
import { z as z6 } from "zod";
|
|
2402
|
+
var labelPredicate2 = z6.object({
|
|
2516
2403
|
id: idPredicate,
|
|
2517
|
-
type:
|
|
2518
|
-
label:
|
|
2519
|
-
description:
|
|
2520
|
-
component:
|
|
2404
|
+
type: z6.literal(ComponentType22.Label),
|
|
2405
|
+
label: z6.string().min(1).max(45),
|
|
2406
|
+
description: z6.string().min(1).max(100).optional(),
|
|
2407
|
+
component: z6.union([
|
|
2521
2408
|
selectMenuStringPredicate,
|
|
2522
2409
|
textInputPredicate,
|
|
2523
2410
|
selectMenuUserPredicate,
|
|
2524
2411
|
selectMenuRolePredicate,
|
|
2525
2412
|
selectMenuMentionablePredicate,
|
|
2526
|
-
selectMenuChannelPredicate
|
|
2527
|
-
fileUploadPredicate
|
|
2413
|
+
selectMenuChannelPredicate
|
|
2528
2414
|
])
|
|
2529
2415
|
});
|
|
2530
2416
|
|
|
@@ -2563,8 +2449,9 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2563
2449
|
const { component, ...rest } = data;
|
|
2564
2450
|
this.data = {
|
|
2565
2451
|
...structuredClone(rest),
|
|
2452
|
+
// @ts-expect-error fixed in https://github.com/discordjs/discord.js/pull/11108
|
|
2566
2453
|
component: component ? createComponentBuilder(component) : void 0,
|
|
2567
|
-
type:
|
|
2454
|
+
type: ComponentType23.Label
|
|
2568
2455
|
};
|
|
2569
2456
|
}
|
|
2570
2457
|
/**
|
|
@@ -2646,15 +2533,6 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2646
2533
|
this.data.component = resolveBuilder(input, TextInputBuilder);
|
|
2647
2534
|
return this;
|
|
2648
2535
|
}
|
|
2649
|
-
/**
|
|
2650
|
-
* Sets a file upload component to this label.
|
|
2651
|
-
*
|
|
2652
|
-
* @param input - A function that returns a component builder or an already built builder
|
|
2653
|
-
*/
|
|
2654
|
-
setFileUploadComponent(input) {
|
|
2655
|
-
this.data.component = resolveBuilder(input, FileUploadBuilder);
|
|
2656
|
-
return this;
|
|
2657
|
-
}
|
|
2658
2536
|
/**
|
|
2659
2537
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
2660
2538
|
*/
|
|
@@ -2914,33 +2792,33 @@ import {
|
|
|
2914
2792
|
InteractionContextType,
|
|
2915
2793
|
ApplicationCommandOptionType
|
|
2916
2794
|
} from "discord-api-types/v10";
|
|
2917
|
-
import { z as
|
|
2918
|
-
var namePredicate =
|
|
2919
|
-
var descriptionPredicate =
|
|
2920
|
-
var sharedNameAndDescriptionPredicate =
|
|
2795
|
+
import { z as z7 } from "zod";
|
|
2796
|
+
var namePredicate = z7.string().min(1).max(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
|
|
2797
|
+
var descriptionPredicate = z7.string().min(1).max(100);
|
|
2798
|
+
var sharedNameAndDescriptionPredicate = z7.object({
|
|
2921
2799
|
name: namePredicate,
|
|
2922
2800
|
name_localizations: localeMapPredicate.optional(),
|
|
2923
2801
|
description: descriptionPredicate,
|
|
2924
2802
|
description_localizations: localeMapPredicate.optional()
|
|
2925
2803
|
});
|
|
2926
|
-
var numericMixinNumberOptionPredicate =
|
|
2927
|
-
max_value:
|
|
2928
|
-
min_value:
|
|
2804
|
+
var numericMixinNumberOptionPredicate = z7.object({
|
|
2805
|
+
max_value: z7.float32().optional(),
|
|
2806
|
+
min_value: z7.float32().optional()
|
|
2929
2807
|
});
|
|
2930
|
-
var numericMixinIntegerOptionPredicate =
|
|
2931
|
-
max_value:
|
|
2932
|
-
min_value:
|
|
2808
|
+
var numericMixinIntegerOptionPredicate = z7.object({
|
|
2809
|
+
max_value: z7.int().optional(),
|
|
2810
|
+
min_value: z7.int().optional()
|
|
2933
2811
|
});
|
|
2934
|
-
var channelMixinOptionPredicate =
|
|
2935
|
-
channel_types:
|
|
2812
|
+
var channelMixinOptionPredicate = z7.object({
|
|
2813
|
+
channel_types: z7.literal(ApplicationCommandOptionAllowedChannelTypes).array().optional()
|
|
2936
2814
|
});
|
|
2937
|
-
var autocompleteMixinOptionPredicate =
|
|
2938
|
-
autocomplete:
|
|
2939
|
-
choices:
|
|
2815
|
+
var autocompleteMixinOptionPredicate = z7.object({
|
|
2816
|
+
autocomplete: z7.literal(true),
|
|
2817
|
+
choices: z7.union([z7.never(), z7.never().array(), z7.undefined()])
|
|
2940
2818
|
});
|
|
2941
|
-
var choiceValueStringPredicate =
|
|
2942
|
-
var choiceValueNumberPredicate =
|
|
2943
|
-
var choiceBasePredicate =
|
|
2819
|
+
var choiceValueStringPredicate = z7.string().min(1).max(100);
|
|
2820
|
+
var choiceValueNumberPredicate = z7.number();
|
|
2821
|
+
var choiceBasePredicate = z7.object({
|
|
2944
2822
|
name: choiceValueStringPredicate,
|
|
2945
2823
|
name_localizations: localeMapPredicate.optional()
|
|
2946
2824
|
});
|
|
@@ -2950,8 +2828,8 @@ var choiceStringPredicate = choiceBasePredicate.extend({
|
|
|
2950
2828
|
var choiceNumberPredicate = choiceBasePredicate.extend({
|
|
2951
2829
|
value: choiceValueNumberPredicate
|
|
2952
2830
|
});
|
|
2953
|
-
var choiceBaseMixinPredicate =
|
|
2954
|
-
autocomplete:
|
|
2831
|
+
var choiceBaseMixinPredicate = z7.object({
|
|
2832
|
+
autocomplete: z7.literal(false).optional()
|
|
2955
2833
|
});
|
|
2956
2834
|
var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
2957
2835
|
choices: choiceStringPredicate.array().max(25).optional()
|
|
@@ -2959,7 +2837,7 @@ var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
|
2959
2837
|
var choiceNumberMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
2960
2838
|
choices: choiceNumberPredicate.array().max(25).optional()
|
|
2961
2839
|
});
|
|
2962
|
-
var basicOptionTypesPredicate =
|
|
2840
|
+
var basicOptionTypesPredicate = z7.literal([
|
|
2963
2841
|
ApplicationCommandOptionType.Attachment,
|
|
2964
2842
|
ApplicationCommandOptionType.Boolean,
|
|
2965
2843
|
ApplicationCommandOptionType.Channel,
|
|
@@ -2971,54 +2849,54 @@ var basicOptionTypesPredicate = z8.literal([
|
|
|
2971
2849
|
ApplicationCommandOptionType.User
|
|
2972
2850
|
]);
|
|
2973
2851
|
var basicOptionPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2974
|
-
required:
|
|
2852
|
+
required: z7.boolean().optional(),
|
|
2975
2853
|
type: basicOptionTypesPredicate
|
|
2976
2854
|
});
|
|
2977
|
-
var autocompleteOrStringChoicesMixinOptionPredicate =
|
|
2855
|
+
var autocompleteOrStringChoicesMixinOptionPredicate = z7.discriminatedUnion("autocomplete", [
|
|
2978
2856
|
autocompleteMixinOptionPredicate,
|
|
2979
2857
|
choiceStringMixinPredicate
|
|
2980
2858
|
]);
|
|
2981
|
-
var autocompleteOrNumberChoicesMixinOptionPredicate =
|
|
2859
|
+
var autocompleteOrNumberChoicesMixinOptionPredicate = z7.discriminatedUnion("autocomplete", [
|
|
2982
2860
|
autocompleteMixinOptionPredicate,
|
|
2983
2861
|
choiceNumberMixinPredicate
|
|
2984
2862
|
]);
|
|
2985
|
-
var channelOptionPredicate =
|
|
2863
|
+
var channelOptionPredicate = z7.object({
|
|
2986
2864
|
...basicOptionPredicate.shape,
|
|
2987
2865
|
...channelMixinOptionPredicate.shape
|
|
2988
2866
|
});
|
|
2989
|
-
var integerOptionPredicate =
|
|
2867
|
+
var integerOptionPredicate = z7.object({
|
|
2990
2868
|
...basicOptionPredicate.shape,
|
|
2991
2869
|
...numericMixinIntegerOptionPredicate.shape
|
|
2992
2870
|
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
2993
|
-
var numberOptionPredicate =
|
|
2871
|
+
var numberOptionPredicate = z7.object({
|
|
2994
2872
|
...basicOptionPredicate.shape,
|
|
2995
2873
|
...numericMixinNumberOptionPredicate.shape
|
|
2996
2874
|
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
2997
2875
|
var stringOptionPredicate = basicOptionPredicate.extend({
|
|
2998
|
-
max_length:
|
|
2999
|
-
min_length:
|
|
2876
|
+
max_length: z7.number().min(0).max(6e3).optional(),
|
|
2877
|
+
min_length: z7.number().min(1).max(6e3).optional()
|
|
3000
2878
|
}).and(autocompleteOrStringChoicesMixinOptionPredicate);
|
|
3001
2879
|
var baseChatInputCommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
3002
|
-
contexts:
|
|
2880
|
+
contexts: z7.array(z7.enum(InteractionContextType)).optional(),
|
|
3003
2881
|
default_member_permissions: memberPermissionsPredicate.optional(),
|
|
3004
|
-
integration_types:
|
|
3005
|
-
nsfw:
|
|
2882
|
+
integration_types: z7.array(z7.enum(ApplicationIntegrationType)).optional(),
|
|
2883
|
+
nsfw: z7.boolean().optional()
|
|
3006
2884
|
});
|
|
3007
|
-
var chatInputCommandOptionsPredicate =
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
2885
|
+
var chatInputCommandOptionsPredicate = z7.union([
|
|
2886
|
+
z7.object({ type: basicOptionTypesPredicate }).array(),
|
|
2887
|
+
z7.object({ type: z7.literal(ApplicationCommandOptionType.Subcommand) }).array(),
|
|
2888
|
+
z7.object({ type: z7.literal(ApplicationCommandOptionType.SubcommandGroup) }).array()
|
|
3011
2889
|
]);
|
|
3012
2890
|
var chatInputCommandPredicate = baseChatInputCommandPredicate.extend({
|
|
3013
2891
|
options: chatInputCommandOptionsPredicate.optional()
|
|
3014
2892
|
});
|
|
3015
2893
|
var chatInputCommandSubcommandGroupPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
3016
|
-
type:
|
|
3017
|
-
options:
|
|
2894
|
+
type: z7.literal(ApplicationCommandOptionType.SubcommandGroup),
|
|
2895
|
+
options: z7.array(z7.object({ type: z7.literal(ApplicationCommandOptionType.Subcommand) })).min(1).max(25)
|
|
3018
2896
|
});
|
|
3019
2897
|
var chatInputCommandSubcommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
3020
|
-
type:
|
|
3021
|
-
options:
|
|
2898
|
+
type: z7.literal(ApplicationCommandOptionType.Subcommand),
|
|
2899
|
+
options: z7.array(z7.object({ type: basicOptionTypesPredicate })).max(25)
|
|
3022
2900
|
});
|
|
3023
2901
|
|
|
3024
2902
|
// src/interactions/commands/chatInput/options/ApplicationCommandOptionBase.ts
|
|
@@ -3567,25 +3445,25 @@ var ChatInputCommandBuilder = class extends Mixin8(
|
|
|
3567
3445
|
|
|
3568
3446
|
// src/interactions/commands/contextMenu/Assertions.ts
|
|
3569
3447
|
import { ApplicationCommandType as ApplicationCommandType2, ApplicationIntegrationType as ApplicationIntegrationType2, InteractionContextType as InteractionContextType2 } from "discord-api-types/v10";
|
|
3570
|
-
import { z as
|
|
3571
|
-
var namePredicate2 =
|
|
3448
|
+
import { z as z8 } from "zod";
|
|
3449
|
+
var namePredicate2 = z8.string().min(1).max(32).refine((val) => val.trim().length > 0, {
|
|
3572
3450
|
error: "Must not consist of only whitespace."
|
|
3573
3451
|
});
|
|
3574
|
-
var contextsPredicate =
|
|
3575
|
-
var integrationTypesPredicate =
|
|
3576
|
-
var baseContextMenuCommandPredicate =
|
|
3452
|
+
var contextsPredicate = z8.array(z8.enum(InteractionContextType2));
|
|
3453
|
+
var integrationTypesPredicate = z8.array(z8.enum(ApplicationIntegrationType2));
|
|
3454
|
+
var baseContextMenuCommandPredicate = z8.object({
|
|
3577
3455
|
contexts: contextsPredicate.optional(),
|
|
3578
3456
|
default_member_permissions: memberPermissionsPredicate.optional(),
|
|
3579
3457
|
name: namePredicate2,
|
|
3580
3458
|
name_localizations: localeMapPredicate.optional(),
|
|
3581
3459
|
integration_types: integrationTypesPredicate.optional(),
|
|
3582
|
-
nsfw:
|
|
3460
|
+
nsfw: z8.boolean().optional()
|
|
3583
3461
|
});
|
|
3584
3462
|
var userCommandPredicate = baseContextMenuCommandPredicate.extend({
|
|
3585
|
-
type:
|
|
3463
|
+
type: z8.literal(ApplicationCommandType2.User)
|
|
3586
3464
|
});
|
|
3587
3465
|
var messageCommandPredicate = baseContextMenuCommandPredicate.extend({
|
|
3588
|
-
type:
|
|
3466
|
+
type: z8.literal(ApplicationCommandType2.Message)
|
|
3589
3467
|
});
|
|
3590
3468
|
|
|
3591
3469
|
// src/interactions/commands/contextMenu/ContextMenuCommand.ts
|
|
@@ -3647,16 +3525,16 @@ var UserContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
|
3647
3525
|
};
|
|
3648
3526
|
|
|
3649
3527
|
// src/interactions/modals/Assertions.ts
|
|
3650
|
-
import { ComponentType as
|
|
3651
|
-
import { z as
|
|
3652
|
-
var titlePredicate =
|
|
3653
|
-
var modalPredicate =
|
|
3528
|
+
import { ComponentType as ComponentType24 } from "discord-api-types/v10";
|
|
3529
|
+
import { z as z9 } from "zod";
|
|
3530
|
+
var titlePredicate = z9.string().min(1).max(45);
|
|
3531
|
+
var modalPredicate = z9.object({
|
|
3654
3532
|
title: titlePredicate,
|
|
3655
3533
|
custom_id: customIdPredicate,
|
|
3656
|
-
components:
|
|
3657
|
-
|
|
3658
|
-
type:
|
|
3659
|
-
components:
|
|
3534
|
+
components: z9.union([
|
|
3535
|
+
z9.object({
|
|
3536
|
+
type: z9.literal(ComponentType24.ActionRow),
|
|
3537
|
+
components: z9.object({ type: z9.literal(ComponentType24.TextInput) }).array().length(1)
|
|
3660
3538
|
}),
|
|
3661
3539
|
labelPredicate2,
|
|
3662
3540
|
textDisplayPredicate
|
|
@@ -3687,6 +3565,7 @@ var ModalBuilder = class {
|
|
|
3687
3565
|
const { components = [], ...rest } = data;
|
|
3688
3566
|
this.data = {
|
|
3689
3567
|
...structuredClone(rest),
|
|
3568
|
+
// @ts-expect-error fixed in https://github.com/discordjs/discord.js/pull/11108
|
|
3690
3569
|
components: components.map((component) => createComponentBuilder(component))
|
|
3691
3570
|
};
|
|
3692
3571
|
}
|
|
@@ -3782,7 +3661,7 @@ var ModalBuilder = class {
|
|
|
3782
3661
|
};
|
|
3783
3662
|
|
|
3784
3663
|
// src/messages/embed/Assertions.ts
|
|
3785
|
-
import { z as
|
|
3664
|
+
import { z as z10 } from "zod";
|
|
3786
3665
|
|
|
3787
3666
|
// src/util/componentUtil.ts
|
|
3788
3667
|
function embedLength(data) {
|
|
@@ -3791,34 +3670,34 @@ function embedLength(data) {
|
|
|
3791
3670
|
__name(embedLength, "embedLength");
|
|
3792
3671
|
|
|
3793
3672
|
// src/messages/embed/Assertions.ts
|
|
3794
|
-
var namePredicate3 =
|
|
3795
|
-
var URLPredicate =
|
|
3796
|
-
var URLWithAttachmentProtocolPredicate =
|
|
3797
|
-
var embedFieldPredicate =
|
|
3673
|
+
var namePredicate3 = z10.string().max(256);
|
|
3674
|
+
var URLPredicate = z10.url({ protocol: /^https?$/ });
|
|
3675
|
+
var URLWithAttachmentProtocolPredicate = z10.url({ protocol: /^(?:https?|attachment)$/ });
|
|
3676
|
+
var embedFieldPredicate = z10.object({
|
|
3798
3677
|
name: namePredicate3,
|
|
3799
|
-
value:
|
|
3800
|
-
inline:
|
|
3678
|
+
value: z10.string().max(1024),
|
|
3679
|
+
inline: z10.boolean().optional()
|
|
3801
3680
|
});
|
|
3802
|
-
var embedAuthorPredicate =
|
|
3681
|
+
var embedAuthorPredicate = z10.object({
|
|
3803
3682
|
name: namePredicate3.min(1),
|
|
3804
3683
|
icon_url: URLWithAttachmentProtocolPredicate.optional(),
|
|
3805
3684
|
url: URLPredicate.optional()
|
|
3806
3685
|
});
|
|
3807
|
-
var embedFooterPredicate =
|
|
3808
|
-
text:
|
|
3686
|
+
var embedFooterPredicate = z10.object({
|
|
3687
|
+
text: z10.string().min(1).max(2048),
|
|
3809
3688
|
icon_url: URLWithAttachmentProtocolPredicate.optional()
|
|
3810
3689
|
});
|
|
3811
|
-
var embedPredicate =
|
|
3690
|
+
var embedPredicate = z10.object({
|
|
3812
3691
|
title: namePredicate3.min(1).optional(),
|
|
3813
|
-
description:
|
|
3692
|
+
description: z10.string().min(1).max(4096).optional(),
|
|
3814
3693
|
url: URLPredicate.optional(),
|
|
3815
|
-
timestamp:
|
|
3816
|
-
color:
|
|
3694
|
+
timestamp: z10.string().optional(),
|
|
3695
|
+
color: z10.int().min(0).max(16777215).optional(),
|
|
3817
3696
|
footer: embedFooterPredicate.optional(),
|
|
3818
|
-
image:
|
|
3819
|
-
thumbnail:
|
|
3697
|
+
image: z10.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
|
|
3698
|
+
thumbnail: z10.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
|
|
3820
3699
|
author: embedAuthorPredicate.optional(),
|
|
3821
|
-
fields:
|
|
3700
|
+
fields: z10.array(embedFieldPredicate).max(25).optional()
|
|
3822
3701
|
}).refine(
|
|
3823
3702
|
(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,
|
|
3824
3703
|
{
|
|
@@ -4304,19 +4183,19 @@ var EmbedBuilder = class {
|
|
|
4304
4183
|
|
|
4305
4184
|
// src/messages/poll/Assertions.ts
|
|
4306
4185
|
import { PollLayoutType } from "discord-api-types/v10";
|
|
4307
|
-
import { z as
|
|
4308
|
-
var pollQuestionPredicate =
|
|
4309
|
-
var pollAnswerMediaPredicate =
|
|
4310
|
-
text:
|
|
4186
|
+
import { z as z11 } from "zod";
|
|
4187
|
+
var pollQuestionPredicate = z11.object({ text: z11.string().min(1).max(300) });
|
|
4188
|
+
var pollAnswerMediaPredicate = z11.object({
|
|
4189
|
+
text: z11.string().min(1).max(55),
|
|
4311
4190
|
emoji: emojiPredicate.optional()
|
|
4312
4191
|
});
|
|
4313
|
-
var pollAnswerPredicate =
|
|
4314
|
-
var pollPredicate =
|
|
4192
|
+
var pollAnswerPredicate = z11.object({ poll_media: pollAnswerMediaPredicate });
|
|
4193
|
+
var pollPredicate = z11.object({
|
|
4315
4194
|
question: pollQuestionPredicate,
|
|
4316
|
-
answers:
|
|
4317
|
-
duration:
|
|
4318
|
-
allow_multiselect:
|
|
4319
|
-
layout_type:
|
|
4195
|
+
answers: z11.array(pollAnswerPredicate).min(1).max(10),
|
|
4196
|
+
duration: z11.number().min(1).max(768).optional(),
|
|
4197
|
+
allow_multiselect: z11.boolean().optional(),
|
|
4198
|
+
layout_type: z11.enum(PollLayoutType).optional()
|
|
4320
4199
|
});
|
|
4321
4200
|
|
|
4322
4201
|
// src/messages/poll/PollMedia.ts
|
|
@@ -4645,95 +4524,95 @@ var PollBuilder = class {
|
|
|
4645
4524
|
};
|
|
4646
4525
|
|
|
4647
4526
|
// src/messages/Assertions.ts
|
|
4648
|
-
import { AllowedMentionsTypes, ComponentType as
|
|
4649
|
-
import { z as
|
|
4650
|
-
var attachmentPredicate =
|
|
4651
|
-
id:
|
|
4652
|
-
description:
|
|
4653
|
-
duration_secs:
|
|
4654
|
-
filename:
|
|
4655
|
-
title:
|
|
4656
|
-
waveform:
|
|
4527
|
+
import { AllowedMentionsTypes, ComponentType as ComponentType25, MessageFlags, MessageReferenceType } from "discord-api-types/v10";
|
|
4528
|
+
import { z as z12 } from "zod";
|
|
4529
|
+
var attachmentPredicate = z12.object({
|
|
4530
|
+
id: z12.union([z12.string(), z12.number()]),
|
|
4531
|
+
description: z12.string().max(1024).optional(),
|
|
4532
|
+
duration_secs: z12.number().max(2 ** 31 - 1).optional(),
|
|
4533
|
+
filename: z12.string().max(1024).optional(),
|
|
4534
|
+
title: z12.string().max(1024).optional(),
|
|
4535
|
+
waveform: z12.string().max(400).optional()
|
|
4657
4536
|
});
|
|
4658
|
-
var allowedMentionPredicate =
|
|
4659
|
-
parse:
|
|
4660
|
-
roles:
|
|
4661
|
-
users:
|
|
4662
|
-
replied_user:
|
|
4537
|
+
var allowedMentionPredicate = z12.object({
|
|
4538
|
+
parse: z12.enum(AllowedMentionsTypes).array().optional(),
|
|
4539
|
+
roles: z12.string().array().max(100).optional(),
|
|
4540
|
+
users: z12.string().array().max(100).optional(),
|
|
4541
|
+
replied_user: z12.boolean().optional()
|
|
4663
4542
|
}).refine(
|
|
4664
4543
|
(data) => !(data.parse?.includes(AllowedMentionsTypes.User) && data.users?.length || data.parse?.includes(AllowedMentionsTypes.Role) && data.roles?.length),
|
|
4665
4544
|
{
|
|
4666
4545
|
error: 'Cannot specify both parse: ["users"] and non-empty users array, or parse: ["roles"] and non-empty roles array. These are mutually exclusive'
|
|
4667
4546
|
}
|
|
4668
4547
|
);
|
|
4669
|
-
var messageReferencePredicate =
|
|
4670
|
-
channel_id:
|
|
4671
|
-
fail_if_not_exists:
|
|
4672
|
-
guild_id:
|
|
4673
|
-
message_id:
|
|
4674
|
-
type:
|
|
4548
|
+
var messageReferencePredicate = z12.object({
|
|
4549
|
+
channel_id: z12.string().optional(),
|
|
4550
|
+
fail_if_not_exists: z12.boolean().optional(),
|
|
4551
|
+
guild_id: z12.string().optional(),
|
|
4552
|
+
message_id: z12.string(),
|
|
4553
|
+
type: z12.enum(MessageReferenceType).optional()
|
|
4675
4554
|
});
|
|
4676
|
-
var baseMessagePredicate =
|
|
4677
|
-
nonce:
|
|
4678
|
-
tts:
|
|
4555
|
+
var baseMessagePredicate = z12.object({
|
|
4556
|
+
nonce: z12.union([z12.string().max(25), z12.number()]).optional(),
|
|
4557
|
+
tts: z12.boolean().optional(),
|
|
4679
4558
|
allowed_mentions: allowedMentionPredicate.optional(),
|
|
4680
4559
|
message_reference: messageReferencePredicate.optional(),
|
|
4681
4560
|
attachments: attachmentPredicate.array().max(10).optional(),
|
|
4682
|
-
enforce_nonce:
|
|
4561
|
+
enforce_nonce: z12.boolean().optional()
|
|
4683
4562
|
});
|
|
4684
|
-
var basicActionRowPredicate =
|
|
4685
|
-
type:
|
|
4686
|
-
components:
|
|
4687
|
-
type:
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4563
|
+
var basicActionRowPredicate = z12.object({
|
|
4564
|
+
type: z12.literal(ComponentType25.ActionRow),
|
|
4565
|
+
components: z12.object({
|
|
4566
|
+
type: z12.literal([
|
|
4567
|
+
ComponentType25.Button,
|
|
4568
|
+
ComponentType25.ChannelSelect,
|
|
4569
|
+
ComponentType25.MentionableSelect,
|
|
4570
|
+
ComponentType25.RoleSelect,
|
|
4571
|
+
ComponentType25.StringSelect,
|
|
4572
|
+
ComponentType25.UserSelect
|
|
4694
4573
|
])
|
|
4695
4574
|
}).array()
|
|
4696
4575
|
});
|
|
4697
4576
|
var messageNoComponentsV2Predicate = baseMessagePredicate.extend({
|
|
4698
|
-
content:
|
|
4577
|
+
content: z12.string().max(2e3).optional(),
|
|
4699
4578
|
embeds: embedPredicate.array().max(10).optional(),
|
|
4700
|
-
sticker_ids:
|
|
4579
|
+
sticker_ids: z12.array(z12.string()).max(3).optional(),
|
|
4701
4580
|
poll: pollPredicate.optional(),
|
|
4702
4581
|
components: basicActionRowPredicate.array().max(5).optional(),
|
|
4703
|
-
flags:
|
|
4582
|
+
flags: z12.int().optional().refine((flags) => !flags || (flags & MessageFlags.IsComponentsV2) === 0, {
|
|
4704
4583
|
error: "Cannot set content, embeds, stickers, or poll with IsComponentsV2 flag set"
|
|
4705
4584
|
})
|
|
4706
4585
|
}).refine(
|
|
4707
4586
|
(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,
|
|
4708
4587
|
{ error: "Messages must have content, embeds, a poll, attachments, components or stickers" }
|
|
4709
4588
|
);
|
|
4710
|
-
var allTopLevelComponentsPredicate =
|
|
4589
|
+
var allTopLevelComponentsPredicate = z12.union([
|
|
4711
4590
|
basicActionRowPredicate,
|
|
4712
|
-
|
|
4713
|
-
type:
|
|
4591
|
+
z12.object({
|
|
4592
|
+
type: z12.literal([
|
|
4714
4593
|
// Components v2
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4594
|
+
ComponentType25.Container,
|
|
4595
|
+
ComponentType25.File,
|
|
4596
|
+
ComponentType25.MediaGallery,
|
|
4597
|
+
ComponentType25.Section,
|
|
4598
|
+
ComponentType25.Separator,
|
|
4599
|
+
ComponentType25.TextDisplay,
|
|
4600
|
+
ComponentType25.Thumbnail
|
|
4722
4601
|
])
|
|
4723
4602
|
})
|
|
4724
4603
|
]).array().min(1).max(10);
|
|
4725
4604
|
var messageComponentsV2Predicate = baseMessagePredicate.extend({
|
|
4726
4605
|
components: allTopLevelComponentsPredicate,
|
|
4727
|
-
flags:
|
|
4606
|
+
flags: z12.int().refine((flags) => (flags & MessageFlags.IsComponentsV2) === MessageFlags.IsComponentsV2, {
|
|
4728
4607
|
error: "Must set IsComponentsV2 flag to use Components V2"
|
|
4729
4608
|
}),
|
|
4730
4609
|
// These fields cannot be set
|
|
4731
|
-
content:
|
|
4732
|
-
embeds:
|
|
4733
|
-
sticker_ids:
|
|
4734
|
-
poll:
|
|
4610
|
+
content: z12.string().length(0).nullish(),
|
|
4611
|
+
embeds: z12.array(z12.never()).nullish(),
|
|
4612
|
+
sticker_ids: z12.array(z12.never()).nullish(),
|
|
4613
|
+
poll: z12.null().optional()
|
|
4735
4614
|
});
|
|
4736
|
-
var messagePredicate =
|
|
4615
|
+
var messagePredicate = z12.union([messageNoComponentsV2Predicate, messageComponentsV2Predicate]);
|
|
4737
4616
|
|
|
4738
4617
|
// src/messages/AllowedMentions.ts
|
|
4739
4618
|
var AllowedMentionsBuilder = class {
|
|
@@ -5623,7 +5502,7 @@ var MessageBuilder = class {
|
|
|
5623
5502
|
};
|
|
5624
5503
|
|
|
5625
5504
|
// src/index.ts
|
|
5626
|
-
var version = "2.0.0-
|
|
5505
|
+
var version = "2.0.0-move-client-init.1761650119-a4c0a246f";
|
|
5627
5506
|
export {
|
|
5628
5507
|
ActionRowBuilder,
|
|
5629
5508
|
AllowedMentionsBuilder,
|
|
@@ -5661,7 +5540,6 @@ export {
|
|
|
5661
5540
|
EmbedFooterBuilder,
|
|
5662
5541
|
EmojiOrLabelButtonMixin,
|
|
5663
5542
|
FileBuilder,
|
|
5664
|
-
FileUploadBuilder,
|
|
5665
5543
|
LabelBuilder,
|
|
5666
5544
|
LinkButtonBuilder,
|
|
5667
5545
|
MediaGalleryBuilder,
|
|
@@ -5716,7 +5594,6 @@ export {
|
|
|
5716
5594
|
emojiPredicate,
|
|
5717
5595
|
enableValidators,
|
|
5718
5596
|
filePredicate,
|
|
5719
|
-
fileUploadPredicate,
|
|
5720
5597
|
idPredicate,
|
|
5721
5598
|
integerOptionPredicate,
|
|
5722
5599
|
isValidationEnabled,
|