@discordjs/builders 2.0.0-pr-11006.1765452229-e636950b2 → 2.0.0-pr-11005.1765454364-f3f6d34e7
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 +20 -197
- package/dist/index.d.ts +20 -197
- package/dist/index.js +36 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -137
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -107,16 +107,16 @@ __export(index_exports, {
|
|
|
107
107
|
embedAuthorPredicate: () => embedAuthorPredicate,
|
|
108
108
|
embedFieldPredicate: () => embedFieldPredicate,
|
|
109
109
|
embedFooterPredicate: () => embedFooterPredicate,
|
|
110
|
+
embedLength: () => embedLength,
|
|
110
111
|
embedPredicate: () => embedPredicate,
|
|
111
112
|
emojiPredicate: () => emojiPredicate,
|
|
112
113
|
enableValidators: () => enableValidators,
|
|
113
|
-
fileBodyMessagePredicate: () => fileBodyMessagePredicate,
|
|
114
114
|
filePredicate: () => filePredicate,
|
|
115
115
|
fileUploadPredicate: () => fileUploadPredicate,
|
|
116
116
|
idPredicate: () => idPredicate,
|
|
117
117
|
integerOptionPredicate: () => integerOptionPredicate,
|
|
118
118
|
isValidationEnabled: () => isValidationEnabled,
|
|
119
|
-
labelPredicate: () =>
|
|
119
|
+
labelPredicate: () => labelPredicate2,
|
|
120
120
|
localeMapPredicate: () => localeMapPredicate,
|
|
121
121
|
mediaGalleryItemPredicate: () => mediaGalleryItemPredicate,
|
|
122
122
|
mediaGalleryPredicate: () => mediaGalleryPredicate,
|
|
@@ -131,7 +131,6 @@ __export(index_exports, {
|
|
|
131
131
|
pollAnswerPredicate: () => pollAnswerPredicate,
|
|
132
132
|
pollPredicate: () => pollPredicate,
|
|
133
133
|
pollQuestionPredicate: () => pollQuestionPredicate,
|
|
134
|
-
rawFilePredicate: () => rawFilePredicate,
|
|
135
134
|
resolveAccessoryComponent: () => resolveAccessoryComponent,
|
|
136
135
|
resolveBuilder: () => resolveBuilder,
|
|
137
136
|
sectionPredicate: () => sectionPredicate,
|
|
@@ -142,7 +141,6 @@ __export(index_exports, {
|
|
|
142
141
|
selectMenuStringPredicate: () => selectMenuStringPredicate,
|
|
143
142
|
selectMenuUserPredicate: () => selectMenuUserPredicate,
|
|
144
143
|
separatorPredicate: () => separatorPredicate,
|
|
145
|
-
snowflakePredicate: () => snowflakePredicate,
|
|
146
144
|
stringOptionPredicate: () => stringOptionPredicate,
|
|
147
145
|
textDisplayPredicate: () => textDisplayPredicate,
|
|
148
146
|
textInputPredicate: () => textInputPredicate,
|
|
@@ -246,15 +244,15 @@ var import_v10 = require("discord-api-types/v10");
|
|
|
246
244
|
var import_zod2 = require("zod");
|
|
247
245
|
var idPredicate = import_zod2.z.int().min(0).max(2147483647).optional();
|
|
248
246
|
var customIdPredicate = import_zod2.z.string().min(1).max(100);
|
|
249
|
-
var snowflakePredicate = import_zod2.z.string().regex(/^(?:0|[1-9]\d*)$/);
|
|
250
247
|
var memberPermissionsPredicate = import_zod2.z.coerce.bigint();
|
|
251
248
|
var localeMapPredicate = import_zod2.z.strictObject(
|
|
252
249
|
Object.fromEntries(Object.values(import_v10.Locale).map((loc) => [loc, import_zod2.z.string().optional()]))
|
|
253
250
|
);
|
|
254
251
|
|
|
255
252
|
// src/components/Assertions.ts
|
|
253
|
+
var labelPredicate = import_zod3.z.string().min(1).max(80);
|
|
256
254
|
var emojiPredicate = import_zod3.z.strictObject({
|
|
257
|
-
id:
|
|
255
|
+
id: import_zod3.z.string().optional(),
|
|
258
256
|
name: import_zod3.z.string().min(2).max(32).optional(),
|
|
259
257
|
animated: import_zod3.z.boolean().optional()
|
|
260
258
|
}).refine((data) => data.id !== void 0 || data.name !== void 0, {
|
|
@@ -264,29 +262,24 @@ var buttonPredicateBase = import_zod3.z.strictObject({
|
|
|
264
262
|
type: import_zod3.z.literal(import_v102.ComponentType.Button),
|
|
265
263
|
disabled: import_zod3.z.boolean().optional()
|
|
266
264
|
});
|
|
267
|
-
var buttonLabelPredicate = import_zod3.z.string().min(1).max(80);
|
|
268
265
|
var buttonCustomIdPredicateBase = buttonPredicateBase.extend({
|
|
269
266
|
custom_id: customIdPredicate,
|
|
270
267
|
emoji: emojiPredicate.optional(),
|
|
271
|
-
label:
|
|
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."
|
|
268
|
+
label: labelPredicate
|
|
274
269
|
});
|
|
275
|
-
var buttonPrimaryPredicate = buttonCustomIdPredicateBase.
|
|
276
|
-
var buttonSecondaryPredicate = buttonCustomIdPredicateBase.
|
|
277
|
-
var buttonSuccessPredicate = buttonCustomIdPredicateBase.
|
|
278
|
-
var buttonDangerPredicate = buttonCustomIdPredicateBase.
|
|
270
|
+
var buttonPrimaryPredicate = buttonCustomIdPredicateBase.extend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Primary) });
|
|
271
|
+
var buttonSecondaryPredicate = buttonCustomIdPredicateBase.extend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Secondary) });
|
|
272
|
+
var buttonSuccessPredicate = buttonCustomIdPredicateBase.extend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Success) });
|
|
273
|
+
var buttonDangerPredicate = buttonCustomIdPredicateBase.extend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Danger) });
|
|
279
274
|
var buttonLinkPredicate = buttonPredicateBase.extend({
|
|
280
275
|
style: import_zod3.z.literal(import_v102.ButtonStyle.Link),
|
|
281
276
|
url: import_zod3.z.url({ protocol: /^(?:https?|discord)$/ }).max(512),
|
|
282
277
|
emoji: emojiPredicate.optional(),
|
|
283
|
-
label:
|
|
284
|
-
}).refine((data) => data.emoji !== void 0 || data.label !== void 0, {
|
|
285
|
-
message: "Link buttons must have either an emoji or a label."
|
|
278
|
+
label: labelPredicate
|
|
286
279
|
});
|
|
287
280
|
var buttonPremiumPredicate = buttonPredicateBase.extend({
|
|
288
281
|
style: import_zod3.z.literal(import_v102.ButtonStyle.Premium),
|
|
289
|
-
sku_id:
|
|
282
|
+
sku_id: import_zod3.z.string()
|
|
290
283
|
});
|
|
291
284
|
var buttonPredicate = import_zod3.z.discriminatedUnion("style", [
|
|
292
285
|
buttonLinkPredicate,
|
|
@@ -307,21 +300,21 @@ var selectMenuBasePredicate = import_zod3.z.object({
|
|
|
307
300
|
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
308
301
|
type: import_zod3.z.literal(import_v102.ComponentType.ChannelSelect),
|
|
309
302
|
channel_types: import_zod3.z.enum(import_v102.ChannelType).array().optional(),
|
|
310
|
-
default_values: import_zod3.z.object({ id:
|
|
303
|
+
default_values: import_zod3.z.object({ id: import_zod3.z.string(), type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.Channel) }).array().max(25).optional()
|
|
311
304
|
});
|
|
312
305
|
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
313
306
|
type: import_zod3.z.literal(import_v102.ComponentType.MentionableSelect),
|
|
314
307
|
default_values: import_zod3.z.object({
|
|
315
|
-
id:
|
|
308
|
+
id: import_zod3.z.string(),
|
|
316
309
|
type: import_zod3.z.literal([import_v102.SelectMenuDefaultValueType.Role, import_v102.SelectMenuDefaultValueType.User])
|
|
317
310
|
}).array().max(25).optional()
|
|
318
311
|
});
|
|
319
312
|
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
320
313
|
type: import_zod3.z.literal(import_v102.ComponentType.RoleSelect),
|
|
321
|
-
default_values: import_zod3.z.object({ id:
|
|
314
|
+
default_values: import_zod3.z.object({ id: import_zod3.z.string(), type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.Role) }).array().max(25).optional()
|
|
322
315
|
});
|
|
323
316
|
var selectMenuStringOptionPredicate = import_zod3.z.object({
|
|
324
|
-
label:
|
|
317
|
+
label: labelPredicate,
|
|
325
318
|
value: import_zod3.z.string().min(1).max(100),
|
|
326
319
|
description: import_zod3.z.string().min(1).max(100).optional(),
|
|
327
320
|
emoji: emojiPredicate.optional(),
|
|
@@ -359,7 +352,7 @@ var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
|
359
352
|
});
|
|
360
353
|
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
361
354
|
type: import_zod3.z.literal(import_v102.ComponentType.UserSelect),
|
|
362
|
-
default_values: import_zod3.z.object({ id:
|
|
355
|
+
default_values: import_zod3.z.object({ id: import_zod3.z.string(), type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.User) }).array().max(25).optional()
|
|
363
356
|
});
|
|
364
357
|
var actionRowPredicate = import_zod3.z.object({
|
|
365
358
|
id: idPredicate,
|
|
@@ -2651,7 +2644,7 @@ __name(resolveAccessoryComponent, "resolveAccessoryComponent");
|
|
|
2651
2644
|
// src/components/label/Assertions.ts
|
|
2652
2645
|
var import_v1025 = require("discord-api-types/v10");
|
|
2653
2646
|
var import_zod7 = require("zod");
|
|
2654
|
-
var
|
|
2647
|
+
var labelPredicate2 = import_zod7.z.object({
|
|
2655
2648
|
id: idPredicate,
|
|
2656
2649
|
type: import_zod7.z.literal(import_v1025.ComponentType.Label),
|
|
2657
2650
|
label: import_zod7.z.string().min(1).max(45),
|
|
@@ -2804,7 +2797,7 @@ var LabelBuilder = class extends ComponentBuilder {
|
|
|
2804
2797
|
// The label predicate validates the component.
|
|
2805
2798
|
component: component?.toJSON(false)
|
|
2806
2799
|
};
|
|
2807
|
-
validate(
|
|
2800
|
+
validate(labelPredicate2, data, validationOverride);
|
|
2808
2801
|
return data;
|
|
2809
2802
|
}
|
|
2810
2803
|
};
|
|
@@ -3130,8 +3123,8 @@ var numberOptionPredicate = import_zod8.z.object({
|
|
|
3130
3123
|
...numericMixinNumberOptionPredicate.shape
|
|
3131
3124
|
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
3132
3125
|
var stringOptionPredicate = basicOptionPredicate.extend({
|
|
3133
|
-
max_length: import_zod8.z.number().min(
|
|
3134
|
-
min_length: import_zod8.z.number().min(
|
|
3126
|
+
max_length: import_zod8.z.number().min(0).max(6e3).optional(),
|
|
3127
|
+
min_length: import_zod8.z.number().min(1).max(6e3).optional()
|
|
3135
3128
|
}).and(autocompleteOrStringChoicesMixinOptionPredicate);
|
|
3136
3129
|
var baseChatInputCommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
3137
3130
|
contexts: import_zod8.z.array(import_zod8.z.enum(import_v1028.InteractionContextType)).optional(),
|
|
@@ -3141,12 +3134,8 @@ var baseChatInputCommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
|
3141
3134
|
});
|
|
3142
3135
|
var chatInputCommandOptionsPredicate = import_zod8.z.union([
|
|
3143
3136
|
import_zod8.z.object({ type: basicOptionTypesPredicate }).array(),
|
|
3144
|
-
import_zod8.z.object({
|
|
3145
|
-
|
|
3146
|
-
import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.Subcommand),
|
|
3147
|
-
import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.SubcommandGroup)
|
|
3148
|
-
])
|
|
3149
|
-
}).array()
|
|
3137
|
+
import_zod8.z.object({ type: import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.Subcommand) }).array(),
|
|
3138
|
+
import_zod8.z.object({ type: import_zod8.z.literal(import_v1028.ApplicationCommandOptionType.SubcommandGroup) }).array()
|
|
3150
3139
|
]);
|
|
3151
3140
|
var chatInputCommandPredicate = baseChatInputCommandPredicate.extend({
|
|
3152
3141
|
options: chatInputCommandOptionsPredicate.optional()
|
|
@@ -3797,7 +3786,7 @@ var modalPredicate = import_zod10.z.object({
|
|
|
3797
3786
|
type: import_zod10.z.literal(import_v1043.ComponentType.ActionRow),
|
|
3798
3787
|
components: import_zod10.z.object({ type: import_zod10.z.literal(import_v1043.ComponentType.TextInput) }).array().length(1)
|
|
3799
3788
|
}),
|
|
3800
|
-
|
|
3789
|
+
labelPredicate2,
|
|
3801
3790
|
textDisplayPredicate
|
|
3802
3791
|
]).array().min(1).max(5)
|
|
3803
3792
|
});
|
|
@@ -3921,8 +3910,15 @@ var ModalBuilder = class {
|
|
|
3921
3910
|
};
|
|
3922
3911
|
|
|
3923
3912
|
// src/messages/embed/Assertions.ts
|
|
3924
|
-
var import_util = require("@discordjs/util");
|
|
3925
3913
|
var import_zod11 = require("zod");
|
|
3914
|
+
|
|
3915
|
+
// src/util/componentUtil.ts
|
|
3916
|
+
function embedLength(data) {
|
|
3917
|
+
return (data.title?.length ?? 0) + (data.description?.length ?? 0) + (data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) + (data.footer?.text.length ?? 0) + (data.author?.name.length ?? 0);
|
|
3918
|
+
}
|
|
3919
|
+
__name(embedLength, "embedLength");
|
|
3920
|
+
|
|
3921
|
+
// src/messages/embed/Assertions.ts
|
|
3926
3922
|
var namePredicate3 = import_zod11.z.string().max(256);
|
|
3927
3923
|
var URLPredicate = import_zod11.z.url({ protocol: /^https?$/ });
|
|
3928
3924
|
var URLWithAttachmentProtocolPredicate = import_zod11.z.url({ protocol: /^(?:https?|attachment)$/ });
|
|
@@ -3956,7 +3952,7 @@ var embedPredicate = import_zod11.z.object({
|
|
|
3956
3952
|
{
|
|
3957
3953
|
error: "Embed must have at least a title, description, a field, a footer, an author, an image, OR a thumbnail."
|
|
3958
3954
|
}
|
|
3959
|
-
).refine((embed) =>
|
|
3955
|
+
).refine((embed) => embedLength(embed) <= 6e3, { error: "Embeds must not exceed 6000 characters in total." });
|
|
3960
3956
|
|
|
3961
3957
|
// src/messages/embed/EmbedAuthor.ts
|
|
3962
3958
|
var EmbedAuthorBuilder = class {
|
|
@@ -4777,19 +4773,10 @@ var PollBuilder = class {
|
|
|
4777
4773
|
};
|
|
4778
4774
|
|
|
4779
4775
|
// src/messages/Assertions.ts
|
|
4780
|
-
var import_node_buffer = require("buffer");
|
|
4781
4776
|
var import_v1045 = require("discord-api-types/v10");
|
|
4782
4777
|
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()
|
|
4789
|
-
});
|
|
4790
4778
|
var attachmentPredicate = import_zod13.z.object({
|
|
4791
|
-
|
|
4792
|
-
id: import_zod13.z.union([snowflakePredicate, import_zod13.z.number()]),
|
|
4779
|
+
id: import_zod13.z.union([import_zod13.z.string(), import_zod13.z.number()]),
|
|
4793
4780
|
description: import_zod13.z.string().max(1024).optional(),
|
|
4794
4781
|
duration_secs: import_zod13.z.number().max(2 ** 31 - 1).optional(),
|
|
4795
4782
|
filename: import_zod13.z.string().max(1024).optional(),
|
|
@@ -4875,11 +4862,6 @@ var messageComponentsV2Predicate = baseMessagePredicate.extend({
|
|
|
4875
4862
|
poll: import_zod13.z.null().optional()
|
|
4876
4863
|
});
|
|
4877
4864
|
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)
|
|
4882
|
-
});
|
|
4883
4865
|
|
|
4884
4866
|
// src/messages/AllowedMentions.ts
|
|
4885
4867
|
var AllowedMentionsBuilder = class {
|
|
@@ -5064,29 +5046,13 @@ var AttachmentBuilder = class {
|
|
|
5064
5046
|
* The API data associated with this attachment.
|
|
5065
5047
|
*/
|
|
5066
5048
|
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;
|
|
5077
5049
|
/**
|
|
5078
5050
|
* Creates a new attachment builder.
|
|
5079
5051
|
*
|
|
5080
5052
|
* @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!
|
|
5086
5053
|
*/
|
|
5087
5054
|
constructor(data = {}) {
|
|
5088
5055
|
this.data = structuredClone(data);
|
|
5089
|
-
this.fileData = {};
|
|
5090
5056
|
}
|
|
5091
5057
|
/**
|
|
5092
5058
|
* Sets the id of the attachment.
|
|
@@ -5145,54 +5111,6 @@ var AttachmentBuilder = class {
|
|
|
5145
5111
|
this.data.filename = void 0;
|
|
5146
5112
|
return this;
|
|
5147
5113
|
}
|
|
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
|
-
}
|
|
5196
5114
|
/**
|
|
5197
5115
|
* Sets the title of this attachment.
|
|
5198
5116
|
*
|
|
@@ -5497,7 +5415,7 @@ var MessageBuilder = class {
|
|
|
5497
5415
|
*
|
|
5498
5416
|
* @param allowedMentions - The allowed mentions to set
|
|
5499
5417
|
*/
|
|
5500
|
-
setAllowedMentions(allowedMentions
|
|
5418
|
+
setAllowedMentions(allowedMentions) {
|
|
5501
5419
|
this.data.allowed_mentions = resolveBuilder(allowedMentions, AllowedMentionsBuilder);
|
|
5502
5420
|
return this;
|
|
5503
5421
|
}
|
|
@@ -5830,31 +5748,10 @@ var MessageBuilder = class {
|
|
|
5830
5748
|
validate(messagePredicate, data, validationOverride);
|
|
5831
5749
|
return data;
|
|
5832
5750
|
}
|
|
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
|
-
}
|
|
5854
5751
|
};
|
|
5855
5752
|
|
|
5856
5753
|
// src/index.ts
|
|
5857
|
-
var version = "2.0.0-pr-
|
|
5754
|
+
var version = "2.0.0-pr-11005.1765454364-f3f6d34e7";
|
|
5858
5755
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5859
5756
|
0 && (module.exports = {
|
|
5860
5757
|
ActionRowBuilder,
|
|
@@ -5943,10 +5840,10 @@ var version = "2.0.0-pr-11006.1765452229-e636950b2";
|
|
|
5943
5840
|
embedAuthorPredicate,
|
|
5944
5841
|
embedFieldPredicate,
|
|
5945
5842
|
embedFooterPredicate,
|
|
5843
|
+
embedLength,
|
|
5946
5844
|
embedPredicate,
|
|
5947
5845
|
emojiPredicate,
|
|
5948
5846
|
enableValidators,
|
|
5949
|
-
fileBodyMessagePredicate,
|
|
5950
5847
|
filePredicate,
|
|
5951
5848
|
fileUploadPredicate,
|
|
5952
5849
|
idPredicate,
|
|
@@ -5967,7 +5864,6 @@ var version = "2.0.0-pr-11006.1765452229-e636950b2";
|
|
|
5967
5864
|
pollAnswerPredicate,
|
|
5968
5865
|
pollPredicate,
|
|
5969
5866
|
pollQuestionPredicate,
|
|
5970
|
-
rawFilePredicate,
|
|
5971
5867
|
resolveAccessoryComponent,
|
|
5972
5868
|
resolveBuilder,
|
|
5973
5869
|
sectionPredicate,
|
|
@@ -5978,7 +5874,6 @@ var version = "2.0.0-pr-11006.1765452229-e636950b2";
|
|
|
5978
5874
|
selectMenuStringPredicate,
|
|
5979
5875
|
selectMenuUserPredicate,
|
|
5980
5876
|
separatorPredicate,
|
|
5981
|
-
snowflakePredicate,
|
|
5982
5877
|
stringOptionPredicate,
|
|
5983
5878
|
textDisplayPredicate,
|
|
5984
5879
|
textInputPredicate,
|