@discordjs/builders 2.0.0-move-client-init.1761650119-a4c0a246f → 2.0.0-pr-11006.1765450794-e636950b2
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 +306 -26
- package/dist/index.d.ts +306 -26
- package/dist/index.js +570 -340
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +499 -273
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ __export(index_exports, {
|
|
|
57
57
|
EmbedFooterBuilder: () => EmbedFooterBuilder,
|
|
58
58
|
EmojiOrLabelButtonMixin: () => EmojiOrLabelButtonMixin,
|
|
59
59
|
FileBuilder: () => FileBuilder,
|
|
60
|
+
FileUploadBuilder: () => FileUploadBuilder,
|
|
60
61
|
LabelBuilder: () => LabelBuilder,
|
|
61
62
|
LinkButtonBuilder: () => LinkButtonBuilder,
|
|
62
63
|
MediaGalleryBuilder: () => MediaGalleryBuilder,
|
|
@@ -106,15 +107,16 @@ __export(index_exports, {
|
|
|
106
107
|
embedAuthorPredicate: () => embedAuthorPredicate,
|
|
107
108
|
embedFieldPredicate: () => embedFieldPredicate,
|
|
108
109
|
embedFooterPredicate: () => embedFooterPredicate,
|
|
109
|
-
embedLength: () => embedLength,
|
|
110
110
|
embedPredicate: () => embedPredicate,
|
|
111
111
|
emojiPredicate: () => emojiPredicate,
|
|
112
112
|
enableValidators: () => enableValidators,
|
|
113
|
+
fileBodyMessagePredicate: () => fileBodyMessagePredicate,
|
|
113
114
|
filePredicate: () => filePredicate,
|
|
115
|
+
fileUploadPredicate: () => fileUploadPredicate,
|
|
114
116
|
idPredicate: () => idPredicate,
|
|
115
117
|
integerOptionPredicate: () => integerOptionPredicate,
|
|
116
118
|
isValidationEnabled: () => isValidationEnabled,
|
|
117
|
-
labelPredicate: () =>
|
|
119
|
+
labelPredicate: () => labelPredicate,
|
|
118
120
|
localeMapPredicate: () => localeMapPredicate,
|
|
119
121
|
mediaGalleryItemPredicate: () => mediaGalleryItemPredicate,
|
|
120
122
|
mediaGalleryPredicate: () => mediaGalleryPredicate,
|
|
@@ -129,6 +131,7 @@ __export(index_exports, {
|
|
|
129
131
|
pollAnswerPredicate: () => pollAnswerPredicate,
|
|
130
132
|
pollPredicate: () => pollPredicate,
|
|
131
133
|
pollQuestionPredicate: () => pollQuestionPredicate,
|
|
134
|
+
rawFilePredicate: () => rawFilePredicate,
|
|
132
135
|
resolveAccessoryComponent: () => resolveAccessoryComponent,
|
|
133
136
|
resolveBuilder: () => resolveBuilder,
|
|
134
137
|
sectionPredicate: () => sectionPredicate,
|
|
@@ -139,6 +142,7 @@ __export(index_exports, {
|
|
|
139
142
|
selectMenuStringPredicate: () => selectMenuStringPredicate,
|
|
140
143
|
selectMenuUserPredicate: () => selectMenuUserPredicate,
|
|
141
144
|
separatorPredicate: () => separatorPredicate,
|
|
145
|
+
snowflakePredicate: () => snowflakePredicate,
|
|
142
146
|
stringOptionPredicate: () => stringOptionPredicate,
|
|
143
147
|
textDisplayPredicate: () => textDisplayPredicate,
|
|
144
148
|
textInputPredicate: () => textInputPredicate,
|
|
@@ -242,15 +246,15 @@ var import_v10 = require("discord-api-types/v10");
|
|
|
242
246
|
var import_zod2 = require("zod");
|
|
243
247
|
var idPredicate = import_zod2.z.int().min(0).max(2147483647).optional();
|
|
244
248
|
var customIdPredicate = import_zod2.z.string().min(1).max(100);
|
|
249
|
+
var snowflakePredicate = import_zod2.z.string().regex(/^(?:0|[1-9]\d*)$/);
|
|
245
250
|
var memberPermissionsPredicate = import_zod2.z.coerce.bigint();
|
|
246
251
|
var localeMapPredicate = import_zod2.z.strictObject(
|
|
247
252
|
Object.fromEntries(Object.values(import_v10.Locale).map((loc) => [loc, import_zod2.z.string().optional()]))
|
|
248
253
|
);
|
|
249
254
|
|
|
250
255
|
// src/components/Assertions.ts
|
|
251
|
-
var labelPredicate = import_zod3.z.string().min(1).max(80);
|
|
252
256
|
var emojiPredicate = import_zod3.z.strictObject({
|
|
253
|
-
id:
|
|
257
|
+
id: snowflakePredicate.optional(),
|
|
254
258
|
name: import_zod3.z.string().min(2).max(32).optional(),
|
|
255
259
|
animated: import_zod3.z.boolean().optional()
|
|
256
260
|
}).refine((data) => data.id !== void 0 || data.name !== void 0, {
|
|
@@ -260,24 +264,29 @@ var buttonPredicateBase = import_zod3.z.strictObject({
|
|
|
260
264
|
type: import_zod3.z.literal(import_v102.ComponentType.Button),
|
|
261
265
|
disabled: import_zod3.z.boolean().optional()
|
|
262
266
|
});
|
|
267
|
+
var buttonLabelPredicate = import_zod3.z.string().min(1).max(80);
|
|
263
268
|
var buttonCustomIdPredicateBase = buttonPredicateBase.extend({
|
|
264
269
|
custom_id: customIdPredicate,
|
|
265
270
|
emoji: emojiPredicate.optional(),
|
|
266
|
-
label:
|
|
271
|
+
label: buttonLabelPredicate.optional()
|
|
272
|
+
}).refine((data) => data.emoji !== void 0 || data.label !== void 0, {
|
|
273
|
+
message: "Buttons with a custom id must have either an emoji or a label."
|
|
267
274
|
});
|
|
268
|
-
var buttonPrimaryPredicate = buttonCustomIdPredicateBase.
|
|
269
|
-
var buttonSecondaryPredicate = buttonCustomIdPredicateBase.
|
|
270
|
-
var buttonSuccessPredicate = buttonCustomIdPredicateBase.
|
|
271
|
-
var buttonDangerPredicate = buttonCustomIdPredicateBase.
|
|
275
|
+
var buttonPrimaryPredicate = buttonCustomIdPredicateBase.safeExtend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Primary) });
|
|
276
|
+
var buttonSecondaryPredicate = buttonCustomIdPredicateBase.safeExtend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Secondary) });
|
|
277
|
+
var buttonSuccessPredicate = buttonCustomIdPredicateBase.safeExtend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Success) });
|
|
278
|
+
var buttonDangerPredicate = buttonCustomIdPredicateBase.safeExtend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Danger) });
|
|
272
279
|
var buttonLinkPredicate = buttonPredicateBase.extend({
|
|
273
280
|
style: import_zod3.z.literal(import_v102.ButtonStyle.Link),
|
|
274
281
|
url: import_zod3.z.url({ protocol: /^(?:https?|discord)$/ }).max(512),
|
|
275
282
|
emoji: emojiPredicate.optional(),
|
|
276
|
-
label:
|
|
283
|
+
label: buttonLabelPredicate.optional()
|
|
284
|
+
}).refine((data) => data.emoji !== void 0 || data.label !== void 0, {
|
|
285
|
+
message: "Link buttons must have either an emoji or a label."
|
|
277
286
|
});
|
|
278
287
|
var buttonPremiumPredicate = buttonPredicateBase.extend({
|
|
279
288
|
style: import_zod3.z.literal(import_v102.ButtonStyle.Premium),
|
|
280
|
-
sku_id:
|
|
289
|
+
sku_id: snowflakePredicate
|
|
281
290
|
});
|
|
282
291
|
var buttonPredicate = import_zod3.z.discriminatedUnion("style", [
|
|
283
292
|
buttonLinkPredicate,
|
|
@@ -298,21 +307,21 @@ var selectMenuBasePredicate = import_zod3.z.object({
|
|
|
298
307
|
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
299
308
|
type: import_zod3.z.literal(import_v102.ComponentType.ChannelSelect),
|
|
300
309
|
channel_types: import_zod3.z.enum(import_v102.ChannelType).array().optional(),
|
|
301
|
-
default_values: import_zod3.z.object({ id:
|
|
310
|
+
default_values: import_zod3.z.object({ id: snowflakePredicate, type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.Channel) }).array().max(25).optional()
|
|
302
311
|
});
|
|
303
312
|
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
304
313
|
type: import_zod3.z.literal(import_v102.ComponentType.MentionableSelect),
|
|
305
314
|
default_values: import_zod3.z.object({
|
|
306
|
-
id:
|
|
315
|
+
id: snowflakePredicate,
|
|
307
316
|
type: import_zod3.z.literal([import_v102.SelectMenuDefaultValueType.Role, import_v102.SelectMenuDefaultValueType.User])
|
|
308
317
|
}).array().max(25).optional()
|
|
309
318
|
});
|
|
310
319
|
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
311
320
|
type: import_zod3.z.literal(import_v102.ComponentType.RoleSelect),
|
|
312
|
-
default_values: import_zod3.z.object({ id:
|
|
321
|
+
default_values: import_zod3.z.object({ id: snowflakePredicate, type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.Role) }).array().max(25).optional()
|
|
313
322
|
});
|
|
314
323
|
var selectMenuStringOptionPredicate = import_zod3.z.object({
|
|
315
|
-
label:
|
|
324
|
+
label: import_zod3.z.string().min(1).max(100),
|
|
316
325
|
value: import_zod3.z.string().min(1).max(100),
|
|
317
326
|
description: import_zod3.z.string().min(1).max(100).optional(),
|
|
318
327
|
emoji: emojiPredicate.optional(),
|
|
@@ -350,7 +359,7 @@ var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
|
350
359
|
});
|
|
351
360
|
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
352
361
|
type: import_zod3.z.literal(import_v102.ComponentType.UserSelect),
|
|
353
|
-
default_values: import_zod3.z.object({ id:
|
|
362
|
+
default_values: import_zod3.z.object({ id: snowflakePredicate, type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.User) }).array().max(25).optional()
|
|
354
363
|
});
|
|
355
364
|
var actionRowPredicate = import_zod3.z.object({
|
|
356
365
|
id: idPredicate,
|
|
@@ -526,8 +535,119 @@ var PremiumButtonBuilder = class extends BaseButtonBuilder {
|
|
|
526
535
|
}
|
|
527
536
|
};
|
|
528
537
|
|
|
538
|
+
// src/components/fileUpload/FileUpload.ts
|
|
539
|
+
var import_v107 = require("discord-api-types/v10");
|
|
540
|
+
|
|
541
|
+
// src/components/fileUpload/Assertions.ts
|
|
542
|
+
var import_v106 = require("discord-api-types/v10");
|
|
543
|
+
var import_zod4 = require("zod");
|
|
544
|
+
var fileUploadPredicate = import_zod4.z.object({
|
|
545
|
+
type: import_zod4.z.literal(import_v106.ComponentType.FileUpload),
|
|
546
|
+
id: idPredicate,
|
|
547
|
+
custom_id: customIdPredicate,
|
|
548
|
+
min_values: import_zod4.z.int().min(0).max(10).optional(),
|
|
549
|
+
max_values: import_zod4.z.int().min(1).max(10).optional(),
|
|
550
|
+
required: import_zod4.z.boolean().optional()
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
// src/components/fileUpload/FileUpload.ts
|
|
554
|
+
var FileUploadBuilder = class extends ComponentBuilder {
|
|
555
|
+
static {
|
|
556
|
+
__name(this, "FileUploadBuilder");
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* @internal
|
|
560
|
+
*/
|
|
561
|
+
data;
|
|
562
|
+
/**
|
|
563
|
+
* Creates a new file upload.
|
|
564
|
+
*
|
|
565
|
+
* @param data - The API data to create this file upload with
|
|
566
|
+
* @example
|
|
567
|
+
* Creating a file upload from an API data object:
|
|
568
|
+
* ```ts
|
|
569
|
+
* const fileUpload = new FileUploadBuilder({
|
|
570
|
+
* custom_id: "file_upload",
|
|
571
|
+
* min_values: 2,
|
|
572
|
+
* max_values: 5,
|
|
573
|
+
* });
|
|
574
|
+
* ```
|
|
575
|
+
* @example
|
|
576
|
+
* Creating a file upload using setters and API data:
|
|
577
|
+
* ```ts
|
|
578
|
+
* const fileUpload = new FileUploadBuilder({
|
|
579
|
+
* custom_id: "file_upload",
|
|
580
|
+
* min_values: 2,
|
|
581
|
+
* max_values: 5,
|
|
582
|
+
* }).setRequired();
|
|
583
|
+
* ```
|
|
584
|
+
*/
|
|
585
|
+
constructor(data = {}) {
|
|
586
|
+
super();
|
|
587
|
+
this.data = { ...structuredClone(data), type: import_v107.ComponentType.FileUpload };
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Sets the custom id for this file upload.
|
|
591
|
+
*
|
|
592
|
+
* @param customId - The custom id to use
|
|
593
|
+
*/
|
|
594
|
+
setCustomId(customId) {
|
|
595
|
+
this.data.custom_id = customId;
|
|
596
|
+
return this;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Sets the minimum number of file uploads required.
|
|
600
|
+
*
|
|
601
|
+
* @param minValues - The minimum values that must be uploaded
|
|
602
|
+
*/
|
|
603
|
+
setMinValues(minValues) {
|
|
604
|
+
this.data.min_values = minValues;
|
|
605
|
+
return this;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Clears the minimum values.
|
|
609
|
+
*/
|
|
610
|
+
clearMinValues() {
|
|
611
|
+
this.data.min_values = void 0;
|
|
612
|
+
return this;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Sets the maximum number of file uploads required.
|
|
616
|
+
*
|
|
617
|
+
* @param maxValues - The maximum values that can be uploaded
|
|
618
|
+
*/
|
|
619
|
+
setMaxValues(maxValues) {
|
|
620
|
+
this.data.max_values = maxValues;
|
|
621
|
+
return this;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Clears the maximum values.
|
|
625
|
+
*/
|
|
626
|
+
clearMaxValues() {
|
|
627
|
+
this.data.max_values = void 0;
|
|
628
|
+
return this;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Sets whether this file upload is required.
|
|
632
|
+
*
|
|
633
|
+
* @param required - Whether this file upload is required
|
|
634
|
+
*/
|
|
635
|
+
setRequired(required = true) {
|
|
636
|
+
this.data.required = required;
|
|
637
|
+
return this;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* {@inheritDoc ComponentBuilder.toJSON}
|
|
641
|
+
*/
|
|
642
|
+
toJSON(validationOverride) {
|
|
643
|
+
const clone = structuredClone(this.data);
|
|
644
|
+
validate(fileUploadPredicate, clone, validationOverride);
|
|
645
|
+
return clone;
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
|
|
529
649
|
// src/components/label/Label.ts
|
|
530
|
-
var
|
|
650
|
+
var import_v1026 = require("discord-api-types/v10");
|
|
531
651
|
|
|
532
652
|
// src/util/resolveBuilder.ts
|
|
533
653
|
function isBuilder(builder, Constructor) {
|
|
@@ -546,10 +666,10 @@ function resolveBuilder(builder, Constructor) {
|
|
|
546
666
|
__name(resolveBuilder, "resolveBuilder");
|
|
547
667
|
|
|
548
668
|
// src/components/Components.ts
|
|
549
|
-
var
|
|
669
|
+
var import_v1024 = require("discord-api-types/v10");
|
|
550
670
|
|
|
551
671
|
// src/components/ActionRow.ts
|
|
552
|
-
var
|
|
672
|
+
var import_v1015 = require("discord-api-types/v10");
|
|
553
673
|
|
|
554
674
|
// src/util/normalizeArray.ts
|
|
555
675
|
function normalizeArray(arr) {
|
|
@@ -559,7 +679,7 @@ function normalizeArray(arr) {
|
|
|
559
679
|
__name(normalizeArray, "normalizeArray");
|
|
560
680
|
|
|
561
681
|
// src/components/selectMenu/ChannelSelectMenu.ts
|
|
562
|
-
var
|
|
682
|
+
var import_v108 = require("discord-api-types/v10");
|
|
563
683
|
|
|
564
684
|
// src/components/selectMenu/BaseSelectMenu.ts
|
|
565
685
|
var BaseSelectMenuBuilder = class extends ComponentBuilder {
|
|
@@ -592,9 +712,9 @@ var BaseSelectMenuBuilder = class extends ComponentBuilder {
|
|
|
592
712
|
return this;
|
|
593
713
|
}
|
|
594
714
|
/**
|
|
595
|
-
* Sets the maximum values that
|
|
715
|
+
* Sets the maximum values that can be selected in the select menu.
|
|
596
716
|
*
|
|
597
|
-
* @param maxValues - The maximum values that
|
|
717
|
+
* @param maxValues - The maximum values that can be selected
|
|
598
718
|
*/
|
|
599
719
|
setMaxValues(maxValues) {
|
|
600
720
|
this.data.max_values = maxValues;
|
|
@@ -661,7 +781,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
661
781
|
*/
|
|
662
782
|
constructor(data = {}) {
|
|
663
783
|
super();
|
|
664
|
-
this.data = { ...structuredClone(data), type:
|
|
784
|
+
this.data = { ...structuredClone(data), type: import_v108.ComponentType.ChannelSelect };
|
|
665
785
|
}
|
|
666
786
|
/**
|
|
667
787
|
* Adds channel types to this select menu.
|
|
@@ -696,7 +816,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
696
816
|
this.data.default_values.push(
|
|
697
817
|
...normalizedValues.map((id) => ({
|
|
698
818
|
id,
|
|
699
|
-
type:
|
|
819
|
+
type: import_v108.SelectMenuDefaultValueType.Channel
|
|
700
820
|
}))
|
|
701
821
|
);
|
|
702
822
|
return this;
|
|
@@ -710,7 +830,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
710
830
|
const normalizedValues = normalizeArray(channels);
|
|
711
831
|
this.data.default_values = normalizedValues.map((id) => ({
|
|
712
832
|
id,
|
|
713
|
-
type:
|
|
833
|
+
type: import_v108.SelectMenuDefaultValueType.Channel
|
|
714
834
|
}));
|
|
715
835
|
return this;
|
|
716
836
|
}
|
|
@@ -725,7 +845,7 @@ var ChannelSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
725
845
|
};
|
|
726
846
|
|
|
727
847
|
// src/components/selectMenu/MentionableSelectMenu.ts
|
|
728
|
-
var
|
|
848
|
+
var import_v109 = require("discord-api-types/v10");
|
|
729
849
|
var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
730
850
|
static {
|
|
731
851
|
__name(this, "MentionableSelectMenuBuilder");
|
|
@@ -755,7 +875,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
755
875
|
*/
|
|
756
876
|
constructor(data = {}) {
|
|
757
877
|
super();
|
|
758
|
-
this.data = { ...structuredClone(data), type:
|
|
878
|
+
this.data = { ...structuredClone(data), type: import_v109.ComponentType.MentionableSelect };
|
|
759
879
|
}
|
|
760
880
|
/**
|
|
761
881
|
* Adds default roles to this auto populated select menu.
|
|
@@ -768,7 +888,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
768
888
|
this.data.default_values.push(
|
|
769
889
|
...normalizedValues.map((id) => ({
|
|
770
890
|
id,
|
|
771
|
-
type:
|
|
891
|
+
type: import_v109.SelectMenuDefaultValueType.Role
|
|
772
892
|
}))
|
|
773
893
|
);
|
|
774
894
|
return this;
|
|
@@ -784,7 +904,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
784
904
|
this.data.default_values.push(
|
|
785
905
|
...normalizedValues.map((id) => ({
|
|
786
906
|
id,
|
|
787
|
-
type:
|
|
907
|
+
type: import_v109.SelectMenuDefaultValueType.User
|
|
788
908
|
}))
|
|
789
909
|
);
|
|
790
910
|
return this;
|
|
@@ -821,7 +941,7 @@ var MentionableSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
821
941
|
};
|
|
822
942
|
|
|
823
943
|
// src/components/selectMenu/RoleSelectMenu.ts
|
|
824
|
-
var
|
|
944
|
+
var import_v1010 = require("discord-api-types/v10");
|
|
825
945
|
var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
826
946
|
static {
|
|
827
947
|
__name(this, "RoleSelectMenuBuilder");
|
|
@@ -851,7 +971,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
851
971
|
*/
|
|
852
972
|
constructor(data = {}) {
|
|
853
973
|
super();
|
|
854
|
-
this.data = { ...structuredClone(data), type:
|
|
974
|
+
this.data = { ...structuredClone(data), type: import_v1010.ComponentType.RoleSelect };
|
|
855
975
|
}
|
|
856
976
|
/**
|
|
857
977
|
* Adds default roles to this auto populated select menu.
|
|
@@ -864,7 +984,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
864
984
|
this.data.default_values.push(
|
|
865
985
|
...normalizedValues.map((id) => ({
|
|
866
986
|
id,
|
|
867
|
-
type:
|
|
987
|
+
type: import_v1010.SelectMenuDefaultValueType.Role
|
|
868
988
|
}))
|
|
869
989
|
);
|
|
870
990
|
return this;
|
|
@@ -878,7 +998,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
878
998
|
const normalizedValues = normalizeArray(roles);
|
|
879
999
|
this.data.default_values = normalizedValues.map((id) => ({
|
|
880
1000
|
id,
|
|
881
|
-
type:
|
|
1001
|
+
type: import_v1010.SelectMenuDefaultValueType.Role
|
|
882
1002
|
}));
|
|
883
1003
|
return this;
|
|
884
1004
|
}
|
|
@@ -893,7 +1013,7 @@ var RoleSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
893
1013
|
};
|
|
894
1014
|
|
|
895
1015
|
// src/components/selectMenu/StringSelectMenu.ts
|
|
896
|
-
var
|
|
1016
|
+
var import_v1011 = require("discord-api-types/v10");
|
|
897
1017
|
|
|
898
1018
|
// src/components/selectMenu/StringSelectMenuOption.ts
|
|
899
1019
|
var StringSelectMenuOptionBuilder = class {
|
|
@@ -1044,7 +1164,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1044
1164
|
this.data = {
|
|
1045
1165
|
...structuredClone(rest),
|
|
1046
1166
|
options: options.map((option) => new StringSelectMenuOptionBuilder(option)),
|
|
1047
|
-
type:
|
|
1167
|
+
type: import_v1011.ComponentType.StringSelect
|
|
1048
1168
|
};
|
|
1049
1169
|
}
|
|
1050
1170
|
/**
|
|
@@ -1115,7 +1235,7 @@ var StringSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1115
1235
|
};
|
|
1116
1236
|
|
|
1117
1237
|
// src/components/selectMenu/UserSelectMenu.ts
|
|
1118
|
-
var
|
|
1238
|
+
var import_v1012 = require("discord-api-types/v10");
|
|
1119
1239
|
var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
1120
1240
|
static {
|
|
1121
1241
|
__name(this, "UserSelectMenuBuilder");
|
|
@@ -1145,7 +1265,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1145
1265
|
*/
|
|
1146
1266
|
constructor(data = {}) {
|
|
1147
1267
|
super();
|
|
1148
|
-
this.data = { ...structuredClone(data), type:
|
|
1268
|
+
this.data = { ...structuredClone(data), type: import_v1012.ComponentType.UserSelect };
|
|
1149
1269
|
}
|
|
1150
1270
|
/**
|
|
1151
1271
|
* Adds default users to this auto populated select menu.
|
|
@@ -1158,7 +1278,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1158
1278
|
this.data.default_values.push(
|
|
1159
1279
|
...normalizedValues.map((id) => ({
|
|
1160
1280
|
id,
|
|
1161
|
-
type:
|
|
1281
|
+
type: import_v1012.SelectMenuDefaultValueType.User
|
|
1162
1282
|
}))
|
|
1163
1283
|
);
|
|
1164
1284
|
return this;
|
|
@@ -1172,7 +1292,7 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1172
1292
|
const normalizedValues = normalizeArray(users);
|
|
1173
1293
|
this.data.default_values = normalizedValues.map((id) => ({
|
|
1174
1294
|
id,
|
|
1175
|
-
type:
|
|
1295
|
+
type: import_v1012.SelectMenuDefaultValueType.User
|
|
1176
1296
|
}));
|
|
1177
1297
|
return this;
|
|
1178
1298
|
}
|
|
@@ -1187,21 +1307,21 @@ var UserSelectMenuBuilder = class extends BaseSelectMenuBuilder {
|
|
|
1187
1307
|
};
|
|
1188
1308
|
|
|
1189
1309
|
// src/components/textInput/TextInput.ts
|
|
1190
|
-
var
|
|
1310
|
+
var import_v1014 = require("discord-api-types/v10");
|
|
1191
1311
|
|
|
1192
1312
|
// src/components/textInput/Assertions.ts
|
|
1193
|
-
var
|
|
1194
|
-
var
|
|
1195
|
-
var textInputPredicate =
|
|
1313
|
+
var import_v1013 = require("discord-api-types/v10");
|
|
1314
|
+
var import_zod5 = require("zod");
|
|
1315
|
+
var textInputPredicate = import_zod5.z.object({
|
|
1196
1316
|
id: idPredicate,
|
|
1197
|
-
type:
|
|
1317
|
+
type: import_zod5.z.literal(import_v1013.ComponentType.TextInput),
|
|
1198
1318
|
custom_id: customIdPredicate,
|
|
1199
|
-
style:
|
|
1200
|
-
min_length:
|
|
1201
|
-
max_length:
|
|
1202
|
-
placeholder:
|
|
1203
|
-
value:
|
|
1204
|
-
required:
|
|
1319
|
+
style: import_zod5.z.enum(import_v1013.TextInputStyle),
|
|
1320
|
+
min_length: import_zod5.z.number().min(0).max(4e3).optional(),
|
|
1321
|
+
max_length: import_zod5.z.number().min(1).max(4e3).optional(),
|
|
1322
|
+
placeholder: import_zod5.z.string().max(100).optional(),
|
|
1323
|
+
value: import_zod5.z.string().min(0).max(4e3).optional(),
|
|
1324
|
+
required: import_zod5.z.boolean().optional()
|
|
1205
1325
|
});
|
|
1206
1326
|
|
|
1207
1327
|
// src/components/textInput/TextInput.ts
|
|
@@ -1238,7 +1358,7 @@ var TextInputBuilder = class extends ComponentBuilder {
|
|
|
1238
1358
|
*/
|
|
1239
1359
|
constructor(data = {}) {
|
|
1240
1360
|
super();
|
|
1241
|
-
this.data = { ...structuredClone(data), type:
|
|
1361
|
+
this.data = { ...structuredClone(data), type: import_v1014.ComponentType.TextInput };
|
|
1242
1362
|
}
|
|
1243
1363
|
/**
|
|
1244
1364
|
* Sets the custom id for this text input.
|
|
@@ -1396,7 +1516,7 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
1396
1516
|
this.data = {
|
|
1397
1517
|
...structuredClone(rest),
|
|
1398
1518
|
components: components.map((component) => createComponentBuilder(component)),
|
|
1399
|
-
type:
|
|
1519
|
+
type: import_v1015.ComponentType.ActionRow
|
|
1400
1520
|
};
|
|
1401
1521
|
}
|
|
1402
1522
|
/**
|
|
@@ -1572,66 +1692,66 @@ var ActionRowBuilder = class extends ComponentBuilder {
|
|
|
1572
1692
|
};
|
|
1573
1693
|
|
|
1574
1694
|
// src/components/v2/Container.ts
|
|
1575
|
-
var
|
|
1695
|
+
var import_v1023 = require("discord-api-types/v10");
|
|
1576
1696
|
|
|
1577
1697
|
// src/components/v2/Assertions.ts
|
|
1578
|
-
var
|
|
1579
|
-
var
|
|
1580
|
-
var unfurledMediaItemPredicate =
|
|
1581
|
-
url:
|
|
1698
|
+
var import_v1016 = require("discord-api-types/v10");
|
|
1699
|
+
var import_zod6 = require("zod");
|
|
1700
|
+
var unfurledMediaItemPredicate = import_zod6.z.object({
|
|
1701
|
+
url: import_zod6.z.url({ protocol: /^(?:https?|attachment)$/ })
|
|
1582
1702
|
});
|
|
1583
|
-
var thumbnailPredicate =
|
|
1584
|
-
type:
|
|
1703
|
+
var thumbnailPredicate = import_zod6.z.object({
|
|
1704
|
+
type: import_zod6.z.literal(import_v1016.ComponentType.Thumbnail),
|
|
1585
1705
|
id: idPredicate,
|
|
1586
1706
|
media: unfurledMediaItemPredicate,
|
|
1587
|
-
description:
|
|
1588
|
-
spoiler:
|
|
1707
|
+
description: import_zod6.z.string().min(1).max(1024).nullish(),
|
|
1708
|
+
spoiler: import_zod6.z.boolean().optional()
|
|
1589
1709
|
});
|
|
1590
|
-
var unfurledMediaItemAttachmentOnlyPredicate =
|
|
1591
|
-
url:
|
|
1710
|
+
var unfurledMediaItemAttachmentOnlyPredicate = import_zod6.z.object({
|
|
1711
|
+
url: import_zod6.z.url({ protocol: /^attachment$/ })
|
|
1592
1712
|
});
|
|
1593
|
-
var filePredicate =
|
|
1594
|
-
type:
|
|
1713
|
+
var filePredicate = import_zod6.z.object({
|
|
1714
|
+
type: import_zod6.z.literal(import_v1016.ComponentType.File),
|
|
1595
1715
|
id: idPredicate,
|
|
1596
1716
|
file: unfurledMediaItemAttachmentOnlyPredicate,
|
|
1597
|
-
spoiler:
|
|
1717
|
+
spoiler: import_zod6.z.boolean().optional()
|
|
1598
1718
|
});
|
|
1599
|
-
var separatorPredicate =
|
|
1600
|
-
type:
|
|
1719
|
+
var separatorPredicate = import_zod6.z.object({
|
|
1720
|
+
type: import_zod6.z.literal(import_v1016.ComponentType.Separator),
|
|
1601
1721
|
id: idPredicate,
|
|
1602
|
-
divider:
|
|
1603
|
-
spacing:
|
|
1722
|
+
divider: import_zod6.z.boolean().optional(),
|
|
1723
|
+
spacing: import_zod6.z.enum(import_v1016.SeparatorSpacingSize).optional()
|
|
1604
1724
|
});
|
|
1605
|
-
var textDisplayPredicate =
|
|
1606
|
-
type:
|
|
1725
|
+
var textDisplayPredicate = import_zod6.z.object({
|
|
1726
|
+
type: import_zod6.z.literal(import_v1016.ComponentType.TextDisplay),
|
|
1607
1727
|
id: idPredicate,
|
|
1608
|
-
content:
|
|
1728
|
+
content: import_zod6.z.string().min(1).max(4e3)
|
|
1609
1729
|
});
|
|
1610
|
-
var mediaGalleryItemPredicate =
|
|
1730
|
+
var mediaGalleryItemPredicate = import_zod6.z.object({
|
|
1611
1731
|
id: idPredicate,
|
|
1612
1732
|
media: unfurledMediaItemPredicate,
|
|
1613
|
-
description:
|
|
1614
|
-
spoiler:
|
|
1733
|
+
description: import_zod6.z.string().min(1).max(1024).nullish(),
|
|
1734
|
+
spoiler: import_zod6.z.boolean().optional()
|
|
1615
1735
|
});
|
|
1616
|
-
var mediaGalleryPredicate =
|
|
1617
|
-
type:
|
|
1736
|
+
var mediaGalleryPredicate = import_zod6.z.object({
|
|
1737
|
+
type: import_zod6.z.literal(import_v1016.ComponentType.MediaGallery),
|
|
1618
1738
|
id: idPredicate,
|
|
1619
|
-
items:
|
|
1739
|
+
items: import_zod6.z.array(mediaGalleryItemPredicate).min(1).max(10)
|
|
1620
1740
|
});
|
|
1621
|
-
var sectionPredicate =
|
|
1622
|
-
type:
|
|
1741
|
+
var sectionPredicate = import_zod6.z.object({
|
|
1742
|
+
type: import_zod6.z.literal(import_v1016.ComponentType.Section),
|
|
1623
1743
|
id: idPredicate,
|
|
1624
|
-
components:
|
|
1625
|
-
accessory:
|
|
1626
|
-
|
|
1627
|
-
|
|
1744
|
+
components: import_zod6.z.array(textDisplayPredicate).min(1).max(3),
|
|
1745
|
+
accessory: import_zod6.z.union([
|
|
1746
|
+
import_zod6.z.object({ type: import_zod6.z.literal(import_v1016.ComponentType.Button) }),
|
|
1747
|
+
import_zod6.z.object({ type: import_zod6.z.literal(import_v1016.ComponentType.Thumbnail) })
|
|
1628
1748
|
])
|
|
1629
1749
|
});
|
|
1630
|
-
var containerPredicate =
|
|
1631
|
-
type:
|
|
1750
|
+
var containerPredicate = import_zod6.z.object({
|
|
1751
|
+
type: import_zod6.z.literal(import_v1016.ComponentType.Container),
|
|
1632
1752
|
id: idPredicate,
|
|
1633
|
-
components:
|
|
1634
|
-
|
|
1753
|
+
components: import_zod6.z.array(
|
|
1754
|
+
import_zod6.z.union([
|
|
1635
1755
|
actionRowPredicate,
|
|
1636
1756
|
filePredicate,
|
|
1637
1757
|
mediaGalleryPredicate,
|
|
@@ -1640,12 +1760,12 @@ var containerPredicate = import_zod5.z.object({
|
|
|
1640
1760
|
textDisplayPredicate
|
|
1641
1761
|
])
|
|
1642
1762
|
).min(1),
|
|
1643
|
-
spoiler:
|
|
1644
|
-
accent_color:
|
|
1763
|
+
spoiler: import_zod6.z.boolean().optional(),
|
|
1764
|
+
accent_color: import_zod6.z.int().min(0).max(16777215).nullish()
|
|
1645
1765
|
});
|
|
1646
1766
|
|
|
1647
1767
|
// src/components/v2/File.ts
|
|
1648
|
-
var
|
|
1768
|
+
var import_v1017 = require("discord-api-types/v10");
|
|
1649
1769
|
var FileBuilder = class extends ComponentBuilder {
|
|
1650
1770
|
static {
|
|
1651
1771
|
__name(this, "FileBuilder");
|
|
@@ -1685,7 +1805,7 @@ var FileBuilder = class extends ComponentBuilder {
|
|
|
1685
1805
|
this.data = {
|
|
1686
1806
|
...structuredClone(rest),
|
|
1687
1807
|
file: file && { url: file.url },
|
|
1688
|
-
type:
|
|
1808
|
+
type: import_v1017.ComponentType.File
|
|
1689
1809
|
};
|
|
1690
1810
|
}
|
|
1691
1811
|
/**
|
|
@@ -1717,7 +1837,7 @@ var FileBuilder = class extends ComponentBuilder {
|
|
|
1717
1837
|
};
|
|
1718
1838
|
|
|
1719
1839
|
// src/components/v2/MediaGallery.ts
|
|
1720
|
-
var
|
|
1840
|
+
var import_v1018 = require("discord-api-types/v10");
|
|
1721
1841
|
|
|
1722
1842
|
// src/components/v2/MediaGalleryItem.ts
|
|
1723
1843
|
var MediaGalleryItemBuilder = class {
|
|
@@ -1852,7 +1972,7 @@ var MediaGalleryBuilder = class extends ComponentBuilder {
|
|
|
1852
1972
|
this.data = {
|
|
1853
1973
|
...structuredClone(rest),
|
|
1854
1974
|
items: items.map((item) => new MediaGalleryItemBuilder(item)),
|
|
1855
|
-
type:
|
|
1975
|
+
type: import_v1018.ComponentType.MediaGallery
|
|
1856
1976
|
};
|
|
1857
1977
|
}
|
|
1858
1978
|
/**
|
|
@@ -1894,10 +2014,10 @@ var MediaGalleryBuilder = class extends ComponentBuilder {
|
|
|
1894
2014
|
};
|
|
1895
2015
|
|
|
1896
2016
|
// src/components/v2/Section.ts
|
|
1897
|
-
var
|
|
2017
|
+
var import_v1021 = require("discord-api-types/v10");
|
|
1898
2018
|
|
|
1899
2019
|
// src/components/v2/TextDisplay.ts
|
|
1900
|
-
var
|
|
2020
|
+
var import_v1019 = require("discord-api-types/v10");
|
|
1901
2021
|
var TextDisplayBuilder = class extends ComponentBuilder {
|
|
1902
2022
|
static {
|
|
1903
2023
|
__name(this, "TextDisplayBuilder");
|
|
@@ -1930,7 +2050,7 @@ var TextDisplayBuilder = class extends ComponentBuilder {
|
|
|
1930
2050
|
super();
|
|
1931
2051
|
this.data = {
|
|
1932
2052
|
...structuredClone(data),
|
|
1933
|
-
type:
|
|
2053
|
+
type: import_v1019.ComponentType.TextDisplay
|
|
1934
2054
|
};
|
|
1935
2055
|
}
|
|
1936
2056
|
/**
|
|
@@ -1953,7 +2073,7 @@ var TextDisplayBuilder = class extends ComponentBuilder {
|
|
|
1953
2073
|
};
|
|
1954
2074
|
|
|
1955
2075
|
// src/components/v2/Thumbnail.ts
|
|
1956
|
-
var
|
|
2076
|
+
var import_v1020 = require("discord-api-types/v10");
|
|
1957
2077
|
var ThumbnailBuilder = class extends ComponentBuilder {
|
|
1958
2078
|
static {
|
|
1959
2079
|
__name(this, "ThumbnailBuilder");
|
|
@@ -1993,7 +2113,7 @@ var ThumbnailBuilder = class extends ComponentBuilder {
|
|
|
1993
2113
|
this.data = {
|
|
1994
2114
|
...structuredClone(rest),
|
|
1995
2115
|
media: media && { url: media.url },
|
|
1996
|
-
type:
|
|
2116
|
+
type: import_v1020.ComponentType.Thumbnail
|
|
1997
2117
|
};
|
|
1998
2118
|
}
|
|
1999
2119
|
/**
|
|
@@ -2097,7 +2217,7 @@ var SectionBuilder = class extends ComponentBuilder {
|
|
|
2097
2217
|
...structuredClone(rest),
|
|
2098
2218
|
accessory: accessory && resolveAccessoryComponent(accessory),
|
|
2099
2219
|
components: components.map((component) => new TextDisplayBuilder(component)),
|
|
2100
|
-
type:
|
|
2220
|
+
type: import_v1021.ComponentType.Section
|
|
2101
2221
|
};
|
|
2102
2222
|
}
|
|
2103
2223
|
/**
|
|
@@ -2210,7 +2330,7 @@ var SectionBuilder = class extends ComponentBuilder {
|
|
|
2210
2330
|
};
|
|
2211
2331
|
|
|
2212
2332
|
// src/components/v2/Separator.ts
|
|
2213
|
-
var
|
|
2333
|
+
var import_v1022 = require("discord-api-types/v10");
|
|
2214
2334
|
var SeparatorBuilder = class extends ComponentBuilder {
|
|
2215
2335
|
static {
|
|
2216
2336
|
__name(this, "SeparatorBuilder");
|
|
@@ -2244,7 +2364,7 @@ var SeparatorBuilder = class extends ComponentBuilder {
|
|
|
2244
2364
|
super();
|
|
2245
2365
|
this.data = {
|
|
2246
2366
|
...structuredClone(data),
|
|
2247
|
-
type:
|
|
2367
|
+
type: import_v1022.ComponentType.Separator
|
|
2248
2368
|
};
|
|
2249
2369
|
}
|
|
2250
2370
|
/**
|
|
@@ -2308,7 +2428,7 @@ var ContainerBuilder = class extends ComponentBuilder {
|
|
|
2308
2428
|
this.data = {
|
|
2309
2429
|
...structuredClone(rest),
|
|
2310
2430
|
components: components.map((component) => createComponentBuilder(component)),
|
|
2311
|
-
type:
|
|
2431
|
+
type: import_v1023.ComponentType.Container
|
|
2312
2432
|
};
|
|
2313
2433
|
}
|
|
2314
2434
|
/**
|
|
@@ -2458,38 +2578,40 @@ function createComponentBuilder(data) {
|
|
|
2458
2578
|
return data;
|
|
2459
2579
|
}
|
|
2460
2580
|
switch (data.type) {
|
|
2461
|
-
case
|
|
2581
|
+
case import_v1024.ComponentType.ActionRow:
|
|
2462
2582
|
return new ActionRowBuilder(data);
|
|
2463
|
-
case
|
|
2583
|
+
case import_v1024.ComponentType.Button:
|
|
2464
2584
|
return createButtonBuilder(data);
|
|
2465
|
-
case
|
|
2585
|
+
case import_v1024.ComponentType.StringSelect:
|
|
2466
2586
|
return new StringSelectMenuBuilder(data);
|
|
2467
|
-
case
|
|
2587
|
+
case import_v1024.ComponentType.TextInput:
|
|
2468
2588
|
return new TextInputBuilder(data);
|
|
2469
|
-
case
|
|
2589
|
+
case import_v1024.ComponentType.UserSelect:
|
|
2470
2590
|
return new UserSelectMenuBuilder(data);
|
|
2471
|
-
case
|
|
2591
|
+
case import_v1024.ComponentType.RoleSelect:
|
|
2472
2592
|
return new RoleSelectMenuBuilder(data);
|
|
2473
|
-
case
|
|
2593
|
+
case import_v1024.ComponentType.MentionableSelect:
|
|
2474
2594
|
return new MentionableSelectMenuBuilder(data);
|
|
2475
|
-
case
|
|
2595
|
+
case import_v1024.ComponentType.ChannelSelect:
|
|
2476
2596
|
return new ChannelSelectMenuBuilder(data);
|
|
2477
|
-
case
|
|
2597
|
+
case import_v1024.ComponentType.Thumbnail:
|
|
2478
2598
|
return new ThumbnailBuilder(data);
|
|
2479
|
-
case
|
|
2599
|
+
case import_v1024.ComponentType.File:
|
|
2480
2600
|
return new FileBuilder(data);
|
|
2481
|
-
case
|
|
2601
|
+
case import_v1024.ComponentType.Separator:
|
|
2482
2602
|
return new SeparatorBuilder(data);
|
|
2483
|
-
case
|
|
2603
|
+
case import_v1024.ComponentType.TextDisplay:
|
|
2484
2604
|
return new TextDisplayBuilder(data);
|
|
2485
|
-
case
|
|
2605
|
+
case import_v1024.ComponentType.MediaGallery:
|
|
2486
2606
|
return new MediaGalleryBuilder(data);
|
|
2487
|
-
case
|
|
2607
|
+
case import_v1024.ComponentType.Section:
|
|
2488
2608
|
return new SectionBuilder(data);
|
|
2489
|
-
case
|
|
2609
|
+
case import_v1024.ComponentType.Container:
|
|
2490
2610
|
return new ContainerBuilder(data);
|
|
2491
|
-
case
|
|
2611
|
+
case import_v1024.ComponentType.Label:
|
|
2492
2612
|
return new LabelBuilder(data);
|
|
2613
|
+
case import_v1024.ComponentType.FileUpload:
|
|
2614
|
+
return new FileUploadBuilder(data);
|
|
2493
2615
|
default:
|
|
2494
2616
|
throw new Error(`Cannot properly serialize component type: ${data.type}`);
|
|
2495
2617
|
}
|
|
@@ -2497,17 +2619,17 @@ function createComponentBuilder(data) {
|
|
|
2497
2619
|
__name(createComponentBuilder, "createComponentBuilder");
|
|
2498
2620
|
function createButtonBuilder(data) {
|
|
2499
2621
|
switch (data.style) {
|
|
2500
|
-
case
|
|
2622
|
+
case import_v1024.ButtonStyle.Primary:
|
|
2501
2623
|
return new PrimaryButtonBuilder(data);
|
|
2502
|
-
case
|
|
2624
|
+
case import_v1024.ButtonStyle.Secondary:
|
|
2503
2625
|
return new SecondaryButtonBuilder(data);
|
|
2504
|
-
case
|
|
2626
|
+
case import_v1024.ButtonStyle.Success:
|
|
2505
2627
|
return new SuccessButtonBuilder(data);
|
|
2506
|
-
case
|
|
2628
|
+
case import_v1024.ButtonStyle.Danger:
|
|
2507
2629
|
return new DangerButtonBuilder(data);
|
|
2508
|
-
case
|
|
2630
|
+
case import_v1024.ButtonStyle.Link:
|
|
2509
2631
|
return new LinkButtonBuilder(data);
|
|
2510
|
-
case
|
|
2632
|
+
case import_v1024.ButtonStyle.Premium:
|
|
2511
2633
|
return new PremiumButtonBuilder(data);
|
|
2512
2634
|
default:
|
|
2513
2635
|
throw new Error(`Cannot properly serialize button with style: ${data.style}`);
|
|
@@ -2516,9 +2638,9 @@ function createButtonBuilder(data) {
|
|
|
2516
2638
|
__name(createButtonBuilder, "createButtonBuilder");
|
|
2517
2639
|
function resolveAccessoryComponent(component) {
|
|
2518
2640
|
switch (component.type) {
|
|
2519
|
-
case
|
|
2641
|
+
case import_v1024.ComponentType.Button:
|
|
2520
2642
|
return createButtonBuilder(component);
|
|
2521
|
-
case
|
|
2643
|
+
case import_v1024.ComponentType.Thumbnail:
|
|
2522
2644
|
return new ThumbnailBuilder(component);
|
|
2523
2645
|
default:
|
|
2524
2646
|
throw new Error(`Cannot properly serialize section accessory component: ${component.type}`);
|
|
@@ -2527,20 +2649,21 @@ function resolveAccessoryComponent(component) {
|
|
|
2527
2649
|
__name(resolveAccessoryComponent, "resolveAccessoryComponent");
|
|
2528
2650
|
|
|
2529
2651
|
// src/components/label/Assertions.ts
|
|
2530
|
-
var
|
|
2531
|
-
var
|
|
2532
|
-
var
|
|
2652
|
+
var import_v1025 = require("discord-api-types/v10");
|
|
2653
|
+
var import_zod7 = require("zod");
|
|
2654
|
+
var labelPredicate = import_zod7.z.object({
|
|
2533
2655
|
id: idPredicate,
|
|
2534
|
-
type:
|
|
2535
|
-
label:
|
|
2536
|
-
description:
|
|
2537
|
-
component:
|
|
2656
|
+
type: import_zod7.z.literal(import_v1025.ComponentType.Label),
|
|
2657
|
+
label: import_zod7.z.string().min(1).max(45),
|
|
2658
|
+
description: import_zod7.z.string().min(1).max(100).optional(),
|
|
2659
|
+
component: import_zod7.z.union([
|
|
2538
2660
|
selectMenuStringPredicate,
|
|
2539
2661
|
textInputPredicate,
|
|
2540
2662
|
selectMenuUserPredicate,
|
|
2541
2663
|
selectMenuRolePredicate,
|
|
2542
2664
|
selectMenuMentionablePredicate,
|
|
2543
|
-
selectMenuChannelPredicate
|
|
2665
|
+
selectMenuChannelPredicate,
|
|
2666
|
+
fileUploadPredicate
|
|
2544
2667
|
])
|
|
2545
2668
|
});
|
|
2546
2669
|
|
|
@@ -2579,9 +2702,8 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2579
2702
|
const { component, ...rest } = data;
|
|
2580
2703
|
this.data = {
|
|
2581
2704
|
...structuredClone(rest),
|
|
2582
|
-
// @ts-expect-error fixed in https://github.com/discordjs/discord.js/pull/11108
|
|
2583
2705
|
component: component ? createComponentBuilder(component) : void 0,
|
|
2584
|
-
type:
|
|
2706
|
+
type: import_v1026.ComponentType.Label
|
|
2585
2707
|
};
|
|
2586
2708
|
}
|
|
2587
2709
|
/**
|
|
@@ -2663,6 +2785,15 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2663
2785
|
this.data.component = resolveBuilder(input, TextInputBuilder);
|
|
2664
2786
|
return this;
|
|
2665
2787
|
}
|
|
2788
|
+
/**
|
|
2789
|
+
* Sets a file upload component to this label.
|
|
2790
|
+
*
|
|
2791
|
+
* @param input - A function that returns a component builder or an already built builder
|
|
2792
|
+
*/
|
|
2793
|
+
setFileUploadComponent(input) {
|
|
2794
|
+
this.data.component = resolveBuilder(input, FileUploadBuilder);
|
|
2795
|
+
return this;
|
|
2796
|
+
}
|
|
2666
2797
|
/**
|
|
2667
2798
|
* {@inheritDoc ComponentBuilder.toJSON}
|
|
2668
2799
|
*/
|
|
@@ -2673,7 +2804,7 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2673
2804
|
// The label predicate validates the component.
|
|
2674
2805
|
component: component?.toJSON(false)
|
|
2675
2806
|
};
|
|
2676
|
-
validate(
|
|
2807
|
+
validate(labelPredicate, data, validationOverride);
|
|
2677
2808
|
return data;
|
|
2678
2809
|
}
|
|
2679
2810
|
};
|
|
@@ -2718,18 +2849,18 @@ var ApplicationCommandNumericOptionMinMaxValueMixin = class {
|
|
|
2718
2849
|
};
|
|
2719
2850
|
|
|
2720
2851
|
// src/interactions/commands/chatInput/mixins/ApplicationCommandOptionChannelTypesMixin.ts
|
|
2721
|
-
var
|
|
2852
|
+
var import_v1027 = require("discord-api-types/v10");
|
|
2722
2853
|
var ApplicationCommandOptionAllowedChannelTypes = [
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2854
|
+
import_v1027.ChannelType.GuildText,
|
|
2855
|
+
import_v1027.ChannelType.GuildVoice,
|
|
2856
|
+
import_v1027.ChannelType.GuildCategory,
|
|
2857
|
+
import_v1027.ChannelType.GuildAnnouncement,
|
|
2858
|
+
import_v1027.ChannelType.AnnouncementThread,
|
|
2859
|
+
import_v1027.ChannelType.PublicThread,
|
|
2860
|
+
import_v1027.ChannelType.PrivateThread,
|
|
2861
|
+
import_v1027.ChannelType.GuildStageVoice,
|
|
2862
|
+
import_v1027.ChannelType.GuildForum,
|
|
2863
|
+
import_v1027.ChannelType.GuildMedia
|
|
2733
2864
|
];
|
|
2734
2865
|
var ApplicationCommandOptionChannelTypesMixin = class {
|
|
2735
2866
|
static {
|
|
@@ -2800,7 +2931,7 @@ var ApplicationCommandOptionWithChoicesMixin = class {
|
|
|
2800
2931
|
};
|
|
2801
2932
|
|
|
2802
2933
|
// src/interactions/commands/chatInput/options/attachment.ts
|
|
2803
|
-
var
|
|
2934
|
+
var import_v1029 = require("discord-api-types/v10");
|
|
2804
2935
|
|
|
2805
2936
|
// src/interactions/commands/SharedName.ts
|
|
2806
2937
|
var SharedName = class {
|
|
@@ -2917,34 +3048,34 @@ var SharedNameAndDescription = class extends SharedName {
|
|
|
2917
3048
|
};
|
|
2918
3049
|
|
|
2919
3050
|
// src/interactions/commands/chatInput/Assertions.ts
|
|
2920
|
-
var
|
|
2921
|
-
var
|
|
2922
|
-
var namePredicate =
|
|
2923
|
-
var descriptionPredicate =
|
|
2924
|
-
var sharedNameAndDescriptionPredicate =
|
|
3051
|
+
var import_v1028 = require("discord-api-types/v10");
|
|
3052
|
+
var import_zod8 = require("zod");
|
|
3053
|
+
var namePredicate = import_zod8.z.string().min(1).max(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
|
|
3054
|
+
var descriptionPredicate = import_zod8.z.string().min(1).max(100);
|
|
3055
|
+
var sharedNameAndDescriptionPredicate = import_zod8.z.object({
|
|
2925
3056
|
name: namePredicate,
|
|
2926
3057
|
name_localizations: localeMapPredicate.optional(),
|
|
2927
3058
|
description: descriptionPredicate,
|
|
2928
3059
|
description_localizations: localeMapPredicate.optional()
|
|
2929
3060
|
});
|
|
2930
|
-
var numericMixinNumberOptionPredicate =
|
|
2931
|
-
max_value:
|
|
2932
|
-
min_value:
|
|
3061
|
+
var numericMixinNumberOptionPredicate = import_zod8.z.object({
|
|
3062
|
+
max_value: import_zod8.z.float32().optional(),
|
|
3063
|
+
min_value: import_zod8.z.float32().optional()
|
|
2933
3064
|
});
|
|
2934
|
-
var numericMixinIntegerOptionPredicate =
|
|
2935
|
-
max_value:
|
|
2936
|
-
min_value:
|
|
3065
|
+
var numericMixinIntegerOptionPredicate = import_zod8.z.object({
|
|
3066
|
+
max_value: import_zod8.z.int().optional(),
|
|
3067
|
+
min_value: import_zod8.z.int().optional()
|
|
2937
3068
|
});
|
|
2938
|
-
var channelMixinOptionPredicate =
|
|
2939
|
-
channel_types:
|
|
3069
|
+
var channelMixinOptionPredicate = import_zod8.z.object({
|
|
3070
|
+
channel_types: import_zod8.z.literal(ApplicationCommandOptionAllowedChannelTypes).array().optional()
|
|
2940
3071
|
});
|
|
2941
|
-
var autocompleteMixinOptionPredicate =
|
|
2942
|
-
autocomplete:
|
|
2943
|
-
choices:
|
|
3072
|
+
var autocompleteMixinOptionPredicate = import_zod8.z.object({
|
|
3073
|
+
autocomplete: import_zod8.z.literal(true),
|
|
3074
|
+
choices: import_zod8.z.union([import_zod8.z.never(), import_zod8.z.never().array(), import_zod8.z.undefined()])
|
|
2944
3075
|
});
|
|
2945
|
-
var choiceValueStringPredicate =
|
|
2946
|
-
var choiceValueNumberPredicate =
|
|
2947
|
-
var choiceBasePredicate =
|
|
3076
|
+
var choiceValueStringPredicate = import_zod8.z.string().min(1).max(100);
|
|
3077
|
+
var choiceValueNumberPredicate = import_zod8.z.number();
|
|
3078
|
+
var choiceBasePredicate = import_zod8.z.object({
|
|
2948
3079
|
name: choiceValueStringPredicate,
|
|
2949
3080
|
name_localizations: localeMapPredicate.optional()
|
|
2950
3081
|
});
|
|
@@ -2954,8 +3085,8 @@ var choiceStringPredicate = choiceBasePredicate.extend({
|
|
|
2954
3085
|
var choiceNumberPredicate = choiceBasePredicate.extend({
|
|
2955
3086
|
value: choiceValueNumberPredicate
|
|
2956
3087
|
});
|
|
2957
|
-
var choiceBaseMixinPredicate =
|
|
2958
|
-
autocomplete:
|
|
3088
|
+
var choiceBaseMixinPredicate = import_zod8.z.object({
|
|
3089
|
+
autocomplete: import_zod8.z.literal(false).optional()
|
|
2959
3090
|
});
|
|
2960
3091
|
var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
2961
3092
|
choices: choiceStringPredicate.array().max(25).optional()
|
|
@@ -2963,66 +3094,70 @@ var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
|
2963
3094
|
var choiceNumberMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
2964
3095
|
choices: choiceNumberPredicate.array().max(25).optional()
|
|
2965
3096
|
});
|
|
2966
|
-
var basicOptionTypesPredicate =
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
3097
|
+
var basicOptionTypesPredicate = import_zod8.z.literal([
|
|
3098
|
+
import_v1028.ApplicationCommandOptionType.Attachment,
|
|
3099
|
+
import_v1028.ApplicationCommandOptionType.Boolean,
|
|
3100
|
+
import_v1028.ApplicationCommandOptionType.Channel,
|
|
3101
|
+
import_v1028.ApplicationCommandOptionType.Integer,
|
|
3102
|
+
import_v1028.ApplicationCommandOptionType.Mentionable,
|
|
3103
|
+
import_v1028.ApplicationCommandOptionType.Number,
|
|
3104
|
+
import_v1028.ApplicationCommandOptionType.Role,
|
|
3105
|
+
import_v1028.ApplicationCommandOptionType.String,
|
|
3106
|
+
import_v1028.ApplicationCommandOptionType.User
|
|
2976
3107
|
]);
|
|
2977
3108
|
var basicOptionPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2978
|
-
required:
|
|
3109
|
+
required: import_zod8.z.boolean().optional(),
|
|
2979
3110
|
type: basicOptionTypesPredicate
|
|
2980
3111
|
});
|
|
2981
|
-
var autocompleteOrStringChoicesMixinOptionPredicate =
|
|
3112
|
+
var autocompleteOrStringChoicesMixinOptionPredicate = import_zod8.z.discriminatedUnion("autocomplete", [
|
|
2982
3113
|
autocompleteMixinOptionPredicate,
|
|
2983
3114
|
choiceStringMixinPredicate
|
|
2984
3115
|
]);
|
|
2985
|
-
var autocompleteOrNumberChoicesMixinOptionPredicate =
|
|
3116
|
+
var autocompleteOrNumberChoicesMixinOptionPredicate = import_zod8.z.discriminatedUnion("autocomplete", [
|
|
2986
3117
|
autocompleteMixinOptionPredicate,
|
|
2987
3118
|
choiceNumberMixinPredicate
|
|
2988
3119
|
]);
|
|
2989
|
-
var channelOptionPredicate =
|
|
3120
|
+
var channelOptionPredicate = import_zod8.z.object({
|
|
2990
3121
|
...basicOptionPredicate.shape,
|
|
2991
3122
|
...channelMixinOptionPredicate.shape
|
|
2992
3123
|
});
|
|
2993
|
-
var integerOptionPredicate =
|
|
3124
|
+
var integerOptionPredicate = import_zod8.z.object({
|
|
2994
3125
|
...basicOptionPredicate.shape,
|
|
2995
3126
|
...numericMixinIntegerOptionPredicate.shape
|
|
2996
3127
|
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
2997
|
-
var numberOptionPredicate =
|
|
3128
|
+
var numberOptionPredicate = import_zod8.z.object({
|
|
2998
3129
|
...basicOptionPredicate.shape,
|
|
2999
3130
|
...numericMixinNumberOptionPredicate.shape
|
|
3000
3131
|
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
3001
3132
|
var stringOptionPredicate = basicOptionPredicate.extend({
|
|
3002
|
-
max_length:
|
|
3003
|
-
min_length:
|
|
3133
|
+
max_length: import_zod8.z.number().min(1).max(6e3).optional(),
|
|
3134
|
+
min_length: import_zod8.z.number().min(0).max(6e3).optional()
|
|
3004
3135
|
}).and(autocompleteOrStringChoicesMixinOptionPredicate);
|
|
3005
3136
|
var baseChatInputCommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
3006
|
-
contexts:
|
|
3137
|
+
contexts: import_zod8.z.array(import_zod8.z.enum(import_v1028.InteractionContextType)).optional(),
|
|
3007
3138
|
default_member_permissions: memberPermissionsPredicate.optional(),
|
|
3008
|
-
integration_types:
|
|
3009
|
-
nsfw:
|
|
3139
|
+
integration_types: import_zod8.z.array(import_zod8.z.enum(import_v1028.ApplicationIntegrationType)).optional(),
|
|
3140
|
+
nsfw: import_zod8.z.boolean().optional()
|
|
3010
3141
|
});
|
|
3011
|
-
var chatInputCommandOptionsPredicate =
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3142
|
+
var chatInputCommandOptionsPredicate = import_zod8.z.union([
|
|
3143
|
+
import_zod8.z.object({ type: basicOptionTypesPredicate }).array(),
|
|
3144
|
+
import_zod8.z.object({
|
|
3145
|
+
type: import_zod8.z.union([
|
|
3146
|
+
import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.Subcommand),
|
|
3147
|
+
import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.SubcommandGroup)
|
|
3148
|
+
])
|
|
3149
|
+
}).array()
|
|
3015
3150
|
]);
|
|
3016
3151
|
var chatInputCommandPredicate = baseChatInputCommandPredicate.extend({
|
|
3017
3152
|
options: chatInputCommandOptionsPredicate.optional()
|
|
3018
3153
|
});
|
|
3019
3154
|
var chatInputCommandSubcommandGroupPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
3020
|
-
type:
|
|
3021
|
-
options:
|
|
3155
|
+
type: import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.SubcommandGroup),
|
|
3156
|
+
options: import_zod8.z.array(import_zod8.z.object({ type: import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.Subcommand) })).min(1).max(25)
|
|
3022
3157
|
});
|
|
3023
3158
|
var chatInputCommandSubcommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
3024
|
-
type:
|
|
3025
|
-
options:
|
|
3159
|
+
type: import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.Subcommand),
|
|
3160
|
+
options: import_zod8.z.array(import_zod8.z.object({ type: basicOptionTypesPredicate })).max(25)
|
|
3026
3161
|
});
|
|
3027
3162
|
|
|
3028
3163
|
// src/interactions/commands/chatInput/options/ApplicationCommandOptionBase.ts
|
|
@@ -3075,12 +3210,12 @@ var ChatInputCommandAttachmentOption = class extends ApplicationCommandOptionBas
|
|
|
3075
3210
|
* Creates a new attachment option.
|
|
3076
3211
|
*/
|
|
3077
3212
|
constructor() {
|
|
3078
|
-
super(
|
|
3213
|
+
super(import_v1029.ApplicationCommandOptionType.Attachment);
|
|
3079
3214
|
}
|
|
3080
3215
|
};
|
|
3081
3216
|
|
|
3082
3217
|
// src/interactions/commands/chatInput/options/boolean.ts
|
|
3083
|
-
var
|
|
3218
|
+
var import_v1030 = require("discord-api-types/v10");
|
|
3084
3219
|
var ChatInputCommandBooleanOption = class extends ApplicationCommandOptionBase {
|
|
3085
3220
|
static {
|
|
3086
3221
|
__name(this, "ChatInputCommandBooleanOption");
|
|
@@ -3089,12 +3224,12 @@ var ChatInputCommandBooleanOption = class extends ApplicationCommandOptionBase {
|
|
|
3089
3224
|
* Creates a new boolean option.
|
|
3090
3225
|
*/
|
|
3091
3226
|
constructor() {
|
|
3092
|
-
super(
|
|
3227
|
+
super(import_v1030.ApplicationCommandOptionType.Boolean);
|
|
3093
3228
|
}
|
|
3094
3229
|
};
|
|
3095
3230
|
|
|
3096
3231
|
// src/interactions/commands/chatInput/options/channel.ts
|
|
3097
|
-
var
|
|
3232
|
+
var import_v1031 = require("discord-api-types/v10");
|
|
3098
3233
|
var import_ts_mixer3 = require("ts-mixer");
|
|
3099
3234
|
var ChatInputCommandChannelOption = class extends (0, import_ts_mixer3.Mixin)(
|
|
3100
3235
|
ApplicationCommandOptionBase,
|
|
@@ -3111,12 +3246,12 @@ var ChatInputCommandChannelOption = class extends (0, import_ts_mixer3.Mixin)(
|
|
|
3111
3246
|
* Creates a new channel option.
|
|
3112
3247
|
*/
|
|
3113
3248
|
constructor() {
|
|
3114
|
-
super(
|
|
3249
|
+
super(import_v1031.ApplicationCommandOptionType.Channel);
|
|
3115
3250
|
}
|
|
3116
3251
|
};
|
|
3117
3252
|
|
|
3118
3253
|
// src/interactions/commands/chatInput/options/integer.ts
|
|
3119
|
-
var
|
|
3254
|
+
var import_v1032 = require("discord-api-types/v10");
|
|
3120
3255
|
var import_ts_mixer4 = require("ts-mixer");
|
|
3121
3256
|
var ChatInputCommandIntegerOption = class extends (0, import_ts_mixer4.Mixin)(
|
|
3122
3257
|
ApplicationCommandOptionBase,
|
|
@@ -3135,12 +3270,12 @@ var ChatInputCommandIntegerOption = class extends (0, import_ts_mixer4.Mixin)(
|
|
|
3135
3270
|
* Creates a new integer option.
|
|
3136
3271
|
*/
|
|
3137
3272
|
constructor() {
|
|
3138
|
-
super(
|
|
3273
|
+
super(import_v1032.ApplicationCommandOptionType.Integer);
|
|
3139
3274
|
}
|
|
3140
3275
|
};
|
|
3141
3276
|
|
|
3142
3277
|
// src/interactions/commands/chatInput/options/mentionable.ts
|
|
3143
|
-
var
|
|
3278
|
+
var import_v1033 = require("discord-api-types/v10");
|
|
3144
3279
|
var ChatInputCommandMentionableOption = class extends ApplicationCommandOptionBase {
|
|
3145
3280
|
static {
|
|
3146
3281
|
__name(this, "ChatInputCommandMentionableOption");
|
|
@@ -3149,12 +3284,12 @@ var ChatInputCommandMentionableOption = class extends ApplicationCommandOptionBa
|
|
|
3149
3284
|
* Creates a new mentionable option.
|
|
3150
3285
|
*/
|
|
3151
3286
|
constructor() {
|
|
3152
|
-
super(
|
|
3287
|
+
super(import_v1033.ApplicationCommandOptionType.Mentionable);
|
|
3153
3288
|
}
|
|
3154
3289
|
};
|
|
3155
3290
|
|
|
3156
3291
|
// src/interactions/commands/chatInput/options/number.ts
|
|
3157
|
-
var
|
|
3292
|
+
var import_v1034 = require("discord-api-types/v10");
|
|
3158
3293
|
var import_ts_mixer5 = require("ts-mixer");
|
|
3159
3294
|
var ChatInputCommandNumberOption = class extends (0, import_ts_mixer5.Mixin)(
|
|
3160
3295
|
ApplicationCommandOptionBase,
|
|
@@ -3173,12 +3308,12 @@ var ChatInputCommandNumberOption = class extends (0, import_ts_mixer5.Mixin)(
|
|
|
3173
3308
|
* Creates a new number option.
|
|
3174
3309
|
*/
|
|
3175
3310
|
constructor() {
|
|
3176
|
-
super(
|
|
3311
|
+
super(import_v1034.ApplicationCommandOptionType.Number);
|
|
3177
3312
|
}
|
|
3178
3313
|
};
|
|
3179
3314
|
|
|
3180
3315
|
// src/interactions/commands/chatInput/options/role.ts
|
|
3181
|
-
var
|
|
3316
|
+
var import_v1035 = require("discord-api-types/v10");
|
|
3182
3317
|
var ChatInputCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
3183
3318
|
static {
|
|
3184
3319
|
__name(this, "ChatInputCommandRoleOption");
|
|
@@ -3187,12 +3322,12 @@ var ChatInputCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
|
3187
3322
|
* Creates a new role option.
|
|
3188
3323
|
*/
|
|
3189
3324
|
constructor() {
|
|
3190
|
-
super(
|
|
3325
|
+
super(import_v1035.ApplicationCommandOptionType.Role);
|
|
3191
3326
|
}
|
|
3192
3327
|
};
|
|
3193
3328
|
|
|
3194
3329
|
// src/interactions/commands/chatInput/options/string.ts
|
|
3195
|
-
var
|
|
3330
|
+
var import_v1036 = require("discord-api-types/v10");
|
|
3196
3331
|
var import_ts_mixer6 = require("ts-mixer");
|
|
3197
3332
|
var ChatInputCommandStringOption = class extends (0, import_ts_mixer6.Mixin)(
|
|
3198
3333
|
ApplicationCommandOptionBase,
|
|
@@ -3210,7 +3345,7 @@ var ChatInputCommandStringOption = class extends (0, import_ts_mixer6.Mixin)(
|
|
|
3210
3345
|
* Creates a new string option builder.
|
|
3211
3346
|
*/
|
|
3212
3347
|
constructor() {
|
|
3213
|
-
super(
|
|
3348
|
+
super(import_v1036.ApplicationCommandOptionType.String);
|
|
3214
3349
|
}
|
|
3215
3350
|
/**
|
|
3216
3351
|
* Sets the maximum length of this string option.
|
|
@@ -3247,7 +3382,7 @@ var ChatInputCommandStringOption = class extends (0, import_ts_mixer6.Mixin)(
|
|
|
3247
3382
|
};
|
|
3248
3383
|
|
|
3249
3384
|
// src/interactions/commands/chatInput/options/user.ts
|
|
3250
|
-
var
|
|
3385
|
+
var import_v1037 = require("discord-api-types/v10");
|
|
3251
3386
|
var ChatInputCommandUserOption = class extends ApplicationCommandOptionBase {
|
|
3252
3387
|
static {
|
|
3253
3388
|
__name(this, "ChatInputCommandUserOption");
|
|
@@ -3256,7 +3391,7 @@ var ChatInputCommandUserOption = class extends ApplicationCommandOptionBase {
|
|
|
3256
3391
|
* Creates a new user option.
|
|
3257
3392
|
*/
|
|
3258
3393
|
constructor() {
|
|
3259
|
-
super(
|
|
3394
|
+
super(import_v1037.ApplicationCommandOptionType.User);
|
|
3260
3395
|
}
|
|
3261
3396
|
};
|
|
3262
3397
|
|
|
@@ -3391,7 +3526,7 @@ var SharedChatInputCommandOptions = class {
|
|
|
3391
3526
|
};
|
|
3392
3527
|
|
|
3393
3528
|
// src/interactions/commands/chatInput/ChatInputCommandSubcommands.ts
|
|
3394
|
-
var
|
|
3529
|
+
var import_v1038 = require("discord-api-types/v10");
|
|
3395
3530
|
var import_ts_mixer7 = require("ts-mixer");
|
|
3396
3531
|
var ChatInputCommandSubcommandGroupBuilder = class extends SharedNameAndDescription {
|
|
3397
3532
|
static {
|
|
@@ -3426,7 +3561,7 @@ var ChatInputCommandSubcommandGroupBuilder = class extends SharedNameAndDescript
|
|
|
3426
3561
|
const { options, ...rest } = this.data;
|
|
3427
3562
|
const data = {
|
|
3428
3563
|
...structuredClone(rest),
|
|
3429
|
-
type:
|
|
3564
|
+
type: import_v1038.ApplicationCommandOptionType.SubcommandGroup,
|
|
3430
3565
|
options: options?.map((option) => option.toJSON(validationOverride)) ?? []
|
|
3431
3566
|
};
|
|
3432
3567
|
validate(chatInputCommandSubcommandGroupPredicate, data, validationOverride);
|
|
@@ -3448,7 +3583,7 @@ var ChatInputCommandSubcommandBuilder = class extends (0, import_ts_mixer7.Mixin
|
|
|
3448
3583
|
const { options, ...rest } = this.data;
|
|
3449
3584
|
const data = {
|
|
3450
3585
|
...structuredClone(rest),
|
|
3451
|
-
type:
|
|
3586
|
+
type: import_v1038.ApplicationCommandOptionType.Subcommand,
|
|
3452
3587
|
options: options?.map((option) => option.toJSON(validationOverride)) ?? []
|
|
3453
3588
|
};
|
|
3454
3589
|
validate(chatInputCommandSubcommandPredicate, data, validationOverride);
|
|
@@ -3488,7 +3623,7 @@ var SharedChatInputCommandSubcommands = class {
|
|
|
3488
3623
|
};
|
|
3489
3624
|
|
|
3490
3625
|
// src/interactions/commands/chatInput/ChatInputCommand.ts
|
|
3491
|
-
var
|
|
3626
|
+
var import_v1039 = require("discord-api-types/v10");
|
|
3492
3627
|
var import_ts_mixer8 = require("ts-mixer");
|
|
3493
3628
|
|
|
3494
3629
|
// src/interactions/commands/Command.ts
|
|
@@ -3561,7 +3696,7 @@ var ChatInputCommandBuilder = class extends (0, import_ts_mixer8.Mixin)(
|
|
|
3561
3696
|
const { options, ...rest } = this.data;
|
|
3562
3697
|
const data = {
|
|
3563
3698
|
...structuredClone(rest),
|
|
3564
|
-
type:
|
|
3699
|
+
type: import_v1039.ApplicationCommandType.ChatInput,
|
|
3565
3700
|
options: options?.map((option) => option.toJSON(validationOverride))
|
|
3566
3701
|
};
|
|
3567
3702
|
validate(chatInputCommandPredicate, data, validationOverride);
|
|
@@ -3570,26 +3705,26 @@ var ChatInputCommandBuilder = class extends (0, import_ts_mixer8.Mixin)(
|
|
|
3570
3705
|
};
|
|
3571
3706
|
|
|
3572
3707
|
// src/interactions/commands/contextMenu/Assertions.ts
|
|
3573
|
-
var
|
|
3574
|
-
var
|
|
3575
|
-
var namePredicate2 =
|
|
3708
|
+
var import_v1040 = require("discord-api-types/v10");
|
|
3709
|
+
var import_zod9 = require("zod");
|
|
3710
|
+
var namePredicate2 = import_zod9.z.string().min(1).max(32).refine((val) => val.trim().length > 0, {
|
|
3576
3711
|
error: "Must not consist of only whitespace."
|
|
3577
3712
|
});
|
|
3578
|
-
var contextsPredicate =
|
|
3579
|
-
var integrationTypesPredicate =
|
|
3580
|
-
var baseContextMenuCommandPredicate =
|
|
3713
|
+
var contextsPredicate = import_zod9.z.array(import_zod9.z.enum(import_v1040.InteractionContextType));
|
|
3714
|
+
var integrationTypesPredicate = import_zod9.z.array(import_zod9.z.enum(import_v1040.ApplicationIntegrationType));
|
|
3715
|
+
var baseContextMenuCommandPredicate = import_zod9.z.object({
|
|
3581
3716
|
contexts: contextsPredicate.optional(),
|
|
3582
3717
|
default_member_permissions: memberPermissionsPredicate.optional(),
|
|
3583
3718
|
name: namePredicate2,
|
|
3584
3719
|
name_localizations: localeMapPredicate.optional(),
|
|
3585
3720
|
integration_types: integrationTypesPredicate.optional(),
|
|
3586
|
-
nsfw:
|
|
3721
|
+
nsfw: import_zod9.z.boolean().optional()
|
|
3587
3722
|
});
|
|
3588
3723
|
var userCommandPredicate = baseContextMenuCommandPredicate.extend({
|
|
3589
|
-
type:
|
|
3724
|
+
type: import_zod9.z.literal(import_v1040.ApplicationCommandType.User)
|
|
3590
3725
|
});
|
|
3591
3726
|
var messageCommandPredicate = baseContextMenuCommandPredicate.extend({
|
|
3592
|
-
type:
|
|
3727
|
+
type: import_zod9.z.literal(import_v1040.ApplicationCommandType.Message)
|
|
3593
3728
|
});
|
|
3594
3729
|
|
|
3595
3730
|
// src/interactions/commands/contextMenu/ContextMenuCommand.ts
|
|
@@ -3619,7 +3754,7 @@ var ContextMenuCommandBuilder = class extends (0, import_ts_mixer9.Mixin)(
|
|
|
3619
3754
|
};
|
|
3620
3755
|
|
|
3621
3756
|
// src/interactions/commands/contextMenu/MessageCommand.ts
|
|
3622
|
-
var
|
|
3757
|
+
var import_v1041 = require("discord-api-types/v10");
|
|
3623
3758
|
var MessageContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
3624
3759
|
static {
|
|
3625
3760
|
__name(this, "MessageContextCommandBuilder");
|
|
@@ -3628,14 +3763,14 @@ var MessageContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
|
3628
3763
|
* {@inheritDoc CommandBuilder.toJSON}
|
|
3629
3764
|
*/
|
|
3630
3765
|
toJSON(validationOverride) {
|
|
3631
|
-
const data = { ...structuredClone(this.data), type:
|
|
3766
|
+
const data = { ...structuredClone(this.data), type: import_v1041.ApplicationCommandType.Message };
|
|
3632
3767
|
validate(messageCommandPredicate, data, validationOverride);
|
|
3633
3768
|
return data;
|
|
3634
3769
|
}
|
|
3635
3770
|
};
|
|
3636
3771
|
|
|
3637
3772
|
// src/interactions/commands/contextMenu/UserCommand.ts
|
|
3638
|
-
var
|
|
3773
|
+
var import_v1042 = require("discord-api-types/v10");
|
|
3639
3774
|
var UserContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
3640
3775
|
static {
|
|
3641
3776
|
__name(this, "UserContextCommandBuilder");
|
|
@@ -3644,25 +3779,25 @@ var UserContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
|
3644
3779
|
* {@inheritDoc CommandBuilder.toJSON}
|
|
3645
3780
|
*/
|
|
3646
3781
|
toJSON(validationOverride) {
|
|
3647
|
-
const data = { ...structuredClone(this.data), type:
|
|
3782
|
+
const data = { ...structuredClone(this.data), type: import_v1042.ApplicationCommandType.User };
|
|
3648
3783
|
validate(userCommandPredicate, data, validationOverride);
|
|
3649
3784
|
return data;
|
|
3650
3785
|
}
|
|
3651
3786
|
};
|
|
3652
3787
|
|
|
3653
3788
|
// src/interactions/modals/Assertions.ts
|
|
3654
|
-
var
|
|
3655
|
-
var
|
|
3656
|
-
var titlePredicate =
|
|
3657
|
-
var modalPredicate =
|
|
3789
|
+
var import_v1043 = require("discord-api-types/v10");
|
|
3790
|
+
var import_zod10 = require("zod");
|
|
3791
|
+
var titlePredicate = import_zod10.z.string().min(1).max(45);
|
|
3792
|
+
var modalPredicate = import_zod10.z.object({
|
|
3658
3793
|
title: titlePredicate,
|
|
3659
3794
|
custom_id: customIdPredicate,
|
|
3660
|
-
components:
|
|
3661
|
-
|
|
3662
|
-
type:
|
|
3663
|
-
components:
|
|
3795
|
+
components: import_zod10.z.union([
|
|
3796
|
+
import_zod10.z.object({
|
|
3797
|
+
type: import_zod10.z.literal(import_v1043.ComponentType.ActionRow),
|
|
3798
|
+
components: import_zod10.z.object({ type: import_zod10.z.literal(import_v1043.ComponentType.TextInput) }).array().length(1)
|
|
3664
3799
|
}),
|
|
3665
|
-
|
|
3800
|
+
labelPredicate,
|
|
3666
3801
|
textDisplayPredicate
|
|
3667
3802
|
]).array().min(1).max(5)
|
|
3668
3803
|
});
|
|
@@ -3691,7 +3826,6 @@ var ModalBuilder = class {
|
|
|
3691
3826
|
const { components = [], ...rest } = data;
|
|
3692
3827
|
this.data = {
|
|
3693
3828
|
...structuredClone(rest),
|
|
3694
|
-
// @ts-expect-error fixed in https://github.com/discordjs/discord.js/pull/11108
|
|
3695
3829
|
components: components.map((component) => createComponentBuilder(component))
|
|
3696
3830
|
};
|
|
3697
3831
|
}
|
|
@@ -3787,49 +3921,42 @@ var ModalBuilder = class {
|
|
|
3787
3921
|
};
|
|
3788
3922
|
|
|
3789
3923
|
// src/messages/embed/Assertions.ts
|
|
3790
|
-
var
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
__name(embedLength, "embedLength");
|
|
3797
|
-
|
|
3798
|
-
// src/messages/embed/Assertions.ts
|
|
3799
|
-
var namePredicate3 = import_zod10.z.string().max(256);
|
|
3800
|
-
var URLPredicate = import_zod10.z.url({ protocol: /^https?$/ });
|
|
3801
|
-
var URLWithAttachmentProtocolPredicate = import_zod10.z.url({ protocol: /^(?:https?|attachment)$/ });
|
|
3802
|
-
var embedFieldPredicate = import_zod10.z.object({
|
|
3924
|
+
var import_util = require("@discordjs/util");
|
|
3925
|
+
var import_zod11 = require("zod");
|
|
3926
|
+
var namePredicate3 = import_zod11.z.string().max(256);
|
|
3927
|
+
var URLPredicate = import_zod11.z.url({ protocol: /^https?$/ });
|
|
3928
|
+
var URLWithAttachmentProtocolPredicate = import_zod11.z.url({ protocol: /^(?:https?|attachment)$/ });
|
|
3929
|
+
var embedFieldPredicate = import_zod11.z.object({
|
|
3803
3930
|
name: namePredicate3,
|
|
3804
|
-
value:
|
|
3805
|
-
inline:
|
|
3931
|
+
value: import_zod11.z.string().max(1024),
|
|
3932
|
+
inline: import_zod11.z.boolean().optional()
|
|
3806
3933
|
});
|
|
3807
|
-
var embedAuthorPredicate =
|
|
3934
|
+
var embedAuthorPredicate = import_zod11.z.object({
|
|
3808
3935
|
name: namePredicate3.min(1),
|
|
3809
3936
|
icon_url: URLWithAttachmentProtocolPredicate.optional(),
|
|
3810
3937
|
url: URLPredicate.optional()
|
|
3811
3938
|
});
|
|
3812
|
-
var embedFooterPredicate =
|
|
3813
|
-
text:
|
|
3939
|
+
var embedFooterPredicate = import_zod11.z.object({
|
|
3940
|
+
text: import_zod11.z.string().min(1).max(2048),
|
|
3814
3941
|
icon_url: URLWithAttachmentProtocolPredicate.optional()
|
|
3815
3942
|
});
|
|
3816
|
-
var embedPredicate =
|
|
3943
|
+
var embedPredicate = import_zod11.z.object({
|
|
3817
3944
|
title: namePredicate3.min(1).optional(),
|
|
3818
|
-
description:
|
|
3945
|
+
description: import_zod11.z.string().min(1).max(4096).optional(),
|
|
3819
3946
|
url: URLPredicate.optional(),
|
|
3820
|
-
timestamp:
|
|
3821
|
-
color:
|
|
3947
|
+
timestamp: import_zod11.z.string().optional(),
|
|
3948
|
+
color: import_zod11.z.int().min(0).max(16777215).optional(),
|
|
3822
3949
|
footer: embedFooterPredicate.optional(),
|
|
3823
|
-
image:
|
|
3824
|
-
thumbnail:
|
|
3950
|
+
image: import_zod11.z.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
|
|
3951
|
+
thumbnail: import_zod11.z.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
|
|
3825
3952
|
author: embedAuthorPredicate.optional(),
|
|
3826
|
-
fields:
|
|
3953
|
+
fields: import_zod11.z.array(embedFieldPredicate).max(25).optional()
|
|
3827
3954
|
}).refine(
|
|
3828
3955
|
(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,
|
|
3829
3956
|
{
|
|
3830
3957
|
error: "Embed must have at least a title, description, a field, a footer, an author, an image, OR a thumbnail."
|
|
3831
3958
|
}
|
|
3832
|
-
).refine((embed) => embedLength(embed) <= 6e3, { error: "Embeds must not exceed 6000 characters in total." });
|
|
3959
|
+
).refine((embed) => (0, import_util.embedLength)(embed) <= 6e3, { error: "Embeds must not exceed 6000 characters in total." });
|
|
3833
3960
|
|
|
3834
3961
|
// src/messages/embed/EmbedAuthor.ts
|
|
3835
3962
|
var EmbedAuthorBuilder = class {
|
|
@@ -4308,20 +4435,20 @@ var EmbedBuilder = class {
|
|
|
4308
4435
|
};
|
|
4309
4436
|
|
|
4310
4437
|
// src/messages/poll/Assertions.ts
|
|
4311
|
-
var
|
|
4312
|
-
var
|
|
4313
|
-
var pollQuestionPredicate =
|
|
4314
|
-
var pollAnswerMediaPredicate =
|
|
4315
|
-
text:
|
|
4438
|
+
var import_v1044 = require("discord-api-types/v10");
|
|
4439
|
+
var import_zod12 = require("zod");
|
|
4440
|
+
var pollQuestionPredicate = import_zod12.z.object({ text: import_zod12.z.string().min(1).max(300) });
|
|
4441
|
+
var pollAnswerMediaPredicate = import_zod12.z.object({
|
|
4442
|
+
text: import_zod12.z.string().min(1).max(55),
|
|
4316
4443
|
emoji: emojiPredicate.optional()
|
|
4317
4444
|
});
|
|
4318
|
-
var pollAnswerPredicate =
|
|
4319
|
-
var pollPredicate =
|
|
4445
|
+
var pollAnswerPredicate = import_zod12.z.object({ poll_media: pollAnswerMediaPredicate });
|
|
4446
|
+
var pollPredicate = import_zod12.z.object({
|
|
4320
4447
|
question: pollQuestionPredicate,
|
|
4321
|
-
answers:
|
|
4322
|
-
duration:
|
|
4323
|
-
allow_multiselect:
|
|
4324
|
-
layout_type:
|
|
4448
|
+
answers: import_zod12.z.array(pollAnswerPredicate).min(1).max(10),
|
|
4449
|
+
duration: import_zod12.z.number().min(1).max(768).optional(),
|
|
4450
|
+
allow_multiselect: import_zod12.z.boolean().optional(),
|
|
4451
|
+
layout_type: import_zod12.z.enum(import_v1044.PollLayoutType).optional()
|
|
4325
4452
|
});
|
|
4326
4453
|
|
|
4327
4454
|
// src/messages/poll/PollMedia.ts
|
|
@@ -4650,95 +4777,109 @@ var PollBuilder = class {
|
|
|
4650
4777
|
};
|
|
4651
4778
|
|
|
4652
4779
|
// src/messages/Assertions.ts
|
|
4653
|
-
var
|
|
4654
|
-
var
|
|
4655
|
-
var
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4780
|
+
var import_node_buffer = require("buffer");
|
|
4781
|
+
var import_v1045 = require("discord-api-types/v10");
|
|
4782
|
+
var import_zod13 = require("zod");
|
|
4783
|
+
var fileKeyRegex = /^files\[(?<placeholder>\d+?)]$/;
|
|
4784
|
+
var rawFilePredicate = import_zod13.z.object({
|
|
4785
|
+
data: import_zod13.z.union([import_zod13.z.instanceof(import_node_buffer.Buffer), import_zod13.z.instanceof(Uint8Array), import_zod13.z.string()]),
|
|
4786
|
+
name: import_zod13.z.string().min(1),
|
|
4787
|
+
contentType: import_zod13.z.string().optional(),
|
|
4788
|
+
key: import_zod13.z.string().regex(fileKeyRegex).optional()
|
|
4662
4789
|
});
|
|
4663
|
-
var
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4790
|
+
var attachmentPredicate = import_zod13.z.object({
|
|
4791
|
+
// As a string it only makes sense for edits when we do have an attachment snowflake
|
|
4792
|
+
id: import_zod13.z.union([snowflakePredicate, import_zod13.z.number()]),
|
|
4793
|
+
description: import_zod13.z.string().max(1024).optional(),
|
|
4794
|
+
duration_secs: import_zod13.z.number().max(2 ** 31 - 1).optional(),
|
|
4795
|
+
filename: import_zod13.z.string().max(1024).optional(),
|
|
4796
|
+
title: import_zod13.z.string().max(1024).optional(),
|
|
4797
|
+
waveform: import_zod13.z.string().max(400).optional()
|
|
4798
|
+
});
|
|
4799
|
+
var allowedMentionPredicate = import_zod13.z.object({
|
|
4800
|
+
parse: import_zod13.z.enum(import_v1045.AllowedMentionsTypes).array().optional(),
|
|
4801
|
+
roles: import_zod13.z.string().array().max(100).optional(),
|
|
4802
|
+
users: import_zod13.z.string().array().max(100).optional(),
|
|
4803
|
+
replied_user: import_zod13.z.boolean().optional()
|
|
4668
4804
|
}).refine(
|
|
4669
|
-
(data) => !(data.parse?.includes(
|
|
4805
|
+
(data) => !(data.parse?.includes(import_v1045.AllowedMentionsTypes.User) && data.users?.length || data.parse?.includes(import_v1045.AllowedMentionsTypes.Role) && data.roles?.length),
|
|
4670
4806
|
{
|
|
4671
4807
|
error: 'Cannot specify both parse: ["users"] and non-empty users array, or parse: ["roles"] and non-empty roles array. These are mutually exclusive'
|
|
4672
4808
|
}
|
|
4673
4809
|
);
|
|
4674
|
-
var messageReferencePredicate =
|
|
4675
|
-
channel_id:
|
|
4676
|
-
fail_if_not_exists:
|
|
4677
|
-
guild_id:
|
|
4678
|
-
message_id:
|
|
4679
|
-
type:
|
|
4810
|
+
var messageReferencePredicate = import_zod13.z.object({
|
|
4811
|
+
channel_id: import_zod13.z.string().optional(),
|
|
4812
|
+
fail_if_not_exists: import_zod13.z.boolean().optional(),
|
|
4813
|
+
guild_id: import_zod13.z.string().optional(),
|
|
4814
|
+
message_id: import_zod13.z.string(),
|
|
4815
|
+
type: import_zod13.z.enum(import_v1045.MessageReferenceType).optional()
|
|
4680
4816
|
});
|
|
4681
|
-
var baseMessagePredicate =
|
|
4682
|
-
nonce:
|
|
4683
|
-
tts:
|
|
4817
|
+
var baseMessagePredicate = import_zod13.z.object({
|
|
4818
|
+
nonce: import_zod13.z.union([import_zod13.z.string().max(25), import_zod13.z.number()]).optional(),
|
|
4819
|
+
tts: import_zod13.z.boolean().optional(),
|
|
4684
4820
|
allowed_mentions: allowedMentionPredicate.optional(),
|
|
4685
4821
|
message_reference: messageReferencePredicate.optional(),
|
|
4686
4822
|
attachments: attachmentPredicate.array().max(10).optional(),
|
|
4687
|
-
enforce_nonce:
|
|
4823
|
+
enforce_nonce: import_zod13.z.boolean().optional()
|
|
4688
4824
|
});
|
|
4689
|
-
var basicActionRowPredicate =
|
|
4690
|
-
type:
|
|
4691
|
-
components:
|
|
4692
|
-
type:
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4825
|
+
var basicActionRowPredicate = import_zod13.z.object({
|
|
4826
|
+
type: import_zod13.z.literal(import_v1045.ComponentType.ActionRow),
|
|
4827
|
+
components: import_zod13.z.object({
|
|
4828
|
+
type: import_zod13.z.literal([
|
|
4829
|
+
import_v1045.ComponentType.Button,
|
|
4830
|
+
import_v1045.ComponentType.ChannelSelect,
|
|
4831
|
+
import_v1045.ComponentType.MentionableSelect,
|
|
4832
|
+
import_v1045.ComponentType.RoleSelect,
|
|
4833
|
+
import_v1045.ComponentType.StringSelect,
|
|
4834
|
+
import_v1045.ComponentType.UserSelect
|
|
4699
4835
|
])
|
|
4700
4836
|
}).array()
|
|
4701
4837
|
});
|
|
4702
4838
|
var messageNoComponentsV2Predicate = baseMessagePredicate.extend({
|
|
4703
|
-
content:
|
|
4839
|
+
content: import_zod13.z.string().max(2e3).optional(),
|
|
4704
4840
|
embeds: embedPredicate.array().max(10).optional(),
|
|
4705
|
-
sticker_ids:
|
|
4841
|
+
sticker_ids: import_zod13.z.array(import_zod13.z.string()).max(3).optional(),
|
|
4706
4842
|
poll: pollPredicate.optional(),
|
|
4707
4843
|
components: basicActionRowPredicate.array().max(5).optional(),
|
|
4708
|
-
flags:
|
|
4844
|
+
flags: import_zod13.z.int().optional().refine((flags) => !flags || (flags & import_v1045.MessageFlags.IsComponentsV2) === 0, {
|
|
4709
4845
|
error: "Cannot set content, embeds, stickers, or poll with IsComponentsV2 flag set"
|
|
4710
4846
|
})
|
|
4711
4847
|
}).refine(
|
|
4712
4848
|
(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,
|
|
4713
4849
|
{ error: "Messages must have content, embeds, a poll, attachments, components or stickers" }
|
|
4714
4850
|
);
|
|
4715
|
-
var allTopLevelComponentsPredicate =
|
|
4851
|
+
var allTopLevelComponentsPredicate = import_zod13.z.union([
|
|
4716
4852
|
basicActionRowPredicate,
|
|
4717
|
-
|
|
4718
|
-
type:
|
|
4853
|
+
import_zod13.z.object({
|
|
4854
|
+
type: import_zod13.z.literal([
|
|
4719
4855
|
// Components v2
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4856
|
+
import_v1045.ComponentType.Container,
|
|
4857
|
+
import_v1045.ComponentType.File,
|
|
4858
|
+
import_v1045.ComponentType.MediaGallery,
|
|
4859
|
+
import_v1045.ComponentType.Section,
|
|
4860
|
+
import_v1045.ComponentType.Separator,
|
|
4861
|
+
import_v1045.ComponentType.TextDisplay,
|
|
4862
|
+
import_v1045.ComponentType.Thumbnail
|
|
4727
4863
|
])
|
|
4728
4864
|
})
|
|
4729
4865
|
]).array().min(1).max(10);
|
|
4730
4866
|
var messageComponentsV2Predicate = baseMessagePredicate.extend({
|
|
4731
4867
|
components: allTopLevelComponentsPredicate,
|
|
4732
|
-
flags:
|
|
4868
|
+
flags: import_zod13.z.int().refine((flags) => (flags & import_v1045.MessageFlags.IsComponentsV2) === import_v1045.MessageFlags.IsComponentsV2, {
|
|
4733
4869
|
error: "Must set IsComponentsV2 flag to use Components V2"
|
|
4734
4870
|
}),
|
|
4735
4871
|
// These fields cannot be set
|
|
4736
|
-
content:
|
|
4737
|
-
embeds:
|
|
4738
|
-
sticker_ids:
|
|
4739
|
-
poll:
|
|
4872
|
+
content: import_zod13.z.string().length(0).nullish(),
|
|
4873
|
+
embeds: import_zod13.z.array(import_zod13.z.never()).nullish(),
|
|
4874
|
+
sticker_ids: import_zod13.z.array(import_zod13.z.never()).nullish(),
|
|
4875
|
+
poll: import_zod13.z.null().optional()
|
|
4876
|
+
});
|
|
4877
|
+
var messagePredicate = import_zod13.z.union([messageNoComponentsV2Predicate, messageComponentsV2Predicate]);
|
|
4878
|
+
var fileBodyMessagePredicate = import_zod13.z.object({
|
|
4879
|
+
body: messagePredicate,
|
|
4880
|
+
// No min length to support message edits
|
|
4881
|
+
files: rawFilePredicate.array().max(10)
|
|
4740
4882
|
});
|
|
4741
|
-
var messagePredicate = import_zod12.z.union([messageNoComponentsV2Predicate, messageComponentsV2Predicate]);
|
|
4742
4883
|
|
|
4743
4884
|
// src/messages/AllowedMentions.ts
|
|
4744
4885
|
var AllowedMentionsBuilder = class {
|
|
@@ -4923,13 +5064,29 @@ var AttachmentBuilder = class {
|
|
|
4923
5064
|
* The API data associated with this attachment.
|
|
4924
5065
|
*/
|
|
4925
5066
|
data;
|
|
5067
|
+
/**
|
|
5068
|
+
* This data is not included in the output of `toJSON()`. For this class specifically, this refers to binary data
|
|
5069
|
+
* that will wind up being included in the multipart/form-data request, if used with the `MessageBuilder`.
|
|
5070
|
+
* To retrieve this data, use {@link getRawFile}.
|
|
5071
|
+
*
|
|
5072
|
+
* @remarks This cannot be set via the constructor, primarily because of the behavior described
|
|
5073
|
+
* {@link https://discord.com/developers/docs/reference#editing-message-attachments | here}.
|
|
5074
|
+
* That is, when editing a message's attachments, you should only be providing file data for new attachments.
|
|
5075
|
+
*/
|
|
5076
|
+
fileData;
|
|
4926
5077
|
/**
|
|
4927
5078
|
* Creates a new attachment builder.
|
|
4928
5079
|
*
|
|
4929
5080
|
* @param data - The API data to create this attachment with
|
|
5081
|
+
* @example
|
|
5082
|
+
* ```ts
|
|
5083
|
+
* const attachment = new AttachmentBuilder().setId(1).setFileData(':)').setFilename('smiley.txt')
|
|
5084
|
+
* ```
|
|
5085
|
+
* @remarks Please note that the `id` field is required, it's rather easy to miss!
|
|
4930
5086
|
*/
|
|
4931
5087
|
constructor(data = {}) {
|
|
4932
5088
|
this.data = structuredClone(data);
|
|
5089
|
+
this.fileData = {};
|
|
4933
5090
|
}
|
|
4934
5091
|
/**
|
|
4935
5092
|
* Sets the id of the attachment.
|
|
@@ -4988,6 +5145,54 @@ var AttachmentBuilder = class {
|
|
|
4988
5145
|
this.data.filename = void 0;
|
|
4989
5146
|
return this;
|
|
4990
5147
|
}
|
|
5148
|
+
/**
|
|
5149
|
+
* Sets the file data to upload with this attachment.
|
|
5150
|
+
*
|
|
5151
|
+
* @param data - The file data
|
|
5152
|
+
* @remarks Note that this data is NOT included in the {@link toJSON} output. To retrieve it, use {@link getRawFile}.
|
|
5153
|
+
*/
|
|
5154
|
+
setFileData(data) {
|
|
5155
|
+
this.fileData.data = data;
|
|
5156
|
+
return this;
|
|
5157
|
+
}
|
|
5158
|
+
/**
|
|
5159
|
+
* Clears the file data from this attachment.
|
|
5160
|
+
*/
|
|
5161
|
+
clearFileData() {
|
|
5162
|
+
this.fileData.data = void 0;
|
|
5163
|
+
return this;
|
|
5164
|
+
}
|
|
5165
|
+
/**
|
|
5166
|
+
* Sets the content type of the file data to upload with this attachment.
|
|
5167
|
+
*
|
|
5168
|
+
* @remarks Note that this data is NOT included in the {@link toJSON} output. To retrieve it, use {@link getRawFile}.
|
|
5169
|
+
*/
|
|
5170
|
+
setFileContentType(contentType) {
|
|
5171
|
+
this.fileData.contentType = contentType;
|
|
5172
|
+
return this;
|
|
5173
|
+
}
|
|
5174
|
+
/**
|
|
5175
|
+
* Clears the content type of the file data from this attachment.
|
|
5176
|
+
*/
|
|
5177
|
+
clearFileContentType() {
|
|
5178
|
+
this.fileData.contentType = void 0;
|
|
5179
|
+
return this;
|
|
5180
|
+
}
|
|
5181
|
+
/**
|
|
5182
|
+
* Converts this attachment to a {@link RawFile} for uploading.
|
|
5183
|
+
*
|
|
5184
|
+
* @returns A {@link RawFile} object, or `undefined` if no file data is set
|
|
5185
|
+
*/
|
|
5186
|
+
getRawFile() {
|
|
5187
|
+
if (!this.fileData?.data) {
|
|
5188
|
+
return;
|
|
5189
|
+
}
|
|
5190
|
+
return {
|
|
5191
|
+
...this.fileData,
|
|
5192
|
+
name: this.data.filename,
|
|
5193
|
+
key: this.data.id === void 0 ? void 0 : `files[${this.data.id}]`
|
|
5194
|
+
};
|
|
5195
|
+
}
|
|
4991
5196
|
/**
|
|
4992
5197
|
* Sets the title of this attachment.
|
|
4993
5198
|
*
|
|
@@ -5292,7 +5497,7 @@ var MessageBuilder = class {
|
|
|
5292
5497
|
*
|
|
5293
5498
|
* @param allowedMentions - The allowed mentions to set
|
|
5294
5499
|
*/
|
|
5295
|
-
setAllowedMentions(allowedMentions) {
|
|
5500
|
+
setAllowedMentions(allowedMentions = new AllowedMentionsBuilder()) {
|
|
5296
5501
|
this.data.allowed_mentions = resolveBuilder(allowedMentions, AllowedMentionsBuilder);
|
|
5297
5502
|
return this;
|
|
5298
5503
|
}
|
|
@@ -5625,10 +5830,31 @@ var MessageBuilder = class {
|
|
|
5625
5830
|
validate(messagePredicate, data, validationOverride);
|
|
5626
5831
|
return data;
|
|
5627
5832
|
}
|
|
5833
|
+
/**
|
|
5834
|
+
* Serializes this builder to both JSON body and file data for multipart/form-data requests.
|
|
5835
|
+
*
|
|
5836
|
+
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
5837
|
+
* @remarks
|
|
5838
|
+
* This method extracts file data from attachments that have files set via {@link AttachmentBuilder.setFileData}.
|
|
5839
|
+
* The returned body includes attachment metadata, while files contains the binary data for upload.
|
|
5840
|
+
*/
|
|
5841
|
+
toFileBody(validationOverride) {
|
|
5842
|
+
const body = this.toJSON(false);
|
|
5843
|
+
const files = [];
|
|
5844
|
+
for (const attachment of this.data.attachments) {
|
|
5845
|
+
const rawFile = attachment.getRawFile();
|
|
5846
|
+
if (rawFile?.data || rawFile?.contentType) {
|
|
5847
|
+
files.push(rawFile);
|
|
5848
|
+
}
|
|
5849
|
+
}
|
|
5850
|
+
const combined = { body, files };
|
|
5851
|
+
validate(fileBodyMessagePredicate, combined, validationOverride);
|
|
5852
|
+
return combined;
|
|
5853
|
+
}
|
|
5628
5854
|
};
|
|
5629
5855
|
|
|
5630
5856
|
// src/index.ts
|
|
5631
|
-
var version = "2.0.0-
|
|
5857
|
+
var version = "2.0.0-pr-11006.1765450794-e636950b2";
|
|
5632
5858
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5633
5859
|
0 && (module.exports = {
|
|
5634
5860
|
ActionRowBuilder,
|
|
@@ -5667,6 +5893,7 @@ var version = "2.0.0-move-client-init.1761650119-a4c0a246f";
|
|
|
5667
5893
|
EmbedFooterBuilder,
|
|
5668
5894
|
EmojiOrLabelButtonMixin,
|
|
5669
5895
|
FileBuilder,
|
|
5896
|
+
FileUploadBuilder,
|
|
5670
5897
|
LabelBuilder,
|
|
5671
5898
|
LinkButtonBuilder,
|
|
5672
5899
|
MediaGalleryBuilder,
|
|
@@ -5716,11 +5943,12 @@ var version = "2.0.0-move-client-init.1761650119-a4c0a246f";
|
|
|
5716
5943
|
embedAuthorPredicate,
|
|
5717
5944
|
embedFieldPredicate,
|
|
5718
5945
|
embedFooterPredicate,
|
|
5719
|
-
embedLength,
|
|
5720
5946
|
embedPredicate,
|
|
5721
5947
|
emojiPredicate,
|
|
5722
5948
|
enableValidators,
|
|
5949
|
+
fileBodyMessagePredicate,
|
|
5723
5950
|
filePredicate,
|
|
5951
|
+
fileUploadPredicate,
|
|
5724
5952
|
idPredicate,
|
|
5725
5953
|
integerOptionPredicate,
|
|
5726
5954
|
isValidationEnabled,
|
|
@@ -5739,6 +5967,7 @@ var version = "2.0.0-move-client-init.1761650119-a4c0a246f";
|
|
|
5739
5967
|
pollAnswerPredicate,
|
|
5740
5968
|
pollPredicate,
|
|
5741
5969
|
pollQuestionPredicate,
|
|
5970
|
+
rawFilePredicate,
|
|
5742
5971
|
resolveAccessoryComponent,
|
|
5743
5972
|
resolveBuilder,
|
|
5744
5973
|
sectionPredicate,
|
|
@@ -5749,6 +5978,7 @@ var version = "2.0.0-move-client-init.1761650119-a4c0a246f";
|
|
|
5749
5978
|
selectMenuStringPredicate,
|
|
5750
5979
|
selectMenuUserPredicate,
|
|
5751
5980
|
separatorPredicate,
|
|
5981
|
+
snowflakePredicate,
|
|
5752
5982
|
stringOptionPredicate,
|
|
5753
5983
|
textDisplayPredicate,
|
|
5754
5984
|
textInputPredicate,
|