@discordjs/builders 2.0.0-dev.1784246195-c73e2a76d → 2.0.0-dev.1784551164-2de90a767
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/README.md +1 -1
- package/dist/index.d.mts +125 -19
- package/dist/index.d.ts +125 -19
- package/dist/index.js +82 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -116,6 +116,7 @@ __export(index_exports, {
|
|
|
116
116
|
fileBodyMessagePredicate: () => fileBodyMessagePredicate,
|
|
117
117
|
filePredicate: () => filePredicate,
|
|
118
118
|
fileUploadPredicate: () => fileUploadPredicate,
|
|
119
|
+
fileUploadTypesPredicate: () => fileUploadTypesPredicate,
|
|
119
120
|
idPredicate: () => idPredicate,
|
|
120
121
|
integerOptionPredicate: () => integerOptionPredicate,
|
|
121
122
|
isValidationEnabled: () => isValidationEnabled,
|
|
@@ -254,6 +255,7 @@ var import_zod2 = require("zod");
|
|
|
254
255
|
var idPredicate = import_zod2.z.int().min(0).max(2147483647).optional();
|
|
255
256
|
var customIdPredicate = import_zod2.z.string().min(1).max(100);
|
|
256
257
|
var snowflakePredicate = import_zod2.z.string().regex(/^(?:0|[1-9]\d*)$/);
|
|
258
|
+
var fileUploadTypesPredicate = import_zod2.z.union([import_zod2.z.enum(["audio", "image", "video"]), import_zod2.z.string().min(2).startsWith(".")]).array().max(10);
|
|
257
259
|
var memberPermissionsPredicate = import_zod2.z.coerce.bigint();
|
|
258
260
|
var localeMapPredicate = import_zod2.z.strictObject(
|
|
259
261
|
Object.fromEntries(Object.values(import_v10.Locale).map((loc) => [loc, import_zod2.z.string().optional()]))
|
|
@@ -545,6 +547,13 @@ var PremiumButtonBuilder = class extends BaseButtonBuilder {
|
|
|
545
547
|
// src/components/fileUpload/FileUpload.ts
|
|
546
548
|
var import_v107 = require("discord-api-types/v10");
|
|
547
549
|
|
|
550
|
+
// src/util/normalizeArray.ts
|
|
551
|
+
function normalizeArray(arr) {
|
|
552
|
+
if (Array.isArray(arr[0])) return [...arr[0]];
|
|
553
|
+
return arr;
|
|
554
|
+
}
|
|
555
|
+
__name(normalizeArray, "normalizeArray");
|
|
556
|
+
|
|
548
557
|
// src/components/fileUpload/Assertions.ts
|
|
549
558
|
var import_v106 = require("discord-api-types/v10");
|
|
550
559
|
var import_zod4 = require("zod");
|
|
@@ -554,6 +563,7 @@ var fileUploadPredicate = import_zod4.z.object({
|
|
|
554
563
|
custom_id: customIdPredicate,
|
|
555
564
|
min_values: import_zod4.z.int().min(0).max(10).optional(),
|
|
556
565
|
max_values: import_zod4.z.int().min(1).max(10).optional(),
|
|
566
|
+
file_types: fileUploadTypesPredicate.optional(),
|
|
557
567
|
required: import_zod4.z.boolean().optional()
|
|
558
568
|
});
|
|
559
569
|
|
|
@@ -577,6 +587,7 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
577
587
|
* custom_id: "file_upload",
|
|
578
588
|
* min_values: 2,
|
|
579
589
|
* max_values: 5,
|
|
590
|
+
* file_types: ["image", ".pdf"],
|
|
580
591
|
* });
|
|
581
592
|
* ```
|
|
582
593
|
* @example
|
|
@@ -586,7 +597,9 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
586
597
|
* custom_id: "file_upload",
|
|
587
598
|
* min_values: 2,
|
|
588
599
|
* max_values: 5,
|
|
589
|
-
* })
|
|
600
|
+
* })
|
|
601
|
+
* .setFileTypes("image", ".pdf")
|
|
602
|
+
* .setRequired();
|
|
590
603
|
* ```
|
|
591
604
|
*/
|
|
592
605
|
constructor(data = {}) {
|
|
@@ -634,6 +647,38 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
634
647
|
this.data.max_values = void 0;
|
|
635
648
|
return this;
|
|
636
649
|
}
|
|
650
|
+
/**
|
|
651
|
+
* Adds file types allowed in this file upload.
|
|
652
|
+
*
|
|
653
|
+
* @remarks
|
|
654
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
655
|
+
* for video uploads due to mobile platform limitations.
|
|
656
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
657
|
+
*/
|
|
658
|
+
addFileTypes(...fileTypes) {
|
|
659
|
+
this.data.file_types ??= [];
|
|
660
|
+
this.data.file_types.push(...normalizeArray(fileTypes));
|
|
661
|
+
return this;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Sets the file types allowed in this file upload.
|
|
665
|
+
*
|
|
666
|
+
* @remarks
|
|
667
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
668
|
+
* for video uploads due to mobile platform limitations.
|
|
669
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
670
|
+
*/
|
|
671
|
+
setFileTypes(...fileTypes) {
|
|
672
|
+
this.data.file_types = normalizeArray(fileTypes);
|
|
673
|
+
return this;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Clears the file types allowed in this file upload.
|
|
677
|
+
*/
|
|
678
|
+
clearFileTypes() {
|
|
679
|
+
this.data.file_types = void 0;
|
|
680
|
+
return this;
|
|
681
|
+
}
|
|
637
682
|
/**
|
|
638
683
|
* Sets whether this file upload is required.
|
|
639
684
|
*
|
|
@@ -678,13 +723,6 @@ var import_v1024 = require("discord-api-types/v10");
|
|
|
678
723
|
// src/components/ActionRow.ts
|
|
679
724
|
var import_v1015 = require("discord-api-types/v10");
|
|
680
725
|
|
|
681
|
-
// src/util/normalizeArray.ts
|
|
682
|
-
function normalizeArray(arr) {
|
|
683
|
-
if (Array.isArray(arr[0])) return [...arr[0]];
|
|
684
|
-
return arr;
|
|
685
|
-
}
|
|
686
|
-
__name(normalizeArray, "normalizeArray");
|
|
687
|
-
|
|
688
726
|
// src/components/selectMenu/ChannelSelectMenu.ts
|
|
689
727
|
var import_v108 = require("discord-api-types/v10");
|
|
690
728
|
|
|
@@ -2998,7 +3036,8 @@ var baseBasicOptionPredicate = import_zod8.z.object({
|
|
|
2998
3036
|
});
|
|
2999
3037
|
var attachmentOptionPredicate = import_zod8.z.object({
|
|
3000
3038
|
...baseBasicOptionPredicate.shape,
|
|
3001
|
-
type: import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.Attachment)
|
|
3039
|
+
type: import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.Attachment),
|
|
3040
|
+
file_types: fileUploadTypesPredicate.optional()
|
|
3002
3041
|
});
|
|
3003
3042
|
var booleanOptionPredicate = import_zod8.z.object({
|
|
3004
3043
|
...baseBasicOptionPredicate.shape,
|
|
@@ -3249,6 +3288,38 @@ var ChatInputCommandAttachmentOption = class extends ApplicationCommandOptionBas
|
|
|
3249
3288
|
constructor() {
|
|
3250
3289
|
super(import_v1029.ApplicationCommandOptionType.Attachment);
|
|
3251
3290
|
}
|
|
3291
|
+
/**
|
|
3292
|
+
* Adds file types allowed for this attachment option.
|
|
3293
|
+
*
|
|
3294
|
+
* @remarks
|
|
3295
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
3296
|
+
* for video uploads due to mobile platform limitations.
|
|
3297
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
3298
|
+
*/
|
|
3299
|
+
addFileTypes(...fileTypes) {
|
|
3300
|
+
this.data.file_types ??= [];
|
|
3301
|
+
this.data.file_types.push(...normalizeArray(fileTypes));
|
|
3302
|
+
return this;
|
|
3303
|
+
}
|
|
3304
|
+
/**
|
|
3305
|
+
* Sets the file types allowed for this attachment option.
|
|
3306
|
+
*
|
|
3307
|
+
* @remarks
|
|
3308
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
3309
|
+
* for video uploads due to mobile platform limitations.
|
|
3310
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
3311
|
+
*/
|
|
3312
|
+
setFileTypes(...fileTypes) {
|
|
3313
|
+
this.data.file_types = normalizeArray(fileTypes);
|
|
3314
|
+
return this;
|
|
3315
|
+
}
|
|
3316
|
+
/**
|
|
3317
|
+
* Clears the file types allowed for this attachment option.
|
|
3318
|
+
*/
|
|
3319
|
+
clearFileTypes() {
|
|
3320
|
+
this.data.file_types = void 0;
|
|
3321
|
+
return this;
|
|
3322
|
+
}
|
|
3252
3323
|
};
|
|
3253
3324
|
|
|
3254
3325
|
// src/interactions/commands/chatInput/options/boolean.ts
|
|
@@ -6033,7 +6104,7 @@ var MessageBuilder = class {
|
|
|
6033
6104
|
};
|
|
6034
6105
|
|
|
6035
6106
|
// src/index.ts
|
|
6036
|
-
var version = "2.0.0-dev.
|
|
6107
|
+
var version = "2.0.0-dev.1784551164-2de90a767";
|
|
6037
6108
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6038
6109
|
0 && (module.exports = {
|
|
6039
6110
|
ActionRowBuilder,
|
|
@@ -6131,6 +6202,7 @@ var version = "2.0.0-dev.1784246195-c73e2a76d";
|
|
|
6131
6202
|
fileBodyMessagePredicate,
|
|
6132
6203
|
filePredicate,
|
|
6133
6204
|
fileUploadPredicate,
|
|
6205
|
+
fileUploadTypesPredicate,
|
|
6134
6206
|
idPredicate,
|
|
6135
6207
|
integerOptionPredicate,
|
|
6136
6208
|
isValidationEnabled,
|