@discordjs/builders 2.0.0-dev.1763510521-315f42278 → 2.0.0-dev.1763596917-68bb8af58
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 +184 -4
- package/dist/index.d.ts +184 -4
- package/dist/index.js +99 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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
|
}
|
|
@@ -3982,6 +3984,12 @@ declare class AllowedMentionsBuilder implements JSONEncodable<APIAllowedMentions
|
|
|
3982
3984
|
toJSON(validationOverride?: boolean): APIAllowedMentions;
|
|
3983
3985
|
}
|
|
3984
3986
|
|
|
3987
|
+
declare const rawFilePredicate: z.ZodObject<{
|
|
3988
|
+
data: z.ZodUnion<readonly [z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodString]>;
|
|
3989
|
+
name: z.ZodString;
|
|
3990
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
3991
|
+
key: z.ZodOptional<z.ZodString>;
|
|
3992
|
+
}, z.core.$strip>;
|
|
3985
3993
|
declare const attachmentPredicate: z.ZodObject<{
|
|
3986
3994
|
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
3987
3995
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -4121,6 +4129,132 @@ declare const messagePredicate: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
4121
4129
|
sticker_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4122
4130
|
poll: z.ZodOptional<z.ZodNull>;
|
|
4123
4131
|
}, z.core.$strip>]>;
|
|
4132
|
+
declare const fileBodyMessagePredicate: z.ZodObject<{
|
|
4133
|
+
body: z.ZodUnion<readonly [z.ZodObject<{
|
|
4134
|
+
nonce: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4135
|
+
tts: z.ZodOptional<z.ZodBoolean>;
|
|
4136
|
+
allowed_mentions: z.ZodOptional<z.ZodObject<{
|
|
4137
|
+
parse: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AllowedMentionsTypes>>>;
|
|
4138
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4139
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4140
|
+
replied_user: z.ZodOptional<z.ZodBoolean>;
|
|
4141
|
+
}, z.core.$strip>>;
|
|
4142
|
+
message_reference: z.ZodOptional<z.ZodObject<{
|
|
4143
|
+
channel_id: z.ZodOptional<z.ZodString>;
|
|
4144
|
+
fail_if_not_exists: z.ZodOptional<z.ZodBoolean>;
|
|
4145
|
+
guild_id: z.ZodOptional<z.ZodString>;
|
|
4146
|
+
message_id: z.ZodString;
|
|
4147
|
+
type: z.ZodOptional<z.ZodEnum<typeof MessageReferenceType>>;
|
|
4148
|
+
}, z.core.$strip>>;
|
|
4149
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4150
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
4151
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4152
|
+
duration_secs: z.ZodOptional<z.ZodNumber>;
|
|
4153
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
4154
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4155
|
+
waveform: z.ZodOptional<z.ZodString>;
|
|
4156
|
+
}, z.core.$strip>>>;
|
|
4157
|
+
enforce_nonce: z.ZodOptional<z.ZodBoolean>;
|
|
4158
|
+
content: z.ZodOptional<z.ZodString>;
|
|
4159
|
+
embeds: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4160
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4161
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4162
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
4163
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
4164
|
+
color: z.ZodOptional<z.ZodInt>;
|
|
4165
|
+
footer: z.ZodOptional<z.ZodObject<{
|
|
4166
|
+
text: z.ZodString;
|
|
4167
|
+
icon_url: z.ZodOptional<z.ZodURL>;
|
|
4168
|
+
}, z.core.$strip>>;
|
|
4169
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
4170
|
+
url: z.ZodURL;
|
|
4171
|
+
}, z.core.$strip>>;
|
|
4172
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
4173
|
+
url: z.ZodURL;
|
|
4174
|
+
}, z.core.$strip>>;
|
|
4175
|
+
author: z.ZodOptional<z.ZodObject<{
|
|
4176
|
+
name: z.ZodString;
|
|
4177
|
+
icon_url: z.ZodOptional<z.ZodURL>;
|
|
4178
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
4179
|
+
}, z.core.$strip>>;
|
|
4180
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4181
|
+
name: z.ZodString;
|
|
4182
|
+
value: z.ZodString;
|
|
4183
|
+
inline: z.ZodOptional<z.ZodBoolean>;
|
|
4184
|
+
}, z.core.$strip>>>;
|
|
4185
|
+
}, z.core.$strip>>>;
|
|
4186
|
+
sticker_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4187
|
+
poll: z.ZodOptional<z.ZodObject<{
|
|
4188
|
+
question: z.ZodObject<{
|
|
4189
|
+
text: z.ZodString;
|
|
4190
|
+
}, z.core.$strip>;
|
|
4191
|
+
answers: z.ZodArray<z.ZodObject<{
|
|
4192
|
+
poll_media: z.ZodObject<{
|
|
4193
|
+
text: z.ZodString;
|
|
4194
|
+
emoji: z.ZodOptional<z.ZodObject<{
|
|
4195
|
+
id: z.ZodOptional<z.ZodString>;
|
|
4196
|
+
name: z.ZodOptional<z.ZodString>;
|
|
4197
|
+
animated: z.ZodOptional<z.ZodBoolean>;
|
|
4198
|
+
}, z.core.$strict>>;
|
|
4199
|
+
}, z.core.$strip>;
|
|
4200
|
+
}, z.core.$strip>>;
|
|
4201
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
4202
|
+
allow_multiselect: z.ZodOptional<z.ZodBoolean>;
|
|
4203
|
+
layout_type: z.ZodOptional<z.ZodEnum<typeof discord_api_types_v10.PollLayoutType>>;
|
|
4204
|
+
}, z.core.$strip>>;
|
|
4205
|
+
components: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4206
|
+
type: z.ZodLiteral<ComponentType.ActionRow>;
|
|
4207
|
+
components: z.ZodArray<z.ZodObject<{
|
|
4208
|
+
type: z.ZodLiteral<ComponentType.Button | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect>;
|
|
4209
|
+
}, z.core.$strip>>;
|
|
4210
|
+
}, z.core.$strip>>>;
|
|
4211
|
+
flags: z.ZodOptional<z.ZodInt>;
|
|
4212
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4213
|
+
nonce: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4214
|
+
tts: z.ZodOptional<z.ZodBoolean>;
|
|
4215
|
+
allowed_mentions: z.ZodOptional<z.ZodObject<{
|
|
4216
|
+
parse: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AllowedMentionsTypes>>>;
|
|
4217
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4218
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4219
|
+
replied_user: z.ZodOptional<z.ZodBoolean>;
|
|
4220
|
+
}, z.core.$strip>>;
|
|
4221
|
+
message_reference: z.ZodOptional<z.ZodObject<{
|
|
4222
|
+
channel_id: z.ZodOptional<z.ZodString>;
|
|
4223
|
+
fail_if_not_exists: z.ZodOptional<z.ZodBoolean>;
|
|
4224
|
+
guild_id: z.ZodOptional<z.ZodString>;
|
|
4225
|
+
message_id: z.ZodString;
|
|
4226
|
+
type: z.ZodOptional<z.ZodEnum<typeof MessageReferenceType>>;
|
|
4227
|
+
}, z.core.$strip>>;
|
|
4228
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4229
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
4230
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4231
|
+
duration_secs: z.ZodOptional<z.ZodNumber>;
|
|
4232
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
4233
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4234
|
+
waveform: z.ZodOptional<z.ZodString>;
|
|
4235
|
+
}, z.core.$strip>>>;
|
|
4236
|
+
enforce_nonce: z.ZodOptional<z.ZodBoolean>;
|
|
4237
|
+
components: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
4238
|
+
type: z.ZodLiteral<ComponentType.ActionRow>;
|
|
4239
|
+
components: z.ZodArray<z.ZodObject<{
|
|
4240
|
+
type: z.ZodLiteral<ComponentType.Button | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect>;
|
|
4241
|
+
}, z.core.$strip>>;
|
|
4242
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4243
|
+
type: z.ZodLiteral<ComponentType.Section | ComponentType.TextDisplay | ComponentType.Thumbnail | ComponentType.MediaGallery | ComponentType.File | ComponentType.Separator | ComponentType.Container>;
|
|
4244
|
+
}, z.core.$strip>]>>;
|
|
4245
|
+
flags: z.ZodInt;
|
|
4246
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4247
|
+
embeds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4248
|
+
sticker_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4249
|
+
poll: z.ZodOptional<z.ZodNull>;
|
|
4250
|
+
}, z.core.$strip>]>;
|
|
4251
|
+
files: z.ZodArray<z.ZodObject<{
|
|
4252
|
+
data: z.ZodUnion<readonly [z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodString]>;
|
|
4253
|
+
name: z.ZodString;
|
|
4254
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
4255
|
+
key: z.ZodOptional<z.ZodString>;
|
|
4256
|
+
}, z.core.$strip>>;
|
|
4257
|
+
}, z.core.$strip>;
|
|
4124
4258
|
|
|
4125
4259
|
/**
|
|
4126
4260
|
* A builder that creates API-compatible JSON data for attachments.
|
|
@@ -4130,6 +4264,16 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4130
4264
|
* The API data associated with this attachment.
|
|
4131
4265
|
*/
|
|
4132
4266
|
private readonly data;
|
|
4267
|
+
/**
|
|
4268
|
+
* This data is not included in the output of `toJSON()`. For this class specifically, this refers to binary data
|
|
4269
|
+
* that will wind up being included in the multipart/form-data request, if used with the `MessageBuilder`.
|
|
4270
|
+
* To retrieve this data, use {@link getRawFile}.
|
|
4271
|
+
*
|
|
4272
|
+
* @remarks This cannot be set via the constructor, primarily because of the behavior described
|
|
4273
|
+
* {@link https://discord.com/developers/docs/reference#editing-message-attachments | here}.
|
|
4274
|
+
* That is, when editing a message's attachments, you should only be providing file data for new attachments.
|
|
4275
|
+
*/
|
|
4276
|
+
private readonly fileData;
|
|
4133
4277
|
/**
|
|
4134
4278
|
* Creates a new attachment builder.
|
|
4135
4279
|
*
|
|
@@ -4141,7 +4285,7 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4141
4285
|
*
|
|
4142
4286
|
* @param id - The id of the attachment
|
|
4143
4287
|
*/
|
|
4144
|
-
setId(id: Snowflake): this;
|
|
4288
|
+
setId(id: Snowflake | number): this;
|
|
4145
4289
|
/**
|
|
4146
4290
|
* Sets the description of this attachment.
|
|
4147
4291
|
*
|
|
@@ -4172,6 +4316,33 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4172
4316
|
* Clears the filename of this attachment.
|
|
4173
4317
|
*/
|
|
4174
4318
|
clearFilename(): this;
|
|
4319
|
+
/**
|
|
4320
|
+
* Sets the file data to upload with this attachment.
|
|
4321
|
+
*
|
|
4322
|
+
* @param data - The file data
|
|
4323
|
+
* @remarks Note that this data is NOT included in the {@link toJSON} output. To retrieve it, use {@link getRawFile}.
|
|
4324
|
+
*/
|
|
4325
|
+
setFileData(data: Buffer | Uint8Array | string): this;
|
|
4326
|
+
/**
|
|
4327
|
+
* Clears the file data from this attachment.
|
|
4328
|
+
*/
|
|
4329
|
+
clearFileData(): this;
|
|
4330
|
+
/**
|
|
4331
|
+
* Sets the content type of the file data to upload with this attachment.
|
|
4332
|
+
*
|
|
4333
|
+
* @remarks Note that this data is NOT included in the {@link toJSON} output. To retrieve it, use {@link getRawFile}.
|
|
4334
|
+
*/
|
|
4335
|
+
setFileContentType(contentType: string): this;
|
|
4336
|
+
/**
|
|
4337
|
+
* Clears the content type of the file data from this attachment.
|
|
4338
|
+
*/
|
|
4339
|
+
clearFileContentType(): this;
|
|
4340
|
+
/**
|
|
4341
|
+
* Converts this attachment to a {@link RawFile} for uploading.
|
|
4342
|
+
*
|
|
4343
|
+
* @returns A {@link RawFile} object, or `undefined` if no file data is set
|
|
4344
|
+
*/
|
|
4345
|
+
getRawFile(): Partial<RawFile> | undefined;
|
|
4175
4346
|
/**
|
|
4176
4347
|
* Sets the title of this attachment.
|
|
4177
4348
|
*
|
|
@@ -4279,7 +4450,7 @@ interface MessageBuilderData extends Partial<Omit<RESTPostAPIChannelMessageJSONB
|
|
|
4279
4450
|
/**
|
|
4280
4451
|
* A builder that creates API-compatible JSON data for messages.
|
|
4281
4452
|
*/
|
|
4282
|
-
declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJSONBody> {
|
|
4453
|
+
declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJSONBody>, FileBodyEncodable<RESTPostAPIChannelMessageJSONBody> {
|
|
4283
4454
|
/**
|
|
4284
4455
|
* The API data associated with this message.
|
|
4285
4456
|
*/
|
|
@@ -4612,6 +4783,15 @@ declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJ
|
|
|
4612
4783
|
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
4613
4784
|
*/
|
|
4614
4785
|
toJSON(validationOverride?: boolean): RESTPostAPIChannelMessageJSONBody;
|
|
4786
|
+
/**
|
|
4787
|
+
* Serializes this builder to both JSON body and file data for multipart/form-data requests.
|
|
4788
|
+
*
|
|
4789
|
+
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
4790
|
+
* @remarks
|
|
4791
|
+
* This method extracts file data from attachments that have files set via {@link AttachmentBuilder.setFileData}.
|
|
4792
|
+
* The returned body includes attachment metadata, while files contains the binary data for upload.
|
|
4793
|
+
*/
|
|
4794
|
+
toFileBody(validationOverride?: boolean): FileBodyEncodableResult<RESTPostAPIChannelMessageJSONBody>;
|
|
4615
4795
|
}
|
|
4616
4796
|
|
|
4617
4797
|
/**
|
|
@@ -4678,4 +4858,4 @@ declare const localeMapPredicate: z.ZodObject<Record<Locale, z.ZodOptional<z.Zod
|
|
|
4678
4858
|
*/
|
|
4679
4859
|
declare const version: string;
|
|
4680
4860
|
|
|
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, embedLength, embedPredicate, emojiPredicate, enableValidators, filePredicate, fileUploadPredicate, idPredicate, integerOptionPredicate, isValidationEnabled, labelPredicate, localeMapPredicate, mediaGalleryItemPredicate, mediaGalleryPredicate, memberPermissionsPredicate, messageCommandPredicate, messagePredicate, messageReferencePredicate, modalPredicate, normalizeArray, numberOptionPredicate, pollAnswerMediaPredicate, pollAnswerPredicate, pollPredicate, pollQuestionPredicate, resolveAccessoryComponent, resolveBuilder, sectionPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, separatorPredicate, stringOptionPredicate, textDisplayPredicate, textInputPredicate, thumbnailPredicate, userCommandPredicate, version };
|
|
4861
|
+
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, embedLength, 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, stringOptionPredicate, textDisplayPredicate, textInputPredicate, thumbnailPredicate, userCommandPredicate, version };
|
package/dist/index.d.ts
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
|
}
|
|
@@ -3982,6 +3984,12 @@ declare class AllowedMentionsBuilder implements JSONEncodable<APIAllowedMentions
|
|
|
3982
3984
|
toJSON(validationOverride?: boolean): APIAllowedMentions;
|
|
3983
3985
|
}
|
|
3984
3986
|
|
|
3987
|
+
declare const rawFilePredicate: z.ZodObject<{
|
|
3988
|
+
data: z.ZodUnion<readonly [z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodString]>;
|
|
3989
|
+
name: z.ZodString;
|
|
3990
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
3991
|
+
key: z.ZodOptional<z.ZodString>;
|
|
3992
|
+
}, z.core.$strip>;
|
|
3985
3993
|
declare const attachmentPredicate: z.ZodObject<{
|
|
3986
3994
|
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
3987
3995
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -4121,6 +4129,132 @@ declare const messagePredicate: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
4121
4129
|
sticker_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4122
4130
|
poll: z.ZodOptional<z.ZodNull>;
|
|
4123
4131
|
}, z.core.$strip>]>;
|
|
4132
|
+
declare const fileBodyMessagePredicate: z.ZodObject<{
|
|
4133
|
+
body: z.ZodUnion<readonly [z.ZodObject<{
|
|
4134
|
+
nonce: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4135
|
+
tts: z.ZodOptional<z.ZodBoolean>;
|
|
4136
|
+
allowed_mentions: z.ZodOptional<z.ZodObject<{
|
|
4137
|
+
parse: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AllowedMentionsTypes>>>;
|
|
4138
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4139
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4140
|
+
replied_user: z.ZodOptional<z.ZodBoolean>;
|
|
4141
|
+
}, z.core.$strip>>;
|
|
4142
|
+
message_reference: z.ZodOptional<z.ZodObject<{
|
|
4143
|
+
channel_id: z.ZodOptional<z.ZodString>;
|
|
4144
|
+
fail_if_not_exists: z.ZodOptional<z.ZodBoolean>;
|
|
4145
|
+
guild_id: z.ZodOptional<z.ZodString>;
|
|
4146
|
+
message_id: z.ZodString;
|
|
4147
|
+
type: z.ZodOptional<z.ZodEnum<typeof MessageReferenceType>>;
|
|
4148
|
+
}, z.core.$strip>>;
|
|
4149
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4150
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
4151
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4152
|
+
duration_secs: z.ZodOptional<z.ZodNumber>;
|
|
4153
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
4154
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4155
|
+
waveform: z.ZodOptional<z.ZodString>;
|
|
4156
|
+
}, z.core.$strip>>>;
|
|
4157
|
+
enforce_nonce: z.ZodOptional<z.ZodBoolean>;
|
|
4158
|
+
content: z.ZodOptional<z.ZodString>;
|
|
4159
|
+
embeds: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4160
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4161
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4162
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
4163
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
4164
|
+
color: z.ZodOptional<z.ZodInt>;
|
|
4165
|
+
footer: z.ZodOptional<z.ZodObject<{
|
|
4166
|
+
text: z.ZodString;
|
|
4167
|
+
icon_url: z.ZodOptional<z.ZodURL>;
|
|
4168
|
+
}, z.core.$strip>>;
|
|
4169
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
4170
|
+
url: z.ZodURL;
|
|
4171
|
+
}, z.core.$strip>>;
|
|
4172
|
+
thumbnail: z.ZodOptional<z.ZodObject<{
|
|
4173
|
+
url: z.ZodURL;
|
|
4174
|
+
}, z.core.$strip>>;
|
|
4175
|
+
author: z.ZodOptional<z.ZodObject<{
|
|
4176
|
+
name: z.ZodString;
|
|
4177
|
+
icon_url: z.ZodOptional<z.ZodURL>;
|
|
4178
|
+
url: z.ZodOptional<z.ZodURL>;
|
|
4179
|
+
}, z.core.$strip>>;
|
|
4180
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4181
|
+
name: z.ZodString;
|
|
4182
|
+
value: z.ZodString;
|
|
4183
|
+
inline: z.ZodOptional<z.ZodBoolean>;
|
|
4184
|
+
}, z.core.$strip>>>;
|
|
4185
|
+
}, z.core.$strip>>>;
|
|
4186
|
+
sticker_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4187
|
+
poll: z.ZodOptional<z.ZodObject<{
|
|
4188
|
+
question: z.ZodObject<{
|
|
4189
|
+
text: z.ZodString;
|
|
4190
|
+
}, z.core.$strip>;
|
|
4191
|
+
answers: z.ZodArray<z.ZodObject<{
|
|
4192
|
+
poll_media: z.ZodObject<{
|
|
4193
|
+
text: z.ZodString;
|
|
4194
|
+
emoji: z.ZodOptional<z.ZodObject<{
|
|
4195
|
+
id: z.ZodOptional<z.ZodString>;
|
|
4196
|
+
name: z.ZodOptional<z.ZodString>;
|
|
4197
|
+
animated: z.ZodOptional<z.ZodBoolean>;
|
|
4198
|
+
}, z.core.$strict>>;
|
|
4199
|
+
}, z.core.$strip>;
|
|
4200
|
+
}, z.core.$strip>>;
|
|
4201
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
4202
|
+
allow_multiselect: z.ZodOptional<z.ZodBoolean>;
|
|
4203
|
+
layout_type: z.ZodOptional<z.ZodEnum<typeof discord_api_types_v10.PollLayoutType>>;
|
|
4204
|
+
}, z.core.$strip>>;
|
|
4205
|
+
components: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4206
|
+
type: z.ZodLiteral<ComponentType.ActionRow>;
|
|
4207
|
+
components: z.ZodArray<z.ZodObject<{
|
|
4208
|
+
type: z.ZodLiteral<ComponentType.Button | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect>;
|
|
4209
|
+
}, z.core.$strip>>;
|
|
4210
|
+
}, z.core.$strip>>>;
|
|
4211
|
+
flags: z.ZodOptional<z.ZodInt>;
|
|
4212
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4213
|
+
nonce: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
4214
|
+
tts: z.ZodOptional<z.ZodBoolean>;
|
|
4215
|
+
allowed_mentions: z.ZodOptional<z.ZodObject<{
|
|
4216
|
+
parse: z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AllowedMentionsTypes>>>;
|
|
4217
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4218
|
+
users: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4219
|
+
replied_user: z.ZodOptional<z.ZodBoolean>;
|
|
4220
|
+
}, z.core.$strip>>;
|
|
4221
|
+
message_reference: z.ZodOptional<z.ZodObject<{
|
|
4222
|
+
channel_id: z.ZodOptional<z.ZodString>;
|
|
4223
|
+
fail_if_not_exists: z.ZodOptional<z.ZodBoolean>;
|
|
4224
|
+
guild_id: z.ZodOptional<z.ZodString>;
|
|
4225
|
+
message_id: z.ZodString;
|
|
4226
|
+
type: z.ZodOptional<z.ZodEnum<typeof MessageReferenceType>>;
|
|
4227
|
+
}, z.core.$strip>>;
|
|
4228
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4229
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
4230
|
+
description: z.ZodOptional<z.ZodString>;
|
|
4231
|
+
duration_secs: z.ZodOptional<z.ZodNumber>;
|
|
4232
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
4233
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4234
|
+
waveform: z.ZodOptional<z.ZodString>;
|
|
4235
|
+
}, z.core.$strip>>>;
|
|
4236
|
+
enforce_nonce: z.ZodOptional<z.ZodBoolean>;
|
|
4237
|
+
components: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
4238
|
+
type: z.ZodLiteral<ComponentType.ActionRow>;
|
|
4239
|
+
components: z.ZodArray<z.ZodObject<{
|
|
4240
|
+
type: z.ZodLiteral<ComponentType.Button | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.RoleSelect | ComponentType.MentionableSelect | ComponentType.ChannelSelect>;
|
|
4241
|
+
}, z.core.$strip>>;
|
|
4242
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
4243
|
+
type: z.ZodLiteral<ComponentType.Section | ComponentType.TextDisplay | ComponentType.Thumbnail | ComponentType.MediaGallery | ComponentType.File | ComponentType.Separator | ComponentType.Container>;
|
|
4244
|
+
}, z.core.$strip>]>>;
|
|
4245
|
+
flags: z.ZodInt;
|
|
4246
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4247
|
+
embeds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4248
|
+
sticker_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNever>>>;
|
|
4249
|
+
poll: z.ZodOptional<z.ZodNull>;
|
|
4250
|
+
}, z.core.$strip>]>;
|
|
4251
|
+
files: z.ZodArray<z.ZodObject<{
|
|
4252
|
+
data: z.ZodUnion<readonly [z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodString]>;
|
|
4253
|
+
name: z.ZodString;
|
|
4254
|
+
contentType: z.ZodOptional<z.ZodString>;
|
|
4255
|
+
key: z.ZodOptional<z.ZodString>;
|
|
4256
|
+
}, z.core.$strip>>;
|
|
4257
|
+
}, z.core.$strip>;
|
|
4124
4258
|
|
|
4125
4259
|
/**
|
|
4126
4260
|
* A builder that creates API-compatible JSON data for attachments.
|
|
@@ -4130,6 +4264,16 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4130
4264
|
* The API data associated with this attachment.
|
|
4131
4265
|
*/
|
|
4132
4266
|
private readonly data;
|
|
4267
|
+
/**
|
|
4268
|
+
* This data is not included in the output of `toJSON()`. For this class specifically, this refers to binary data
|
|
4269
|
+
* that will wind up being included in the multipart/form-data request, if used with the `MessageBuilder`.
|
|
4270
|
+
* To retrieve this data, use {@link getRawFile}.
|
|
4271
|
+
*
|
|
4272
|
+
* @remarks This cannot be set via the constructor, primarily because of the behavior described
|
|
4273
|
+
* {@link https://discord.com/developers/docs/reference#editing-message-attachments | here}.
|
|
4274
|
+
* That is, when editing a message's attachments, you should only be providing file data for new attachments.
|
|
4275
|
+
*/
|
|
4276
|
+
private readonly fileData;
|
|
4133
4277
|
/**
|
|
4134
4278
|
* Creates a new attachment builder.
|
|
4135
4279
|
*
|
|
@@ -4141,7 +4285,7 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4141
4285
|
*
|
|
4142
4286
|
* @param id - The id of the attachment
|
|
4143
4287
|
*/
|
|
4144
|
-
setId(id: Snowflake): this;
|
|
4288
|
+
setId(id: Snowflake | number): this;
|
|
4145
4289
|
/**
|
|
4146
4290
|
* Sets the description of this attachment.
|
|
4147
4291
|
*
|
|
@@ -4172,6 +4316,33 @@ declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment> {
|
|
|
4172
4316
|
* Clears the filename of this attachment.
|
|
4173
4317
|
*/
|
|
4174
4318
|
clearFilename(): this;
|
|
4319
|
+
/**
|
|
4320
|
+
* Sets the file data to upload with this attachment.
|
|
4321
|
+
*
|
|
4322
|
+
* @param data - The file data
|
|
4323
|
+
* @remarks Note that this data is NOT included in the {@link toJSON} output. To retrieve it, use {@link getRawFile}.
|
|
4324
|
+
*/
|
|
4325
|
+
setFileData(data: Buffer | Uint8Array | string): this;
|
|
4326
|
+
/**
|
|
4327
|
+
* Clears the file data from this attachment.
|
|
4328
|
+
*/
|
|
4329
|
+
clearFileData(): this;
|
|
4330
|
+
/**
|
|
4331
|
+
* Sets the content type of the file data to upload with this attachment.
|
|
4332
|
+
*
|
|
4333
|
+
* @remarks Note that this data is NOT included in the {@link toJSON} output. To retrieve it, use {@link getRawFile}.
|
|
4334
|
+
*/
|
|
4335
|
+
setFileContentType(contentType: string): this;
|
|
4336
|
+
/**
|
|
4337
|
+
* Clears the content type of the file data from this attachment.
|
|
4338
|
+
*/
|
|
4339
|
+
clearFileContentType(): this;
|
|
4340
|
+
/**
|
|
4341
|
+
* Converts this attachment to a {@link RawFile} for uploading.
|
|
4342
|
+
*
|
|
4343
|
+
* @returns A {@link RawFile} object, or `undefined` if no file data is set
|
|
4344
|
+
*/
|
|
4345
|
+
getRawFile(): Partial<RawFile> | undefined;
|
|
4175
4346
|
/**
|
|
4176
4347
|
* Sets the title of this attachment.
|
|
4177
4348
|
*
|
|
@@ -4279,7 +4450,7 @@ interface MessageBuilderData extends Partial<Omit<RESTPostAPIChannelMessageJSONB
|
|
|
4279
4450
|
/**
|
|
4280
4451
|
* A builder that creates API-compatible JSON data for messages.
|
|
4281
4452
|
*/
|
|
4282
|
-
declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJSONBody> {
|
|
4453
|
+
declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJSONBody>, FileBodyEncodable<RESTPostAPIChannelMessageJSONBody> {
|
|
4283
4454
|
/**
|
|
4284
4455
|
* The API data associated with this message.
|
|
4285
4456
|
*/
|
|
@@ -4612,6 +4783,15 @@ declare class MessageBuilder implements JSONEncodable<RESTPostAPIChannelMessageJ
|
|
|
4612
4783
|
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
4613
4784
|
*/
|
|
4614
4785
|
toJSON(validationOverride?: boolean): RESTPostAPIChannelMessageJSONBody;
|
|
4786
|
+
/**
|
|
4787
|
+
* Serializes this builder to both JSON body and file data for multipart/form-data requests.
|
|
4788
|
+
*
|
|
4789
|
+
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
4790
|
+
* @remarks
|
|
4791
|
+
* This method extracts file data from attachments that have files set via {@link AttachmentBuilder.setFileData}.
|
|
4792
|
+
* The returned body includes attachment metadata, while files contains the binary data for upload.
|
|
4793
|
+
*/
|
|
4794
|
+
toFileBody(validationOverride?: boolean): FileBodyEncodableResult<RESTPostAPIChannelMessageJSONBody>;
|
|
4615
4795
|
}
|
|
4616
4796
|
|
|
4617
4797
|
/**
|
|
@@ -4678,4 +4858,4 @@ declare const localeMapPredicate: z.ZodObject<Record<Locale, z.ZodOptional<z.Zod
|
|
|
4678
4858
|
*/
|
|
4679
4859
|
declare const version: string;
|
|
4680
4860
|
|
|
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, embedLength, embedPredicate, emojiPredicate, enableValidators, filePredicate, fileUploadPredicate, idPredicate, integerOptionPredicate, isValidationEnabled, labelPredicate, localeMapPredicate, mediaGalleryItemPredicate, mediaGalleryPredicate, memberPermissionsPredicate, messageCommandPredicate, messagePredicate, messageReferencePredicate, modalPredicate, normalizeArray, numberOptionPredicate, pollAnswerMediaPredicate, pollAnswerPredicate, pollPredicate, pollQuestionPredicate, resolveAccessoryComponent, resolveBuilder, sectionPredicate, selectMenuChannelPredicate, selectMenuMentionablePredicate, selectMenuRolePredicate, selectMenuStringOptionPredicate, selectMenuStringPredicate, selectMenuUserPredicate, separatorPredicate, stringOptionPredicate, textDisplayPredicate, textInputPredicate, thumbnailPredicate, userCommandPredicate, version };
|
|
4861
|
+
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, embedLength, 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, stringOptionPredicate, textDisplayPredicate, textInputPredicate, thumbnailPredicate, userCommandPredicate, version };
|