@discordjs/builders 2.0.0-djs-file-upload.1761302390-5ae769c9e → 2.0.0-pr-11006.1765450224-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 +200 -23
- package/dist/index.d.ts +200 -23
- package/dist/index.js +145 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +141 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as discord_api_types_v10 from 'discord-api-types/v10';
|
|
2
2
|
import { APIButtonComponent, APIButtonComponentWithSKUId, APIMessageComponentEmoji, APIBaseComponent, ComponentType, APIButtonComponentWithCustomId, APIButtonComponentWithURL, Snowflake, APIFileUploadComponent, APISelectMenuComponent, APIChannelSelectComponent, ChannelType, APIMentionableSelectComponent, APISelectMenuDefaultValue, SelectMenuDefaultValueType, APIRoleSelectComponent, APISelectMenuOption, APIStringSelectComponent, APIUserSelectComponent, APITextInputComponent, TextInputStyle, APILabelComponent, APIFileComponent, APIMediaGalleryItem, APIMediaGalleryComponent, APITextDisplayComponent, APIThumbnailComponent, APISectionComponent, ButtonStyle, APISeparatorComponent, SeparatorSpacingSize, APIContainerComponent, APIActionRowComponent, APIComponentInMessageActionRow, APIComponentInContainer, APIModalComponent, APIMessageComponent, APISectionAccessoryComponent, APIComponentInActionRow, APIApplicationCommandIntegerOption, APIApplicationCommandChannelOption, APIApplicationCommandNumberOption, APIApplicationCommandStringOption, APIApplicationCommandOptionChoice, RESTPostAPIApplicationCommandsJSONBody, Locale, APIApplicationCommand, APIApplicationCommandBasicOption, APIApplicationCommandOption, ApplicationCommandOptionType, APIApplicationCommandSubcommandOption, APIApplicationCommandSubcommandGroupOption, InteractionContextType, ApplicationIntegrationType, Permissions, RESTPostAPIChatInputApplicationCommandsJSONBody, ApplicationCommandType, RESTPostAPIContextMenuApplicationCommandsJSONBody, APIModalInteractionResponseCallbackData, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbed, PollLayoutType, APIPollMedia, APIPartialEmoji, APIPollAnswer, RESTAPIPoll, APIAllowedMentions, AllowedMentionsTypes, MessageReferenceType, RESTAPIAttachment, RESTAPIMessageReference, RESTPostAPIChannelMessageJSONBody, APIMessageReference, APIMessageTopLevelComponent, APIAttachment, MessageFlags, APIPoll } from 'discord-api-types/v10';
|
|
3
|
-
import { JSONEncodable } from '@discordjs/util';
|
|
3
|
+
import { JSONEncodable, RawFile, FileBodyEncodable, FileBodyEncodableResult } from '@discordjs/util';
|
|
4
|
+
export { RawFile } from '@discordjs/util';
|
|
4
5
|
import * as ts_mixer_dist_types_types_js from 'ts-mixer/dist/types/types.js';
|
|
5
6
|
import * as zod from 'zod';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
import * as zod_v4_core from 'zod/v4/core';
|
|
9
|
+
import { Buffer } from 'node:buffer';
|
|
8
10
|
|
|
9
11
|
interface EmojiOrLabelButtonData extends Pick<Exclude<APIButtonComponent, APIButtonComponentWithSKUId>, 'emoji' | 'label'> {
|
|
10
12
|
}
|
|
@@ -223,7 +225,7 @@ declare class FileUploadBuilder extends ComponentBuilder<APIFileUploadComponent>
|
|
|
223
225
|
/**
|
|
224
226
|
* Sets the maximum number of file uploads required.
|
|
225
227
|
*
|
|
226
|
-
* @param maxValues - The maximum values that
|
|
228
|
+
* @param maxValues - The maximum values that can be uploaded
|
|
227
229
|
*/
|
|
228
230
|
setMaxValues(maxValues: number): this;
|
|
229
231
|
/**
|
|
@@ -294,9 +296,9 @@ declare abstract class BaseSelectMenuBuilder<Data extends APISelectMenuComponent
|
|
|
294
296
|
*/
|
|
295
297
|
setMinValues(minValues: number): this;
|
|
296
298
|
/**
|
|
297
|
-
* Sets the maximum values that
|
|
299
|
+
* Sets the maximum values that can be selected in the select menu.
|
|
298
300
|
*
|
|
299
|
-
* @param maxValues - The maximum values that
|
|
301
|
+
* @param maxValues - The maximum values that can be selected
|
|
300
302
|
*/
|
|
301
303
|
setMaxValues(maxValues: number): this;
|
|
302
304
|
/**
|
|
@@ -1852,7 +1854,7 @@ declare const buttonPredicate: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1852
1854
|
name: z.ZodOptional<z.ZodString>;
|
|
1853
1855
|
animated: z.ZodOptional<z.ZodBoolean>;
|
|
1854
1856
|
}, z.core.$strict>>;
|
|
1855
|
-
label: z.ZodString
|
|
1857
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1856
1858
|
}, z.core.$strict>, z.ZodObject<{
|
|
1857
1859
|
type: z.ZodLiteral<ComponentType.Button>;
|
|
1858
1860
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1862,7 +1864,7 @@ declare const buttonPredicate: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1862
1864
|
name: z.ZodOptional<z.ZodString>;
|
|
1863
1865
|
animated: z.ZodOptional<z.ZodBoolean>;
|
|
1864
1866
|
}, z.core.$strict>>;
|
|
1865
|
-
label: z.ZodString
|
|
1867
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1866
1868
|
style: z.ZodLiteral<ButtonStyle.Primary>;
|
|
1867
1869
|
}, z.core.$strict>, z.ZodObject<{
|
|
1868
1870
|
type: z.ZodLiteral<ComponentType.Button>;
|
|
@@ -1873,7 +1875,7 @@ declare const buttonPredicate: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1873
1875
|
name: z.ZodOptional<z.ZodString>;
|
|
1874
1876
|
animated: z.ZodOptional<z.ZodBoolean>;
|
|
1875
1877
|
}, z.core.$strict>>;
|
|
1876
|
-
label: z.ZodString
|
|
1878
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1877
1879
|
style: z.ZodLiteral<ButtonStyle.Secondary>;
|
|
1878
1880
|
}, z.core.$strict>, z.ZodObject<{
|
|
1879
1881
|
type: z.ZodLiteral<ComponentType.Button>;
|
|
@@ -1884,7 +1886,7 @@ declare const buttonPredicate: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1884
1886
|
name: z.ZodOptional<z.ZodString>;
|
|
1885
1887
|
animated: z.ZodOptional<z.ZodBoolean>;
|
|
1886
1888
|
}, z.core.$strict>>;
|
|
1887
|
-
label: z.ZodString
|
|
1889
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1888
1890
|
style: z.ZodLiteral<ButtonStyle.Success>;
|
|
1889
1891
|
}, z.core.$strict>, z.ZodObject<{
|
|
1890
1892
|
type: z.ZodLiteral<ComponentType.Button>;
|
|
@@ -1895,7 +1897,7 @@ declare const buttonPredicate: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1895
1897
|
name: z.ZodOptional<z.ZodString>;
|
|
1896
1898
|
animated: z.ZodOptional<z.ZodBoolean>;
|
|
1897
1899
|
}, z.core.$strict>>;
|
|
1898
|
-
label: z.ZodString
|
|
1900
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1899
1901
|
style: z.ZodLiteral<ButtonStyle.Danger>;
|
|
1900
1902
|
}, z.core.$strict>, z.ZodObject<{
|
|
1901
1903
|
type: z.ZodLiteral<ComponentType.Button>;
|
|
@@ -2836,9 +2838,7 @@ declare const chatInputCommandPredicate: z.ZodObject<{
|
|
|
2836
2838
|
options: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
2837
2839
|
type: z.ZodLiteral<ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Boolean | ApplicationCommandOptionType.User | ApplicationCommandOptionType.Channel | ApplicationCommandOptionType.Role | ApplicationCommandOptionType.Mentionable | ApplicationCommandOptionType.Number | ApplicationCommandOptionType.Attachment>;
|
|
2838
2840
|
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
2839
|
-
type: z.ZodLiteral<ApplicationCommandOptionType.Subcommand>;
|
|
2840
|
-
}, z.core.$strip>>, z.ZodArray<z.ZodObject<{
|
|
2841
|
-
type: z.ZodLiteral<ApplicationCommandOptionType.SubcommandGroup>;
|
|
2841
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<ApplicationCommandOptionType.Subcommand>, z.ZodLiteral<ApplicationCommandOptionType.SubcommandGroup>]>;
|
|
2842
2842
|
}, z.core.$strip>>]>>;
|
|
2843
2843
|
}, z.core.$strip>;
|
|
2844
2844
|
declare const chatInputCommandSubcommandGroupPredicate: z.ZodObject<{
|
|
@@ -3982,6 +3982,12 @@ declare class AllowedMentionsBuilder implements JSONEncodable<APIAllowedMentions
|
|
|
3982
3982
|
toJSON(validationOverride?: boolean): APIAllowedMentions;
|
|
3983
3983
|
}
|
|
3984
3984
|
|
|
3985
|
+
declare const rawFilePredicate: z.ZodObject<{
|
|
3986
|
+
data: z.ZodUnion<readonly [z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodString]>;
|
|
3987
|
+
name: z.ZodString;
|
|
3988
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
3989
|
+
key: z.ZodOptional<z.ZodString>;
|
|
3990
|
+
}, z.core.$strip>;
|
|
3985
3991
|
declare const attachmentPredicate: z.ZodObject<{
|
|
3986
3992
|
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
3987
3993
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -4121,6 +4127,132 @@ declare const messagePredicate: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
4121
4127
|
sticker_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4122
4128
|
poll: z.ZodOptional<z.ZodNull>;
|
|
4123
4129
|
}, z.core.$strip>]>;
|
|
4130
|
+
declare const fileBodyMessagePredicate: z.ZodObject<{
|
|
4131
|
+
body: z.ZodUnion<readonly [z.ZodObject<{
|
|
4132
|
+
nonce: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4133
|
+
tts: z.ZodOptional<z.ZodBoolean>;
|
|
4134
|
+
allowed_mentions: z.ZodOptional<z.ZodObject<{
|
|
4135
|
+
parse: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AllowedMentionsTypes>>>;
|
|
4136
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4137
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4138
|
+
replied_user: z.ZodOptional<z.ZodBoolean>;
|
|
4139
|
+
}, z.core.$strip>>;
|
|
4140
|
+
message_reference: z.ZodOptional<z.ZodObject<{
|
|
4141
|
+
channel_id: z.ZodOptional<z.ZodString>;
|
|
4142
|
+
fail_if_not_exists: z.ZodOptional<z.ZodBoolean>;
|
|
4143
|
+
guild_id: z.ZodOptional<z.ZodString>;
|
|
4144
|
+
message_id: z.ZodString;
|
|
4145
|
+
type: z.ZodOptional<z.ZodEnum<typeof MessageReferenceType>>;
|
|
4146
|
+
}, z.core.$strip>>;
|
|
4147
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4148
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
4149
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4150
|
+
duration_secs: z.ZodOptional<z.ZodNumber>;
|
|
4151
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
4152
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4153
|
+
waveform: z.ZodOptional<z.ZodString>;
|
|
4154
|
+
}, z.core.$strip>>>;
|
|
4155
|
+
enforce_nonce: z.ZodOptional<z.ZodBoolean>;
|
|
4156
|
+
content: z.ZodOptional<z.ZodString>;
|
|
4157
|
+
embeds: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4158
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4159
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4160
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
4161
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
4162
|
+
color: z.ZodOptional<z.ZodInt>;
|
|
4163
|
+
footer: z.ZodOptional<z.ZodObject<{
|
|
4164
|
+
text: z.ZodString;
|
|
4165
|
+
icon_url: z.ZodOptional<z.ZodURL>;
|
|
4166
|
+
}, z.core.$strip>>;
|
|
4167
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
4168
|
+
url: z.ZodURL;
|
|
4169
|
+
}, z.core.$strip>>;
|
|
4170
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
4171
|
+
url: z.ZodURL;
|
|
4172
|
+
}, z.core.$strip>>;
|
|
4173
|
+
author: z.ZodOptional<z.ZodObject<{
|
|
4174
|
+
name: z.ZodString;
|
|
4175
|
+
icon_url: z.ZodOptional<z.ZodURL>;
|
|
4176
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
4177
|
+
}, z.core.$strip>>;
|
|
4178
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4179
|
+
name: z.ZodString;
|
|
4180
|
+
value: z.ZodString;
|
|
4181
|
+
inline: z.ZodOptional<z.ZodBoolean>;
|
|
4182
|
+
}, z.core.$strip>>>;
|
|
4183
|
+
}, z.core.$strip>>>;
|
|
4184
|
+
sticker_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4185
|
+
poll: z.ZodOptional<z.ZodObject<{
|
|
4186
|
+
question: z.ZodObject<{
|
|
4187
|
+
text: z.ZodString;
|
|
4188
|
+
}, z.core.$strip>;
|
|
4189
|
+
answers: z.ZodArray<z.ZodObject<{
|
|
4190
|
+
poll_media: z.ZodObject<{
|
|
4191
|
+
text: z.ZodString;
|
|
4192
|
+
emoji: z.ZodOptional<z.ZodObject<{
|
|
4193
|
+
id: z.ZodOptional<z.ZodString>;
|
|
4194
|
+
name: z.ZodOptional<z.ZodString>;
|
|
4195
|
+
animated: z.ZodOptional<z.ZodBoolean>;
|
|
4196
|
+
}, z.core.$strict>>;
|
|
4197
|
+
}, z.core.$strip>;
|
|
4198
|
+
}, z.core.$strip>>;
|
|
4199
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
4200
|
+
allow_multiselect: z.ZodOptional<z.ZodBoolean>;
|
|
4201
|
+
layout_type: z.ZodOptional<z.ZodEnum<typeof discord_api_types_v10.PollLayoutType>>;
|
|
4202
|
+
}, z.core.$strip>>;
|
|
4203
|
+
components: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4204
|
+
type: z.ZodLiteral<ComponentType.ActionRow>;
|
|
4205
|
+
components: z.ZodArray<z.ZodObject<{
|
|
4206
|
+
type: z.ZodLiteral<ComponentType.Button | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect>;
|
|
4207
|
+
}, z.core.$strip>>;
|
|
4208
|
+
}, z.core.$strip>>>;
|
|
4209
|
+
flags: z.ZodOptional<z.ZodInt>;
|
|
4210
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4211
|
+
nonce: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4212
|
+
tts: z.ZodOptional<z.ZodBoolean>;
|
|
4213
|
+
allowed_mentions: z.ZodOptional<z.ZodObject<{
|
|
4214
|
+
parse: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AllowedMentionsTypes>>>;
|
|
4215
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4216
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4217
|
+
replied_user: z.ZodOptional<z.ZodBoolean>;
|
|
4218
|
+
}, z.core.$strip>>;
|
|
4219
|
+
message_reference: z.ZodOptional<z.ZodObject<{
|
|
4220
|
+
channel_id: z.ZodOptional<z.ZodString>;
|
|
4221
|
+
fail_if_not_exists: z.ZodOptional<z.ZodBoolean>;
|
|
4222
|
+
guild_id: z.ZodOptional<z.ZodString>;
|
|
4223
|
+
message_id: z.ZodString;
|
|
4224
|
+
type: z.ZodOptional<z.ZodEnum<typeof MessageReferenceType>>;
|
|
4225
|
+
}, z.core.$strip>>;
|
|
4226
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4227
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
4228
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4229
|
+
duration_secs: z.ZodOptional<z.ZodNumber>;
|
|
4230
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
4231
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4232
|
+
waveform: z.ZodOptional<z.ZodString>;
|
|
4233
|
+
}, z.core.$strip>>>;
|
|
4234
|
+
enforce_nonce: z.ZodOptional<z.ZodBoolean>;
|
|
4235
|
+
components: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
4236
|
+
type: z.ZodLiteral<ComponentType.ActionRow>;
|
|
4237
|
+
components: z.ZodArray<z.ZodObject<{
|
|
4238
|
+
type: z.ZodLiteral<ComponentType.Button | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect>;
|
|
4239
|
+
}, z.core.$strip>>;
|
|
4240
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4241
|
+
type: z.ZodLiteral<ComponentType.Section | ComponentType.TextDisplay | ComponentType.Thumbnail | ComponentType.MediaGallery | ComponentType.File | ComponentType.Separator | ComponentType.Container>;
|
|
4242
|
+
}, z.core.$strip>]>>;
|
|
4243
|
+
flags: z.ZodInt;
|
|
4244
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4245
|
+
embeds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4246
|
+
sticker_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4247
|
+
poll: z.ZodOptional<z.ZodNull>;
|
|
4248
|
+
}, z.core.$strip>]>;
|
|
4249
|
+
files: z.ZodArray<z.ZodObject<{
|
|
4250
|
+
data: z.ZodUnion<readonly [z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodString]>;
|
|
4251
|
+
name: z.ZodString;
|
|
4252
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
4253
|
+
key: z.ZodOptional<z.ZodString>;
|
|
4254
|
+
}, z.core.$strip>>;
|
|
4255
|
+
}, z.core.$strip>;
|
|
4124
4256
|
|
|
4125
4257
|
/**
|
|
4126
4258
|
* A builder that creates API-compatible JSON data for attachments.
|
|
@@ -4130,10 +4262,25 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4130
4262
|
* The API data associated with this attachment.
|
|
4131
4263
|
*/
|
|
4132
4264
|
private readonly data;
|
|
4265
|
+
/**
|
|
4266
|
+
* This data is not included in the output of `toJSON()`. For this class specifically, this refers to binary data
|
|
4267
|
+
* that will wind up being included in the multipart/form-data request, if used with the `MessageBuilder`.
|
|
4268
|
+
* To retrieve this data, use {@link getRawFile}.
|
|
4269
|
+
*
|
|
4270
|
+
* @remarks This cannot be set via the constructor, primarily because of the behavior described
|
|
4271
|
+
* {@link https://discord.com/developers/docs/reference#editing-message-attachments | here}.
|
|
4272
|
+
* That is, when editing a message's attachments, you should only be providing file data for new attachments.
|
|
4273
|
+
*/
|
|
4274
|
+
private readonly fileData;
|
|
4133
4275
|
/**
|
|
4134
4276
|
* Creates a new attachment builder.
|
|
4135
4277
|
*
|
|
4136
4278
|
* @param data - The API data to create this attachment with
|
|
4279
|
+
* @example
|
|
4280
|
+
* ```ts
|
|
4281
|
+
* const attachment = new AttachmentBuilder().setId(1).setFileData(':)').setFilename('smiley.txt')
|
|
4282
|
+
* ```
|
|
4283
|
+
* @remarks Please note that the `id` field is required, it's rather easy to miss!
|
|
4137
4284
|
*/
|
|
4138
4285
|
constructor(data?: Partial<RESTAPIAttachment>);
|
|
4139
4286
|
/**
|
|
@@ -4141,7 +4288,7 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4141
4288
|
*
|
|
4142
4289
|
* @param id - The id of the attachment
|
|
4143
4290
|
*/
|
|
4144
|
-
setId(id: Snowflake): this;
|
|
4291
|
+
setId(id: Snowflake | number): this;
|
|
4145
4292
|
/**
|
|
4146
4293
|
* Sets the description of this attachment.
|
|
4147
4294
|
*
|
|
@@ -4172,6 +4319,33 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4172
4319
|
* Clears the filename of this attachment.
|
|
4173
4320
|
*/
|
|
4174
4321
|
clearFilename(): this;
|
|
4322
|
+
/**
|
|
4323
|
+
* Sets the file data to upload with this attachment.
|
|
4324
|
+
*
|
|
4325
|
+
* @param data - The file data
|
|
4326
|
+
* @remarks Note that this data is NOT included in the {@link toJSON} output. To retrieve it, use {@link getRawFile}.
|
|
4327
|
+
*/
|
|
4328
|
+
setFileData(data: Buffer | Uint8Array | string): this;
|
|
4329
|
+
/**
|
|
4330
|
+
* Clears the file data from this attachment.
|
|
4331
|
+
*/
|
|
4332
|
+
clearFileData(): this;
|
|
4333
|
+
/**
|
|
4334
|
+
* Sets the content type of the file data to upload with this attachment.
|
|
4335
|
+
*
|
|
4336
|
+
* @remarks Note that this data is NOT included in the {@link toJSON} output. To retrieve it, use {@link getRawFile}.
|
|
4337
|
+
*/
|
|
4338
|
+
setFileContentType(contentType: string): this;
|
|
4339
|
+
/**
|
|
4340
|
+
* Clears the content type of the file data from this attachment.
|
|
4341
|
+
*/
|
|
4342
|
+
clearFileContentType(): this;
|
|
4343
|
+
/**
|
|
4344
|
+
* Converts this attachment to a {@link RawFile} for uploading.
|
|
4345
|
+
*
|
|
4346
|
+
* @returns A {@link RawFile} object, or `undefined` if no file data is set
|
|
4347
|
+
*/
|
|
4348
|
+
getRawFile(): Partial<RawFile> | undefined;
|
|
4175
4349
|
/**
|
|
4176
4350
|
* Sets the title of this attachment.
|
|
4177
4351
|
*
|
|
@@ -4279,7 +4453,7 @@ interface MessageBuilderData extends Partial<Omit<RESTPostAPIChannelMessageJSONB
|
|
|
4279
4453
|
/**
|
|
4280
4454
|
* A builder that creates API-compatible JSON data for messages.
|
|
4281
4455
|
*/
|
|
4282
|
-
declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJSONBody> {
|
|
4456
|
+
declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJSONBody>, FileBodyEncodable<RESTPostAPIChannelMessageJSONBody> {
|
|
4283
4457
|
/**
|
|
4284
4458
|
* The API data associated with this message.
|
|
4285
4459
|
*/
|
|
@@ -4392,7 +4566,7 @@ declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJ
|
|
|
4392
4566
|
*
|
|
4393
4567
|
* @param allowedMentions - The allowed mentions to set
|
|
4394
4568
|
*/
|
|
4395
|
-
setAllowedMentions(allowedMentions
|
|
4569
|
+
setAllowedMentions(allowedMentions?: AllowedMentionsBuilder | APIAllowedMentions | ((builder: AllowedMentionsBuilder) => AllowedMentionsBuilder)): this;
|
|
4396
4570
|
/**
|
|
4397
4571
|
* Updates the allowed mentions for this message (and creates it if it doesn't exist)
|
|
4398
4572
|
*
|
|
@@ -4612,15 +4786,17 @@ declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJ
|
|
|
4612
4786
|
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
4613
4787
|
*/
|
|
4614
4788
|
toJSON(validationOverride?: boolean): RESTPostAPIChannelMessageJSONBody;
|
|
4789
|
+
/**
|
|
4790
|
+
* Serializes this builder to both JSON body and file data for multipart/form-data requests.
|
|
4791
|
+
*
|
|
4792
|
+
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
4793
|
+
* @remarks
|
|
4794
|
+
* This method extracts file data from attachments that have files set via {@link AttachmentBuilder.setFileData}.
|
|
4795
|
+
* The returned body includes attachment metadata, while files contains the binary data for upload.
|
|
4796
|
+
*/
|
|
4797
|
+
toFileBody(validationOverride?: boolean): FileBodyEncodableResult<RESTPostAPIChannelMessageJSONBody>;
|
|
4615
4798
|
}
|
|
4616
4799
|
|
|
4617
|
-
/**
|
|
4618
|
-
* Calculates the length of the embed.
|
|
4619
|
-
*
|
|
4620
|
-
* @param data - The embed data to check
|
|
4621
|
-
*/
|
|
4622
|
-
declare function embedLength(data: APIEmbed): number;
|
|
4623
|
-
|
|
4624
4800
|
/**
|
|
4625
4801
|
* "Resolves" a builder from the 3 ways it can be input:
|
|
4626
4802
|
* 1. A clean instance
|
|
@@ -4667,6 +4843,7 @@ declare class ValidationError extends Error {
|
|
|
4667
4843
|
|
|
4668
4844
|
declare const idPredicate: z.ZodOptional<z.ZodInt>;
|
|
4669
4845
|
declare const customIdPredicate: z.ZodString;
|
|
4846
|
+
declare const snowflakePredicate: z.ZodString;
|
|
4670
4847
|
declare const memberPermissionsPredicate: z.ZodCoercedBigInt<unknown>;
|
|
4671
4848
|
declare const localeMapPredicate: z.ZodObject<Record<Locale, z.ZodOptional<z.ZodString>>, z.core.$strict>;
|
|
4672
4849
|
|
|
@@ -4678,4 +4855,4 @@ declare const localeMapPredicate: z.ZodObject<Record<Locale, z.ZodOptional<z.Zod
|
|
|
4678
4855
|
*/
|
|
4679
4856
|
declare const version: string;
|
|
4680
4857
|
|
|
4681
|
-
export { ActionRowBuilder, type ActionRowBuilderData, AllowedMentionsBuilder, type AnyActionRowComponentBuilder, type AnyModalComponentBuilder, type ApplicationCommandNumericOptionMinMaxValueData, ApplicationCommandNumericOptionMinMaxValueMixin, type ApplicationCommandOptionAllowedChannelType, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, type ApplicationCommandOptionBaseData, type ApplicationCommandOptionChannelTypesData, ApplicationCommandOptionChannelTypesMixin, type ApplicationCommandOptionWithAutocompleteData, ApplicationCommandOptionWithAutocompleteMixin, type ApplicationCommandOptionWithChoicesData, ApplicationCommandOptionWithChoicesMixin, AttachmentBuilder, type AutocompletableOptions, BaseButtonBuilder, BaseSelectMenuBuilder, type ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandAttachmentOption, ChatInputCommandBooleanOption, ChatInputCommandBuilder, ChatInputCommandChannelOption, ChatInputCommandIntegerOption, ChatInputCommandMentionableOption, ChatInputCommandNumberOption, ChatInputCommandRoleOption, ChatInputCommandStringOption, ChatInputCommandSubcommandBuilder, ChatInputCommandSubcommandGroupBuilder, type ChatInputCommandSubcommandGroupData, ChatInputCommandUserOption, CommandBuilder, type CommandData, ComponentBuilder, type ComponentBuilderBaseData, ContainerBuilder, type ContainerBuilderData, type ContainerComponentBuilders, ContextMenuCommandBuilder, type ContextMenuCommandType, CustomIdButtonBuilder, type CustomIdButtonStyle, DangerButtonBuilder, EmbedAuthorBuilder, EmbedBuilder, type EmbedBuilderData, EmbedFieldBuilder, EmbedFooterBuilder, type EmojiOrLabelButtonData, EmojiOrLabelButtonMixin, FileBuilder, FileUploadBuilder, LabelBuilder, type LabelBuilderData, LinkButtonBuilder, type MappedComponentTypes, MediaGalleryBuilder, type MediaGalleryBuilderData, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, MessageBuilder, type MessageBuilderData, type MessageComponentBuilder, MessageContextCommandBuilder, MessageReferenceBuilder, type MessageTopLevelComponentBuilder, type ModalActionRowComponentBuilder, ModalBuilder, type ModalBuilderData, type ModalComponentBuilder, PollAnswerBuilder, type PollAnswerData, PollAnswerMediaBuilder, PollBuilder, type PollData, PollMediaBuilder, PollQuestionBuilder, PremiumButtonBuilder, PrimaryButtonBuilder, type RestOrArray, RoleSelectMenuBuilder, SecondaryButtonBuilder, SectionBuilder, type SectionBuilderAccessory, type SectionBuilderData, SeparatorBuilder, SharedChatInputCommandOptions, type SharedChatInputCommandOptionsData, SharedChatInputCommandSubcommands, type SharedChatInputCommandSubcommandsData, SharedName, SharedNameAndDescription, type SharedNameAndDescriptionData, type SharedNameData, StringSelectMenuBuilder, type StringSelectMenuData, StringSelectMenuOptionBuilder, SuccessButtonBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserContextCommandBuilder, UserSelectMenuBuilder, ValidationError, actionRowPredicate, allowedMentionPredicate, attachmentPredicate, basicOptionPredicate, buttonPredicate, channelOptionPredicate, chatInputCommandPredicate, chatInputCommandSubcommandGroupPredicate, chatInputCommandSubcommandPredicate, containerPredicate, createComponentBuilder, customIdPredicate, disableValidators, embedAuthorPredicate, embedFieldPredicate, embedFooterPredicate,
|
|
4858
|
+
export { ActionRowBuilder, type ActionRowBuilderData, AllowedMentionsBuilder, type AnyActionRowComponentBuilder, type AnyModalComponentBuilder, type ApplicationCommandNumericOptionMinMaxValueData, ApplicationCommandNumericOptionMinMaxValueMixin, type ApplicationCommandOptionAllowedChannelType, ApplicationCommandOptionAllowedChannelTypes, ApplicationCommandOptionBase, type ApplicationCommandOptionBaseData, type ApplicationCommandOptionChannelTypesData, ApplicationCommandOptionChannelTypesMixin, type ApplicationCommandOptionWithAutocompleteData, ApplicationCommandOptionWithAutocompleteMixin, type ApplicationCommandOptionWithChoicesData, ApplicationCommandOptionWithChoicesMixin, AttachmentBuilder, type AutocompletableOptions, BaseButtonBuilder, BaseSelectMenuBuilder, type ButtonBuilder, ChannelSelectMenuBuilder, ChatInputCommandAttachmentOption, ChatInputCommandBooleanOption, ChatInputCommandBuilder, ChatInputCommandChannelOption, ChatInputCommandIntegerOption, ChatInputCommandMentionableOption, ChatInputCommandNumberOption, ChatInputCommandRoleOption, ChatInputCommandStringOption, ChatInputCommandSubcommandBuilder, ChatInputCommandSubcommandGroupBuilder, type ChatInputCommandSubcommandGroupData, ChatInputCommandUserOption, CommandBuilder, type CommandData, ComponentBuilder, type ComponentBuilderBaseData, ContainerBuilder, type ContainerBuilderData, type ContainerComponentBuilders, ContextMenuCommandBuilder, type ContextMenuCommandType, CustomIdButtonBuilder, type CustomIdButtonStyle, DangerButtonBuilder, EmbedAuthorBuilder, EmbedBuilder, type EmbedBuilderData, EmbedFieldBuilder, EmbedFooterBuilder, type EmojiOrLabelButtonData, EmojiOrLabelButtonMixin, FileBuilder, FileUploadBuilder, LabelBuilder, type LabelBuilderData, LinkButtonBuilder, type MappedComponentTypes, MediaGalleryBuilder, type MediaGalleryBuilderData, MediaGalleryItemBuilder, MentionableSelectMenuBuilder, type MessageActionRowComponentBuilder, MessageBuilder, type MessageBuilderData, type MessageComponentBuilder, MessageContextCommandBuilder, MessageReferenceBuilder, type MessageTopLevelComponentBuilder, type ModalActionRowComponentBuilder, ModalBuilder, type ModalBuilderData, type ModalComponentBuilder, PollAnswerBuilder, type PollAnswerData, PollAnswerMediaBuilder, PollBuilder, type PollData, PollMediaBuilder, PollQuestionBuilder, PremiumButtonBuilder, PrimaryButtonBuilder, type RestOrArray, RoleSelectMenuBuilder, SecondaryButtonBuilder, SectionBuilder, type SectionBuilderAccessory, type SectionBuilderData, SeparatorBuilder, SharedChatInputCommandOptions, type SharedChatInputCommandOptionsData, SharedChatInputCommandSubcommands, type SharedChatInputCommandSubcommandsData, SharedName, SharedNameAndDescription, type SharedNameAndDescriptionData, type SharedNameData, StringSelectMenuBuilder, type StringSelectMenuData, StringSelectMenuOptionBuilder, SuccessButtonBuilder, TextDisplayBuilder, TextInputBuilder, ThumbnailBuilder, UserContextCommandBuilder, UserSelectMenuBuilder, ValidationError, actionRowPredicate, allowedMentionPredicate, attachmentPredicate, basicOptionPredicate, buttonPredicate, channelOptionPredicate, chatInputCommandPredicate, chatInputCommandSubcommandGroupPredicate, chatInputCommandSubcommandPredicate, containerPredicate, createComponentBuilder, customIdPredicate, disableValidators, embedAuthorPredicate, embedFieldPredicate, embedFooterPredicate, embedPredicate, emojiPredicate, enableValidators, fileBodyMessagePredicate, filePredicate, fileUploadPredicate, idPredicate, integerOptionPredicate, isValidationEnabled, labelPredicate, localeMapPredicate, mediaGalleryItemPredicate, mediaGalleryPredicate, memberPermissionsPredicate, messageCommandPredicate, messagePredicate, messageReferencePredicate, modalPredicate, normalizeArray, numberOptionPredicate, pollAnswerMediaPredicate, pollAnswerPredicate, pollPredicate, pollQuestionPredicate, rawFilePredicate, resolveAccessoryComponent, resolveBuilder, sectionPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, separatorPredicate, snowflakePredicate, stringOptionPredicate, textDisplayPredicate, textInputPredicate, thumbnailPredicate, userCommandPredicate, version };
|