discord.js 15.0.0-dev.1764806526-0aaba0305 → 15.0.0-dev.1765195314-d518c9784

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "discord.js",
4
- "version": "15.0.0-dev.1764806526-0aaba0305",
4
+ "version": "15.0.0-dev.1765195314-d518c9784",
5
5
  "description": "A powerful library for interacting with the Discord API",
6
6
  "main": "./src/index.js",
7
7
  "types": "./typings/index.d.ts",
@@ -55,32 +55,32 @@
55
55
  "dependencies": {
56
56
  "@sapphire/snowflake": "3.5.5",
57
57
  "@vladfrangu/async_event_emitter": "^2.4.7",
58
- "discord-api-types": "^0.38.31",
58
+ "discord-api-types": "^0.38.36",
59
59
  "fast-deep-equal": "3.1.3",
60
60
  "lodash.snakecase": "4.1.1",
61
61
  "magic-bytes.js": "^1.12.1",
62
62
  "tslib": "^2.8.1",
63
63
  "undici": "7.16.0",
64
- "@discordjs/builders": "2.0.0-dev.1764806526-0aaba0305",
65
- "@discordjs/formatters": "1.0.0-dev.1764806526-0aaba0305",
66
- "@discordjs/collection": "3.0.0-dev.1764806526-0aaba0305",
67
- "@discordjs/rest": "3.0.0-dev.1764806526-0aaba0305",
68
- "@discordjs/util": "2.0.0-dev.1764806526-0aaba0305",
69
- "@discordjs/ws": "3.0.0-dev.1764806526-0aaba0305"
64
+ "@discordjs/collection": "3.0.0-dev.1765195314-d518c9784",
65
+ "@discordjs/rest": "3.0.0-dev.1765195314-d518c9784",
66
+ "@discordjs/builders": "2.0.0-dev.1765195314-d518c9784",
67
+ "@discordjs/util": "2.0.0-dev.1765195314-d518c9784",
68
+ "@discordjs/ws": "3.0.0-dev.1765195314-d518c9784",
69
+ "@discordjs/formatters": "1.0.0-dev.1765195314-d518c9784"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@favware/cliff-jumper": "^6.0.0",
73
- "@types/node": "^22.18.13",
73
+ "@types/node": "^22.19.1",
74
74
  "cross-env": "^10.1.0",
75
- "eslint": "^9.38.0",
75
+ "eslint": "^9.39.1",
76
76
  "eslint-config-neon": "^0.2.9",
77
77
  "eslint-formatter-compact": "^9.0.1",
78
78
  "eslint-formatter-pretty": "^7.0.0",
79
79
  "eslint-plugin-import": "^2.32.0",
80
80
  "eslint-plugin-jsdoc": "^54.7.0",
81
- "prettier": "^3.6.2",
81
+ "prettier": "^3.7.4",
82
82
  "tsd": "^0.33.0",
83
- "turbo": "^2.5.8",
83
+ "turbo": "^2.6.3",
84
84
  "typescript": "~5.9.3",
85
85
  "@discordjs/api-extractor": "7.52.7",
86
86
  "@discordjs/docgen": "0.12.1",
package/src/index.js CHANGED
@@ -111,7 +111,6 @@ exports.ApplicationEmoji = require('./structures/ApplicationEmoji.js').Applicati
111
111
  exports.ApplicationRoleConnectionMetadata =
112
112
  require('./structures/ApplicationRoleConnectionMetadata.js').ApplicationRoleConnectionMetadata;
113
113
  exports.Attachment = require('./structures/Attachment.js').Attachment;
114
- exports.AttachmentBuilder = require('./structures/AttachmentBuilder.js').AttachmentBuilder;
115
114
  exports.AutocompleteInteraction = require('./structures/AutocompleteInteraction.js').AutocompleteInteraction;
116
115
  exports.AutoModerationActionExecution =
117
116
  require('./structures/AutoModerationActionExecution.js').AutoModerationActionExecution;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const process = require('node:process');
4
- const { lazy } = require('@discordjs/util');
4
+ const { lazy, isFileBodyEncodable, isJSONEncodable } = require('@discordjs/util');
5
5
  const { Routes } = require('discord-api-types/v10');
6
6
  const { BaseChannel } = require('../structures/BaseChannel.js');
7
7
  const { MessagePayload } = require('../structures/MessagePayload.js');
@@ -147,7 +147,7 @@ class ChannelManager extends CachedManager {
147
147
  * Creates a message in a channel.
148
148
  *
149
149
  * @param {TextChannelResolvable} channel The channel to send the message to
150
- * @param {string|MessagePayload|MessageCreateOptions} options The options to provide
150
+ * @param {string|MessagePayload|MessageCreateOptions|JSONEncodable<RESTPostAPIChannelMessageJSONBody>|FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>} options The options to provide
151
151
  * @returns {Promise<Message>}
152
152
  * @example
153
153
  * // Send a basic message
@@ -174,18 +174,21 @@ class ChannelManager extends CachedManager {
174
174
  * .catch(console.error);
175
175
  */
176
176
  async createMessage(channel, options) {
177
- let messagePayload;
177
+ let payload;
178
178
 
179
179
  if (options instanceof MessagePayload) {
180
- messagePayload = options.resolveBody();
180
+ payload = await options.resolveBody().resolveFiles();
181
+ } else if (isFileBodyEncodable(options)) {
182
+ payload = options.toFileBody();
183
+ } else if (isJSONEncodable(options)) {
184
+ payload = { body: options.toJSON() };
181
185
  } else {
182
- messagePayload = MessagePayload.create(this, options).resolveBody();
186
+ payload = await MessagePayload.create(this, options).resolveBody().resolveFiles();
183
187
  }
184
188
 
185
189
  const resolvedChannelId = this.resolveId(channel);
186
190
  const resolvedChannel = this.resolve(channel);
187
- const { body, files } = await messagePayload.resolveFiles();
188
- const data = await this.client.rest.post(Routes.channelMessages(resolvedChannelId), { body, files });
191
+ const data = await this.client.rest.post(Routes.channelMessages(resolvedChannelId), payload);
189
192
 
190
193
  return resolvedChannel?.messages._add(data) ?? new (getMessage())(this.client, data);
191
194
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  const { Collection } = require('@discordjs/collection');
4
4
  const { makeURLSearchParams } = require('@discordjs/rest');
5
+ const { isFileBodyEncodable, isJSONEncodable } = require('@discordjs/util');
5
6
  const { Routes } = require('discord-api-types/v10');
6
7
  const { DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
7
8
  const { Message } = require('../structures/Message.js');
@@ -223,21 +224,27 @@ class MessageManager extends CachedManager {
223
224
  * Edits a message, even if it's not cached.
224
225
  *
225
226
  * @param {MessageResolvable} message The message to edit
226
- * @param {string|MessageEditOptions|MessagePayload} options The options to edit the message
227
+ * @param {string|MessageEditOptions|MessagePayload|FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>|JSONEncodable<RESTPatchAPIChannelMessageJSONBody>} options The options to edit the message
227
228
  * @returns {Promise<Message>}
228
229
  */
229
230
  async edit(message, options) {
230
231
  const messageId = this.resolveId(message);
231
232
  if (!messageId) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'message', 'MessageResolvable');
232
233
 
233
- const { body, files } = await (
234
- options instanceof MessagePayload
235
- ? options
236
- : MessagePayload.create(message instanceof Message ? message : this, options)
237
- )
238
- .resolveBody()
239
- .resolveFiles();
240
- const data = await this.client.rest.patch(Routes.channelMessage(this.channel.id, messageId), { body, files });
234
+ let payload;
235
+ if (options instanceof MessagePayload) {
236
+ payload = await options.resolveBody().resolveFiles();
237
+ } else if (isFileBodyEncodable(options)) {
238
+ payload = options.toFileBody();
239
+ } else if (isJSONEncodable(options)) {
240
+ payload = { body: options.toJSON() };
241
+ } else {
242
+ payload = await MessagePayload.create(message instanceof Message ? message : this, options)
243
+ .resolveBody()
244
+ .resolveFiles();
245
+ }
246
+
247
+ const data = await this.client.rest.patch(Routes.channelMessage(this.channel.id, messageId), payload);
241
248
 
242
249
  const existing = this.cache.get(messageId);
243
250
  if (existing) {
@@ -192,7 +192,7 @@ class GuildInvite extends BaseInvite {
192
192
  if (!guild.members.me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
193
193
  return Boolean(
194
194
  this.channel?.permissionsFor(this.client.user).has(PermissionFlagsBits.ManageChannels, false) ||
195
- guild.members.me.permissions.has(PermissionFlagsBits.ManageGuild),
195
+ guild.members.me.permissions.has(PermissionFlagsBits.ManageGuild),
196
196
  );
197
197
  }
198
198
 
@@ -725,8 +725,8 @@ class Message extends Base {
725
725
  get editable() {
726
726
  const precheck = Boolean(
727
727
  this.author.id === this.client.user.id &&
728
- (!this.guild || this.channel?.viewable) &&
729
- this.reference?.type !== MessageReferenceType.Forward,
728
+ (!this.guild || this.channel?.viewable) &&
729
+ this.reference?.type !== MessageReferenceType.Forward,
730
730
  );
731
731
 
732
732
  // Regardless of permissions thread messages cannot be edited if
@@ -837,19 +837,19 @@ class Message extends Base {
837
837
  const { channel } = this;
838
838
  return Boolean(
839
839
  channel?.type === ChannelType.GuildAnnouncement &&
840
- !this.flags.has(MessageFlags.Crossposted) &&
841
- this.reference?.type !== MessageReferenceType.Forward &&
842
- this.type === MessageType.Default &&
843
- !this.poll &&
844
- channel.viewable &&
845
- channel.permissionsFor(this.client.user)?.has(bitfield, false),
840
+ !this.flags.has(MessageFlags.Crossposted) &&
841
+ this.reference?.type !== MessageReferenceType.Forward &&
842
+ this.type === MessageType.Default &&
843
+ !this.poll &&
844
+ channel.viewable &&
845
+ channel.permissionsFor(this.client.user)?.has(bitfield, false),
846
846
  );
847
847
  }
848
848
 
849
849
  /**
850
850
  * Edits the content of the message.
851
851
  *
852
- * @param {string|MessagePayload|MessageEditOptions} options The options to provide
852
+ * @param {string|MessageEditOptions|MessagePayload|FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>|JSONEncodable<RESTPatchAPIChannelMessageJSONBody>} options The options to provide
853
853
  * @returns {Promise<Message>}
854
854
  * @example
855
855
  * // Update the content of a message
@@ -197,10 +197,13 @@ class MessagePayload {
197
197
  waveform: file.waveform,
198
198
  duration_secs: file.duration,
199
199
  }));
200
+
201
+ // Only passable during edits
200
202
  if (Array.isArray(this.options.attachments)) {
201
- this.options.attachments.push(...(attachments ?? []));
202
- } else {
203
- this.options.attachments = attachments;
203
+ attachments.push(
204
+ // Note how we don't check for file body encodable, since we aren't expecting file data here
205
+ ...this.options.attachments.map(attachment => (isJSONEncodable(attachment) ? attachment.toJSON() : attachment)),
206
+ );
204
207
  }
205
208
 
206
209
  let poll;
@@ -237,7 +240,7 @@ class MessagePayload {
237
240
  : allowedMentions,
238
241
  flags,
239
242
  message_reference,
240
- attachments: this.options.attachments,
243
+ attachments,
241
244
  sticker_ids: this.options.stickers?.map(sticker => sticker.id ?? sticker),
242
245
  thread_name: threadName,
243
246
  applied_tags: appliedTags,
@@ -88,7 +88,7 @@ class TextBasedChannel {
88
88
  * @property {Array<(EmbedBuilder|Embed|APIEmbed)>} [embeds] The embeds for the message
89
89
  * @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
90
90
  * (see {@link https://discord.com/developers/docs/resources/message#allowed-mentions-object here} for more details)
91
- * @property {Array<(AttachmentBuilder|Attachment|AttachmentPayload|BufferResolvable)>} [files]
91
+ * @property {Array<(Attachment|AttachmentPayload|BufferResolvable|FileBodyEncodable<APIAttachment>|Stream)>} [files]
92
92
  * The files to send with the message.
93
93
  * @property {Array<(ActionRowBuilder|MessageTopLevelComponent|APIMessageTopLevelComponent)>} [components]
94
94
  * Action rows containing interactive components for the message (buttons, select menus) and other
@@ -156,7 +156,7 @@ class TextBasedChannel {
156
156
  /**
157
157
  * Sends a message to this channel.
158
158
  *
159
- * @param {string|MessagePayload|MessageCreateOptions} options The options to provide
159
+ * @param {string|MessagePayload|MessageCreateOptions|JSONEncodable<RESTPostAPIChannelMessageJSONBody>|FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>} options The options to provide
160
160
  * @returns {Promise<Message>}
161
161
  * @example
162
162
  * // Send a basic message
@@ -683,3 +683,13 @@
683
683
  * @external WebhookType
684
684
  * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/WebhookType}
685
685
  */
686
+
687
+ /**
688
+ * @external RESTPatchAPIChannelMessageJSONBody
689
+ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/RESTPatchAPIChannelMessageJSONBody}
690
+ */
691
+
692
+ /**
693
+ * @external RESTPostAPIChannelMessageJSONBody
694
+ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/RESTPostAPIChannelMessageJSONBody}
695
+ */
@@ -5,7 +5,7 @@ import { MessagePort, Worker } from 'node:worker_threads';
5
5
  import { ApplicationCommandOptionAllowedChannelType, MessageActionRowComponentBuilder } from '@discordjs/builders';
6
6
  import { Collection, ReadonlyCollection } from '@discordjs/collection';
7
7
  import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions, EmojiURLOptions } from '@discordjs/rest';
8
- import { Awaitable, JSONEncodable } from '@discordjs/util';
8
+ import { Awaitable, FileBodyEncodable, JSONEncodable } from '@discordjs/util';
9
9
  import { WebSocketManager, WebSocketManagerOptions } from '@discordjs/ws';
10
10
  import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
11
11
  import {
@@ -266,8 +266,9 @@ export type ActionRowComponentData = MessageActionRowComponentData;
266
266
 
267
267
  export type ActionRowComponent = MessageActionRowComponent;
268
268
 
269
- export interface ActionRowData<ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>>
270
- extends BaseComponentData {
269
+ export interface ActionRowData<
270
+ ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>,
271
+ > extends BaseComponentData {
271
272
  components: readonly ComponentType[];
272
273
  }
273
274
 
@@ -603,7 +604,8 @@ export class BaseGuildEmoji extends Emoji {
603
604
  }
604
605
 
605
606
  export interface BaseGuildTextChannel
606
- extends TextBasedChannelFields<true>,
607
+ extends
608
+ TextBasedChannelFields<true>,
607
609
  PinnableChannelFields,
608
610
  WebhookChannelFields,
609
611
  BulkDeleteMethod,
@@ -630,7 +632,8 @@ export class BaseGuildTextChannel extends GuildChannel {
630
632
  }
631
633
 
632
634
  export interface BaseGuildVoiceChannel
633
- extends TextBasedChannelFields<true>,
635
+ extends
636
+ TextBasedChannelFields<true>,
634
637
  WebhookChannelFields,
635
638
  BulkDeleteMethod,
636
639
  SetRateLimitPerUserMethod,
@@ -1282,10 +1285,7 @@ export class PrimaryEntryPointCommandInteraction<
1282
1285
  }
1283
1286
 
1284
1287
  export interface DMChannel
1285
- extends TextBasedChannelFields<false, true>,
1286
- PinnableChannelFields,
1287
- MessageChannelFields,
1288
- SendMethod<false> {}
1288
+ extends TextBasedChannelFields<false, true>, PinnableChannelFields, MessageChannelFields, SendMethod<false> {}
1289
1289
  export class DMChannel extends BaseChannel {
1290
1290
  private constructor(client: Client<true>, data?: RawDMChannelData);
1291
1291
  public flags: Readonly<ChannelFlagsBitField>;
@@ -2235,7 +2235,12 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2235
2235
  ): InteractionCollector<MappedInteractionTypes<InGuild>[ComponentType]>;
2236
2236
  public delete(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
2237
2237
  public edit(
2238
- content: MessageEditOptions | MessagePayload | string,
2238
+ content:
2239
+ | FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
2240
+ | JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
2241
+ | MessageEditOptions
2242
+ | MessagePayload
2243
+ | string,
2239
2244
  ): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
2240
2245
  public equals(message: Message, rawData: unknown): boolean;
2241
2246
  public fetchReference(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
@@ -2260,26 +2265,6 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2260
2265
  public inGuild(): this is Message<true>;
2261
2266
  }
2262
2267
 
2263
- export class AttachmentBuilder {
2264
- public constructor(attachment: BufferResolvable | Stream, data?: AttachmentData);
2265
- public attachment: BufferResolvable | Stream;
2266
- public description: string | null;
2267
- public name: string | null;
2268
- public title: string | null;
2269
- public waveform: string | null;
2270
- public duration: number | null;
2271
- public get spoiler(): boolean;
2272
- public setDescription(description: string): this;
2273
- public setFile(attachment: BufferResolvable | Stream, name?: string): this;
2274
- public setName(name: string): this;
2275
- public setTitle(title: string): this;
2276
- public setWaveform(waveform: string): this;
2277
- public setDuration(duration: number): this;
2278
- public setSpoiler(spoiler?: boolean): this;
2279
- public toJSON(): unknown;
2280
- public static from(other: JSONEncodable<AttachmentPayload>): AttachmentBuilder;
2281
- }
2282
-
2283
2268
  export class Attachment {
2284
2269
  private constructor(data: APIAttachment);
2285
2270
  private readonly attachment: BufferResolvable | Stream;
@@ -2558,14 +2543,13 @@ export interface TextInputModalData extends BaseModalData<ComponentType.TextInpu
2558
2543
  value: string;
2559
2544
  }
2560
2545
 
2561
- export interface SelectMenuModalData<Cached extends CacheType = CacheType>
2562
- extends BaseModalData<
2563
- | ComponentType.ChannelSelect
2564
- | ComponentType.MentionableSelect
2565
- | ComponentType.RoleSelect
2566
- | ComponentType.StringSelect
2567
- | ComponentType.UserSelect
2568
- > {
2546
+ export interface SelectMenuModalData<Cached extends CacheType = CacheType> extends BaseModalData<
2547
+ | ComponentType.ChannelSelect
2548
+ | ComponentType.MentionableSelect
2549
+ | ComponentType.RoleSelect
2550
+ | ComponentType.StringSelect
2551
+ | ComponentType.UserSelect
2552
+ > {
2569
2553
  channels?: ReadonlyCollection<
2570
2554
  Snowflake,
2571
2555
  CacheTypeReducer<Cached, GuildBasedChannel, APIInteractionDataResolvedChannel>
@@ -2660,8 +2644,9 @@ export class ModalComponentResolver<Cached extends CacheType = CacheType> {
2660
2644
  public getUploadedFiles(customId: string, required?: boolean): ReadonlyCollection<Snowflake, Attachment> | null;
2661
2645
  }
2662
2646
 
2663
- export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
2664
- extends ModalSubmitInteraction<Cached> {
2647
+ export interface ModalMessageModalSubmitInteraction<
2648
+ Cached extends CacheType = CacheType,
2649
+ > extends ModalSubmitInteraction<Cached> {
2665
2650
  channelId: Snowflake;
2666
2651
  inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
2667
2652
  inGuild(): this is ModalMessageModalSubmitInteraction<'cached' | 'raw'>;
@@ -3514,7 +3499,8 @@ export interface PrivateThreadChannel extends ThreadChannel<false> {
3514
3499
  }
3515
3500
 
3516
3501
  export interface ThreadChannel<ThreadOnly extends boolean = boolean>
3517
- extends TextBasedChannelFields<true>,
3502
+ extends
3503
+ TextBasedChannelFields<true>,
3518
3504
  PinnableChannelFields,
3519
3505
  BulkDeleteMethod,
3520
3506
  SetRateLimitPerUserMethod,
@@ -4279,7 +4265,12 @@ export class ChannelManager extends CachedManager<Snowflake, Channel, ChannelRes
4279
4265
  private constructor(client: Client<true>, iterable: Iterable<RawChannelData>);
4280
4266
  public createMessage(
4281
4267
  channel: Exclude<TextBasedChannelResolvable, PartialGroupDMChannel>,
4282
- options: MessageCreateOptions | MessagePayload | string,
4268
+ options:
4269
+ | FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
4270
+ | JSONEncodable<RESTPostAPIChannelMessageJSONBody>
4271
+ | MessageCreateOptions
4272
+ | MessagePayload
4273
+ | string,
4283
4274
  ): Promise<OmitPartialGroupDMChannel<Message>>;
4284
4275
  public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<Channel | null>;
4285
4276
  }
@@ -4631,7 +4622,12 @@ export abstract class MessageManager<InGuild extends boolean = boolean> extends
4631
4622
  public delete(message: MessageResolvable): Promise<void>;
4632
4623
  public edit(
4633
4624
  message: MessageResolvable,
4634
- options: MessageEditOptions | MessagePayload | string,
4625
+ options:
4626
+ | FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
4627
+ | JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
4628
+ | MessageEditOptions
4629
+ | MessagePayload
4630
+ | string,
4635
4631
  ): Promise<Message<InGuild>>;
4636
4632
  public fetch(options: FetchMessageOptions | MessageResolvable): Promise<Message<InGuild>>;
4637
4633
  public fetch(options?: FetchMessagesOptions): Promise<Collection<Snowflake, Message<InGuild>>>;
@@ -4808,7 +4804,14 @@ export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, type
4808
4804
  export type Constructable<Entity> = abstract new (...args: any[]) => Entity;
4809
4805
 
4810
4806
  export interface SendMethod<InGuild extends boolean = boolean> {
4811
- send(options: MessageCreateOptions | MessagePayload | string): Promise<Message<InGuild>>;
4807
+ send(
4808
+ options:
4809
+ | FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
4810
+ | JSONEncodable<RESTPostAPIChannelMessageJSONBody>
4811
+ | MessageCreateOptions
4812
+ | MessagePayload
4813
+ | string,
4814
+ ): Promise<Message<InGuild>>;
4812
4815
  }
4813
4816
 
4814
4817
  export interface PinnableChannelFields {
@@ -5061,15 +5064,17 @@ export interface ApplicationCommandAutocompleteStringOptionData extends BaseAppl
5061
5064
  type: ApplicationCommandOptionType.String;
5062
5065
  }
5063
5066
 
5064
- export interface ApplicationCommandChoicesData<Type extends number | string = number | string>
5065
- extends BaseApplicationCommandOptionsData {
5067
+ export interface ApplicationCommandChoicesData<
5068
+ Type extends number | string = number | string,
5069
+ > extends BaseApplicationCommandOptionsData {
5066
5070
  autocomplete?: false;
5067
5071
  choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
5068
5072
  type: CommandOptionChoiceResolvableType;
5069
5073
  }
5070
5074
 
5071
- export interface ApplicationCommandChoicesOption<Type extends number | string = number | string>
5072
- extends BaseApplicationCommandOptionsData {
5075
+ export interface ApplicationCommandChoicesOption<
5076
+ Type extends number | string = number | string,
5077
+ > extends BaseApplicationCommandOptionsData {
5073
5078
  autocomplete?: false;
5074
5079
  choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
5075
5080
  type: CommandOptionChoiceResolvableType;
@@ -5252,13 +5257,15 @@ export interface AutoModerationTriggerMetadata {
5252
5257
  regexPatterns: readonly string[];
5253
5258
  }
5254
5259
 
5255
- export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction>
5256
- extends CollectorOptions<[Interaction, Collection<Snowflake, Interaction>]> {
5260
+ export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction> extends CollectorOptions<
5261
+ [Interaction, Collection<Snowflake, Interaction>]
5262
+ > {
5257
5263
  componentType?: ComponentType;
5258
5264
  }
5259
5265
 
5260
- export interface AwaitModalSubmitOptions
5261
- extends CollectorOptions<[ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]> {
5266
+ export interface AwaitModalSubmitOptions extends CollectorOptions<
5267
+ [ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]
5268
+ > {
5262
5269
  time: number;
5263
5270
  }
5264
5271
 
@@ -5631,8 +5638,9 @@ export interface BaseInteractionResolvedData<Cached extends CacheType = CacheTyp
5631
5638
  users?: ReadonlyCollection<Snowflake, User>;
5632
5639
  }
5633
5640
 
5634
- export interface CommandInteractionResolvedData<Cached extends CacheType = CacheType>
5635
- extends BaseInteractionResolvedData<Cached> {
5641
+ export interface CommandInteractionResolvedData<
5642
+ Cached extends CacheType = CacheType,
5643
+ > extends BaseInteractionResolvedData<Cached> {
5636
5644
  messages?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Message, APIMessage>>;
5637
5645
  }
5638
5646
 
@@ -6271,7 +6279,7 @@ export interface GuildEmojiEditOptions {
6271
6279
 
6272
6280
  export interface GuildStickerCreateOptions {
6273
6281
  description?: string | null;
6274
- file: AttachmentPayload | BufferResolvable | JSONEncodable<AttachmentBuilder> | Stream;
6282
+ file: AttachmentPayload | BufferResolvable | Stream;
6275
6283
  name: string;
6276
6284
  reason?: string;
6277
6285
  tags: string;
@@ -6618,8 +6626,9 @@ export type CollectedMessageInteraction<Cached extends CacheType = CacheType> =
6618
6626
  ModalSubmitInteraction
6619
6627
  >;
6620
6628
 
6621
- export interface MessageComponentCollectorOptions<Interaction extends CollectedMessageInteraction>
6622
- extends AwaitMessageComponentOptions<Interaction> {
6629
+ export interface MessageComponentCollectorOptions<
6630
+ Interaction extends CollectedMessageInteraction,
6631
+ > extends AwaitMessageComponentOptions<Interaction> {
6623
6632
  max?: number;
6624
6633
  maxComponents?: number;
6625
6634
  maxUsers?: number;
@@ -6658,25 +6667,24 @@ export interface MessageMentionOptions {
6658
6667
 
6659
6668
  export type MessageMentionTypes = 'everyone' | 'roles' | 'users';
6660
6669
 
6661
- export interface MessageSnapshot
6662
- extends Partialize<
6663
- Message,
6664
- null,
6665
- Exclude<
6666
- keyof Message,
6667
- | 'attachments'
6668
- | 'client'
6669
- | 'components'
6670
- | 'content'
6671
- | 'createdTimestamp'
6672
- | 'editedTimestamp'
6673
- | 'embeds'
6674
- | 'flags'
6675
- | 'mentions'
6676
- | 'stickers'
6677
- | 'type'
6678
- >
6679
- > {}
6670
+ export interface MessageSnapshot extends Partialize<
6671
+ Message,
6672
+ null,
6673
+ Exclude<
6674
+ keyof Message,
6675
+ | 'attachments'
6676
+ | 'client'
6677
+ | 'components'
6678
+ | 'content'
6679
+ | 'createdTimestamp'
6680
+ | 'editedTimestamp'
6681
+ | 'embeds'
6682
+ | 'flags'
6683
+ | 'mentions'
6684
+ | 'stickers'
6685
+ | 'type'
6686
+ >
6687
+ > {}
6680
6688
 
6681
6689
  export interface BaseMessageOptions {
6682
6690
  allowedMentions?: MessageMentionOptions;
@@ -6689,14 +6697,7 @@ export interface BaseMessageOptions {
6689
6697
  )[];
6690
6698
  content?: string;
6691
6699
  embeds?: readonly (APIEmbed | JSONEncodable<APIEmbed>)[];
6692
- files?: readonly (
6693
- | Attachment
6694
- | AttachmentBuilder
6695
- | AttachmentPayload
6696
- | BufferResolvable
6697
- | JSONEncodable<APIAttachment>
6698
- | Stream
6699
- )[];
6700
+ files?: readonly (Attachment | AttachmentPayload | BufferResolvable | FileBodyEncodable<APIAttachment> | Stream)[];
6700
6701
  }
6701
6702
 
6702
6703
  export interface MessageOptionsPoll {
@@ -6724,11 +6725,7 @@ export interface MessageOptionsStickers {
6724
6725
  }
6725
6726
 
6726
6727
  export interface BaseMessageCreateOptions
6727
- extends BaseMessageOptions,
6728
- MessageOptionsPoll,
6729
- MessageOptionsFlags,
6730
- MessageOptionsTTS,
6731
- MessageOptionsStickers {
6728
+ extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS, MessageOptionsStickers {
6732
6729
  enforceNonce?: boolean;
6733
6730
  nonce?: number | string;
6734
6731
  }
@@ -6738,16 +6735,10 @@ export interface MessageCreateOptions extends BaseMessageCreateOptions {
6738
6735
  }
6739
6736
 
6740
6737
  export interface GuildForumThreadMessageCreateOptions
6741
- extends BaseMessageOptions,
6742
- MessageOptionsFlags,
6743
- MessageOptionsStickers {}
6744
-
6745
- export interface MessageEditAttachmentData {
6746
- id: Snowflake;
6747
- }
6738
+ extends BaseMessageOptions, MessageOptionsFlags, MessageOptionsStickers {}
6748
6739
 
6749
6740
  export interface MessageEditOptions extends Omit<BaseMessageOptions, 'content'> {
6750
- attachments?: readonly (Attachment | MessageEditAttachmentData)[];
6741
+ attachments?: readonly (Attachment | JSONEncodable<APIAttachment>)[];
6751
6742
  content?: string | null;
6752
6743
  flags?:
6753
6744
  | BitFieldResolvable<
@@ -6943,18 +6934,20 @@ export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'las
6943
6934
 
6944
6935
  export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp' | 'pending'> {}
6945
6936
 
6946
- export interface PartialMessage<InGuild extends boolean = boolean>
6947
- extends Partialize<Message<InGuild>, 'pinned' | 'system' | 'tts' | 'type', 'author' | 'cleanContent' | 'content'> {}
6937
+ export interface PartialMessage<InGuild extends boolean = boolean> extends Partialize<
6938
+ Message<InGuild>,
6939
+ 'pinned' | 'system' | 'tts' | 'type',
6940
+ 'author' | 'cleanContent' | 'content'
6941
+ > {}
6948
6942
 
6949
6943
  export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> {}
6950
6944
 
6951
- export interface PartialPoll
6952
- extends Partialize<
6953
- Poll,
6954
- 'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
6955
- null,
6956
- 'answers' | 'message' | 'question'
6957
- > {
6945
+ export interface PartialPoll extends Partialize<
6946
+ Poll,
6947
+ 'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
6948
+ null,
6949
+ 'answers' | 'message' | 'question'
6950
+ > {
6958
6951
  // eslint-disable-next-line no-restricted-syntax
6959
6952
  answers: Collection<number, PartialPollAnswer>;
6960
6953
  message: PartialMessage;
@@ -6965,8 +6958,11 @@ export interface PartialPollAnswer extends Partialize<PollAnswer, 'emoji' | 'tex
6965
6958
  readonly poll: PartialPoll;
6966
6959
  }
6967
6960
 
6968
- export interface PartialGuildScheduledEvent
6969
- extends Partialize<GuildScheduledEvent, 'userCount', 'entityType' | 'name' | 'privacyLevel' | 'status'> {}
6961
+ export interface PartialGuildScheduledEvent extends Partialize<
6962
+ GuildScheduledEvent,
6963
+ 'userCount',
6964
+ 'entityType' | 'name' | 'privacyLevel' | 'status'
6965
+ > {}
6970
6966
 
6971
6967
  export interface PartialThreadMember extends Partialize<ThreadMember, 'flags' | 'joinedAt' | 'joinedTimestamp'> {}
6972
6968
 
@@ -7261,10 +7257,7 @@ export interface WebhookFetchMessageOptions {
7261
7257
  }
7262
7258
 
7263
7259
  export interface WebhookMessageCreateOptions
7264
- extends BaseMessageOptions,
7265
- MessageOptionsPoll,
7266
- MessageOptionsFlags,
7267
- MessageOptionsTTS {
7260
+ extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS {
7268
7261
  appliedTags?: readonly Snowflake[];
7269
7262
  avatarURL?: string;
7270
7263
  threadId?: Snowflake;
@@ -5,7 +5,7 @@ import { MessagePort, Worker } from 'node:worker_threads';
5
5
  import { ApplicationCommandOptionAllowedChannelType, MessageActionRowComponentBuilder } from '@discordjs/builders';
6
6
  import { Collection, ReadonlyCollection } from '@discordjs/collection';
7
7
  import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions, EmojiURLOptions } from '@discordjs/rest';
8
- import { Awaitable, JSONEncodable } from '@discordjs/util';
8
+ import { Awaitable, FileBodyEncodable, JSONEncodable } from '@discordjs/util';
9
9
  import { WebSocketManager, WebSocketManagerOptions } from '@discordjs/ws';
10
10
  import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
11
11
  import {
@@ -266,8 +266,9 @@ export type ActionRowComponentData = MessageActionRowComponentData;
266
266
 
267
267
  export type ActionRowComponent = MessageActionRowComponent;
268
268
 
269
- export interface ActionRowData<ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>>
270
- extends BaseComponentData {
269
+ export interface ActionRowData<
270
+ ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>,
271
+ > extends BaseComponentData {
271
272
  components: readonly ComponentType[];
272
273
  }
273
274
 
@@ -603,7 +604,8 @@ export class BaseGuildEmoji extends Emoji {
603
604
  }
604
605
 
605
606
  export interface BaseGuildTextChannel
606
- extends TextBasedChannelFields<true>,
607
+ extends
608
+ TextBasedChannelFields<true>,
607
609
  PinnableChannelFields,
608
610
  WebhookChannelFields,
609
611
  BulkDeleteMethod,
@@ -630,7 +632,8 @@ export class BaseGuildTextChannel extends GuildChannel {
630
632
  }
631
633
 
632
634
  export interface BaseGuildVoiceChannel
633
- extends TextBasedChannelFields<true>,
635
+ extends
636
+ TextBasedChannelFields<true>,
634
637
  WebhookChannelFields,
635
638
  BulkDeleteMethod,
636
639
  SetRateLimitPerUserMethod,
@@ -1282,10 +1285,7 @@ export class PrimaryEntryPointCommandInteraction<
1282
1285
  }
1283
1286
 
1284
1287
  export interface DMChannel
1285
- extends TextBasedChannelFields<false, true>,
1286
- PinnableChannelFields,
1287
- MessageChannelFields,
1288
- SendMethod<false> {}
1288
+ extends TextBasedChannelFields<false, true>, PinnableChannelFields, MessageChannelFields, SendMethod<false> {}
1289
1289
  export class DMChannel extends BaseChannel {
1290
1290
  private constructor(client: Client<true>, data?: RawDMChannelData);
1291
1291
  public flags: Readonly<ChannelFlagsBitField>;
@@ -2235,7 +2235,12 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2235
2235
  ): InteractionCollector<MappedInteractionTypes<InGuild>[ComponentType]>;
2236
2236
  public delete(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
2237
2237
  public edit(
2238
- content: MessageEditOptions | MessagePayload | string,
2238
+ content:
2239
+ | FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
2240
+ | JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
2241
+ | MessageEditOptions
2242
+ | MessagePayload
2243
+ | string,
2239
2244
  ): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
2240
2245
  public equals(message: Message, rawData: unknown): boolean;
2241
2246
  public fetchReference(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
@@ -2260,26 +2265,6 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2260
2265
  public inGuild(): this is Message<true>;
2261
2266
  }
2262
2267
 
2263
- export class AttachmentBuilder {
2264
- public constructor(attachment: BufferResolvable | Stream, data?: AttachmentData);
2265
- public attachment: BufferResolvable | Stream;
2266
- public description: string | null;
2267
- public name: string | null;
2268
- public title: string | null;
2269
- public waveform: string | null;
2270
- public duration: number | null;
2271
- public get spoiler(): boolean;
2272
- public setDescription(description: string): this;
2273
- public setFile(attachment: BufferResolvable | Stream, name?: string): this;
2274
- public setName(name: string): this;
2275
- public setTitle(title: string): this;
2276
- public setWaveform(waveform: string): this;
2277
- public setDuration(duration: number): this;
2278
- public setSpoiler(spoiler?: boolean): this;
2279
- public toJSON(): unknown;
2280
- public static from(other: JSONEncodable<AttachmentPayload>): AttachmentBuilder;
2281
- }
2282
-
2283
2268
  export class Attachment {
2284
2269
  private constructor(data: APIAttachment);
2285
2270
  private readonly attachment: BufferResolvable | Stream;
@@ -2558,14 +2543,13 @@ export interface TextInputModalData extends BaseModalData<ComponentType.TextInpu
2558
2543
  value: string;
2559
2544
  }
2560
2545
 
2561
- export interface SelectMenuModalData<Cached extends CacheType = CacheType>
2562
- extends BaseModalData<
2563
- | ComponentType.ChannelSelect
2564
- | ComponentType.MentionableSelect
2565
- | ComponentType.RoleSelect
2566
- | ComponentType.StringSelect
2567
- | ComponentType.UserSelect
2568
- > {
2546
+ export interface SelectMenuModalData<Cached extends CacheType = CacheType> extends BaseModalData<
2547
+ | ComponentType.ChannelSelect
2548
+ | ComponentType.MentionableSelect
2549
+ | ComponentType.RoleSelect
2550
+ | ComponentType.StringSelect
2551
+ | ComponentType.UserSelect
2552
+ > {
2569
2553
  channels?: ReadonlyCollection<
2570
2554
  Snowflake,
2571
2555
  CacheTypeReducer<Cached, GuildBasedChannel, APIInteractionDataResolvedChannel>
@@ -2660,8 +2644,9 @@ export class ModalComponentResolver<Cached extends CacheType = CacheType> {
2660
2644
  public getUploadedFiles(customId: string, required?: boolean): ReadonlyCollection<Snowflake, Attachment> | null;
2661
2645
  }
2662
2646
 
2663
- export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
2664
- extends ModalSubmitInteraction<Cached> {
2647
+ export interface ModalMessageModalSubmitInteraction<
2648
+ Cached extends CacheType = CacheType,
2649
+ > extends ModalSubmitInteraction<Cached> {
2665
2650
  channelId: Snowflake;
2666
2651
  inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
2667
2652
  inGuild(): this is ModalMessageModalSubmitInteraction<'cached' | 'raw'>;
@@ -3514,7 +3499,8 @@ export interface PrivateThreadChannel extends ThreadChannel<false> {
3514
3499
  }
3515
3500
 
3516
3501
  export interface ThreadChannel<ThreadOnly extends boolean = boolean>
3517
- extends TextBasedChannelFields<true>,
3502
+ extends
3503
+ TextBasedChannelFields<true>,
3518
3504
  PinnableChannelFields,
3519
3505
  BulkDeleteMethod,
3520
3506
  SetRateLimitPerUserMethod,
@@ -4279,7 +4265,12 @@ export class ChannelManager extends CachedManager<Snowflake, Channel, ChannelRes
4279
4265
  private constructor(client: Client<true>, iterable: Iterable<RawChannelData>);
4280
4266
  public createMessage(
4281
4267
  channel: Exclude<TextBasedChannelResolvable, PartialGroupDMChannel>,
4282
- options: MessageCreateOptions | MessagePayload | string,
4268
+ options:
4269
+ | FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
4270
+ | JSONEncodable<RESTPostAPIChannelMessageJSONBody>
4271
+ | MessageCreateOptions
4272
+ | MessagePayload
4273
+ | string,
4283
4274
  ): Promise<OmitPartialGroupDMChannel<Message>>;
4284
4275
  public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<Channel | null>;
4285
4276
  }
@@ -4631,7 +4622,12 @@ export abstract class MessageManager<InGuild extends boolean = boolean> extends
4631
4622
  public delete(message: MessageResolvable): Promise<void>;
4632
4623
  public edit(
4633
4624
  message: MessageResolvable,
4634
- options: MessageEditOptions | MessagePayload | string,
4625
+ options:
4626
+ | FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
4627
+ | JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
4628
+ | MessageEditOptions
4629
+ | MessagePayload
4630
+ | string,
4635
4631
  ): Promise<Message<InGuild>>;
4636
4632
  public fetch(options: FetchMessageOptions | MessageResolvable): Promise<Message<InGuild>>;
4637
4633
  public fetch(options?: FetchMessagesOptions): Promise<Collection<Snowflake, Message<InGuild>>>;
@@ -4808,7 +4804,14 @@ export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, type
4808
4804
  export type Constructable<Entity> = abstract new (...args: any[]) => Entity;
4809
4805
 
4810
4806
  export interface SendMethod<InGuild extends boolean = boolean> {
4811
- send(options: MessageCreateOptions | MessagePayload | string): Promise<Message<InGuild>>;
4807
+ send(
4808
+ options:
4809
+ | FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
4810
+ | JSONEncodable<RESTPostAPIChannelMessageJSONBody>
4811
+ | MessageCreateOptions
4812
+ | MessagePayload
4813
+ | string,
4814
+ ): Promise<Message<InGuild>>;
4812
4815
  }
4813
4816
 
4814
4817
  export interface PinnableChannelFields {
@@ -5061,15 +5064,17 @@ export interface ApplicationCommandAutocompleteStringOptionData extends BaseAppl
5061
5064
  type: ApplicationCommandOptionType.String;
5062
5065
  }
5063
5066
 
5064
- export interface ApplicationCommandChoicesData<Type extends number | string = number | string>
5065
- extends BaseApplicationCommandOptionsData {
5067
+ export interface ApplicationCommandChoicesData<
5068
+ Type extends number | string = number | string,
5069
+ > extends BaseApplicationCommandOptionsData {
5066
5070
  autocomplete?: false;
5067
5071
  choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
5068
5072
  type: CommandOptionChoiceResolvableType;
5069
5073
  }
5070
5074
 
5071
- export interface ApplicationCommandChoicesOption<Type extends number | string = number | string>
5072
- extends BaseApplicationCommandOptionsData {
5075
+ export interface ApplicationCommandChoicesOption<
5076
+ Type extends number | string = number | string,
5077
+ > extends BaseApplicationCommandOptionsData {
5073
5078
  autocomplete?: false;
5074
5079
  choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
5075
5080
  type: CommandOptionChoiceResolvableType;
@@ -5252,13 +5257,15 @@ export interface AutoModerationTriggerMetadata {
5252
5257
  regexPatterns: readonly string[];
5253
5258
  }
5254
5259
 
5255
- export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction>
5256
- extends CollectorOptions<[Interaction, Collection<Snowflake, Interaction>]> {
5260
+ export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction> extends CollectorOptions<
5261
+ [Interaction, Collection<Snowflake, Interaction>]
5262
+ > {
5257
5263
  componentType?: ComponentType;
5258
5264
  }
5259
5265
 
5260
- export interface AwaitModalSubmitOptions
5261
- extends CollectorOptions<[ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]> {
5266
+ export interface AwaitModalSubmitOptions extends CollectorOptions<
5267
+ [ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]
5268
+ > {
5262
5269
  time: number;
5263
5270
  }
5264
5271
 
@@ -5631,8 +5638,9 @@ export interface BaseInteractionResolvedData<Cached extends CacheType = CacheTyp
5631
5638
  users?: ReadonlyCollection<Snowflake, User>;
5632
5639
  }
5633
5640
 
5634
- export interface CommandInteractionResolvedData<Cached extends CacheType = CacheType>
5635
- extends BaseInteractionResolvedData<Cached> {
5641
+ export interface CommandInteractionResolvedData<
5642
+ Cached extends CacheType = CacheType,
5643
+ > extends BaseInteractionResolvedData<Cached> {
5636
5644
  messages?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Message, APIMessage>>;
5637
5645
  }
5638
5646
 
@@ -6271,7 +6279,7 @@ export interface GuildEmojiEditOptions {
6271
6279
 
6272
6280
  export interface GuildStickerCreateOptions {
6273
6281
  description?: string | null;
6274
- file: AttachmentPayload | BufferResolvable | JSONEncodable<AttachmentBuilder> | Stream;
6282
+ file: AttachmentPayload | BufferResolvable | Stream;
6275
6283
  name: string;
6276
6284
  reason?: string;
6277
6285
  tags: string;
@@ -6618,8 +6626,9 @@ export type CollectedMessageInteraction<Cached extends CacheType = CacheType> =
6618
6626
  ModalSubmitInteraction
6619
6627
  >;
6620
6628
 
6621
- export interface MessageComponentCollectorOptions<Interaction extends CollectedMessageInteraction>
6622
- extends AwaitMessageComponentOptions<Interaction> {
6629
+ export interface MessageComponentCollectorOptions<
6630
+ Interaction extends CollectedMessageInteraction,
6631
+ > extends AwaitMessageComponentOptions<Interaction> {
6623
6632
  max?: number;
6624
6633
  maxComponents?: number;
6625
6634
  maxUsers?: number;
@@ -6658,25 +6667,24 @@ export interface MessageMentionOptions {
6658
6667
 
6659
6668
  export type MessageMentionTypes = 'everyone' | 'roles' | 'users';
6660
6669
 
6661
- export interface MessageSnapshot
6662
- extends Partialize<
6663
- Message,
6664
- null,
6665
- Exclude<
6666
- keyof Message,
6667
- | 'attachments'
6668
- | 'client'
6669
- | 'components'
6670
- | 'content'
6671
- | 'createdTimestamp'
6672
- | 'editedTimestamp'
6673
- | 'embeds'
6674
- | 'flags'
6675
- | 'mentions'
6676
- | 'stickers'
6677
- | 'type'
6678
- >
6679
- > {}
6670
+ export interface MessageSnapshot extends Partialize<
6671
+ Message,
6672
+ null,
6673
+ Exclude<
6674
+ keyof Message,
6675
+ | 'attachments'
6676
+ | 'client'
6677
+ | 'components'
6678
+ | 'content'
6679
+ | 'createdTimestamp'
6680
+ | 'editedTimestamp'
6681
+ | 'embeds'
6682
+ | 'flags'
6683
+ | 'mentions'
6684
+ | 'stickers'
6685
+ | 'type'
6686
+ >
6687
+ > {}
6680
6688
 
6681
6689
  export interface BaseMessageOptions {
6682
6690
  allowedMentions?: MessageMentionOptions;
@@ -6689,14 +6697,7 @@ export interface BaseMessageOptions {
6689
6697
  )[];
6690
6698
  content?: string;
6691
6699
  embeds?: readonly (APIEmbed | JSONEncodable<APIEmbed>)[];
6692
- files?: readonly (
6693
- | Attachment
6694
- | AttachmentBuilder
6695
- | AttachmentPayload
6696
- | BufferResolvable
6697
- | JSONEncodable<APIAttachment>
6698
- | Stream
6699
- )[];
6700
+ files?: readonly (Attachment | AttachmentPayload | BufferResolvable | FileBodyEncodable<APIAttachment> | Stream)[];
6700
6701
  }
6701
6702
 
6702
6703
  export interface MessageOptionsPoll {
@@ -6724,11 +6725,7 @@ export interface MessageOptionsStickers {
6724
6725
  }
6725
6726
 
6726
6727
  export interface BaseMessageCreateOptions
6727
- extends BaseMessageOptions,
6728
- MessageOptionsPoll,
6729
- MessageOptionsFlags,
6730
- MessageOptionsTTS,
6731
- MessageOptionsStickers {
6728
+ extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS, MessageOptionsStickers {
6732
6729
  enforceNonce?: boolean;
6733
6730
  nonce?: number | string;
6734
6731
  }
@@ -6738,16 +6735,10 @@ export interface MessageCreateOptions extends BaseMessageCreateOptions {
6738
6735
  }
6739
6736
 
6740
6737
  export interface GuildForumThreadMessageCreateOptions
6741
- extends BaseMessageOptions,
6742
- MessageOptionsFlags,
6743
- MessageOptionsStickers {}
6744
-
6745
- export interface MessageEditAttachmentData {
6746
- id: Snowflake;
6747
- }
6738
+ extends BaseMessageOptions, MessageOptionsFlags, MessageOptionsStickers {}
6748
6739
 
6749
6740
  export interface MessageEditOptions extends Omit<BaseMessageOptions, 'content'> {
6750
- attachments?: readonly (Attachment | MessageEditAttachmentData)[];
6741
+ attachments?: readonly (Attachment | JSONEncodable<APIAttachment>)[];
6751
6742
  content?: string | null;
6752
6743
  flags?:
6753
6744
  | BitFieldResolvable<
@@ -6943,18 +6934,20 @@ export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'las
6943
6934
 
6944
6935
  export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp' | 'pending'> {}
6945
6936
 
6946
- export interface PartialMessage<InGuild extends boolean = boolean>
6947
- extends Partialize<Message<InGuild>, 'pinned' | 'system' | 'tts' | 'type', 'author' | 'cleanContent' | 'content'> {}
6937
+ export interface PartialMessage<InGuild extends boolean = boolean> extends Partialize<
6938
+ Message<InGuild>,
6939
+ 'pinned' | 'system' | 'tts' | 'type',
6940
+ 'author' | 'cleanContent' | 'content'
6941
+ > {}
6948
6942
 
6949
6943
  export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> {}
6950
6944
 
6951
- export interface PartialPoll
6952
- extends Partialize<
6953
- Poll,
6954
- 'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
6955
- null,
6956
- 'answers' | 'message' | 'question'
6957
- > {
6945
+ export interface PartialPoll extends Partialize<
6946
+ Poll,
6947
+ 'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
6948
+ null,
6949
+ 'answers' | 'message' | 'question'
6950
+ > {
6958
6951
  // eslint-disable-next-line no-restricted-syntax
6959
6952
  answers: Collection<number, PartialPollAnswer>;
6960
6953
  message: PartialMessage;
@@ -6965,8 +6958,11 @@ export interface PartialPollAnswer extends Partialize<PollAnswer, 'emoji' | 'tex
6965
6958
  readonly poll: PartialPoll;
6966
6959
  }
6967
6960
 
6968
- export interface PartialGuildScheduledEvent
6969
- extends Partialize<GuildScheduledEvent, 'userCount', 'entityType' | 'name' | 'privacyLevel' | 'status'> {}
6961
+ export interface PartialGuildScheduledEvent extends Partialize<
6962
+ GuildScheduledEvent,
6963
+ 'userCount',
6964
+ 'entityType' | 'name' | 'privacyLevel' | 'status'
6965
+ > {}
6970
6966
 
6971
6967
  export interface PartialThreadMember extends Partialize<ThreadMember, 'flags' | 'joinedAt' | 'joinedTimestamp'> {}
6972
6968
 
@@ -7261,10 +7257,7 @@ export interface WebhookFetchMessageOptions {
7261
7257
  }
7262
7258
 
7263
7259
  export interface WebhookMessageCreateOptions
7264
- extends BaseMessageOptions,
7265
- MessageOptionsPoll,
7266
- MessageOptionsFlags,
7267
- MessageOptionsTTS {
7260
+ extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS {
7268
7261
  appliedTags?: readonly Snowflake[];
7269
7262
  avatarURL?: string;
7270
7263
  threadId?: Snowflake;
@@ -1,185 +0,0 @@
1
- 'use strict';
2
-
3
- const { basename, flatten } = require('../util/Util.js');
4
-
5
- /**
6
- * Represents an attachment builder
7
- */
8
- class AttachmentBuilder {
9
- /**
10
- * @param {BufferResolvable|Stream} attachment The file
11
- * @param {AttachmentData} [data] Extra data
12
- */
13
- constructor(attachment, data = {}) {
14
- /**
15
- * The file associated with this attachment.
16
- *
17
- * @type {BufferResolvable|Stream}
18
- */
19
- this.attachment = attachment;
20
-
21
- /**
22
- * The name of this attachment
23
- *
24
- * @type {?string}
25
- */
26
- this.name = data.name;
27
-
28
- /**
29
- * The description of the attachment
30
- *
31
- * @type {?string}
32
- */
33
- this.description = data.description;
34
-
35
- /**
36
- * The title of the attachment
37
- *
38
- * @type {?string}
39
- */
40
- this.title = data.title;
41
-
42
- /**
43
- * The base64 encoded byte array representing a sampled waveform
44
- * <info>This is only for voice message attachments.</info>
45
- *
46
- * @type {?string}
47
- */
48
- this.waveform = data.waveform;
49
-
50
- /**
51
- * The duration of the attachment in seconds
52
- * <info>This is only for voice message attachments.</info>
53
- *
54
- * @type {?number}
55
- */
56
- this.duration = data.duration;
57
- }
58
-
59
- /**
60
- * Sets the description of this attachment.
61
- *
62
- * @param {string} description The description of the file
63
- * @returns {AttachmentBuilder} This attachment
64
- */
65
- setDescription(description) {
66
- this.description = description;
67
- return this;
68
- }
69
-
70
- /**
71
- * Sets the file of this attachment.
72
- *
73
- * @param {BufferResolvable|Stream} attachment The file
74
- * @returns {AttachmentBuilder} This attachment
75
- */
76
- setFile(attachment) {
77
- this.attachment = attachment;
78
- return this;
79
- }
80
-
81
- /**
82
- * Sets the name of this attachment.
83
- *
84
- * @param {string} name The name of the file
85
- * @returns {AttachmentBuilder} This attachment
86
- */
87
- setName(name) {
88
- this.name = name;
89
- return this;
90
- }
91
-
92
- /**
93
- * Sets the title of this attachment.
94
- *
95
- * @param {string} title The title of the file
96
- * @returns {AttachmentBuilder} This attachment
97
- */
98
- setTitle(title) {
99
- this.title = title;
100
- return this;
101
- }
102
-
103
- /**
104
- * Sets the waveform of this attachment.
105
- * <info>This is only for voice message attachments.</info>
106
- *
107
- * @param {string} waveform The base64 encoded byte array representing a sampled waveform
108
- * @returns {AttachmentBuilder} This attachment
109
- */
110
- setWaveform(waveform) {
111
- this.waveform = waveform;
112
- return this;
113
- }
114
-
115
- /**
116
- * Sets the duration of this attachment.
117
- * <info>This is only for voice message attachments.</info>
118
- *
119
- * @param {number} duration The duration of the attachment in seconds
120
- * @returns {AttachmentBuilder} This attachment
121
- */
122
- setDuration(duration) {
123
- this.duration = duration;
124
- return this;
125
- }
126
-
127
- /**
128
- * Sets whether this attachment is a spoiler
129
- *
130
- * @param {boolean} [spoiler=true] Whether the attachment should be marked as a spoiler
131
- * @returns {AttachmentBuilder} This attachment
132
- */
133
- setSpoiler(spoiler = true) {
134
- if (spoiler === this.spoiler) return this;
135
-
136
- if (!spoiler) {
137
- while (this.spoiler) {
138
- this.name = this.name.slice('SPOILER_'.length);
139
- }
140
-
141
- return this;
142
- }
143
-
144
- this.name = `SPOILER_${this.name}`;
145
- return this;
146
- }
147
-
148
- /**
149
- * Whether or not this attachment has been marked as a spoiler
150
- *
151
- * @type {boolean}
152
- * @readonly
153
- */
154
- get spoiler() {
155
- return basename(this.name).startsWith('SPOILER_');
156
- }
157
-
158
- toJSON() {
159
- return flatten(this);
160
- }
161
-
162
- /**
163
- * Makes a new builder instance from a preexisting attachment structure.
164
- *
165
- * @param {AttachmentBuilder|Attachment|AttachmentPayload} other The builder to construct a new instance from
166
- * @returns {AttachmentBuilder}
167
- */
168
- static from(other) {
169
- return new AttachmentBuilder(other.attachment, {
170
- name: other.name,
171
- description: other.description,
172
- });
173
- }
174
- }
175
-
176
- exports.AttachmentBuilder = AttachmentBuilder;
177
-
178
- /**
179
- * @typedef {Object} AttachmentData
180
- * @property {string} [name] The name of the attachment
181
- * @property {string} [description] The description of the attachment
182
- * @property {string} [title] The title of the attachment
183
- * @property {string} [waveform] The base64 encoded byte array representing a sampled waveform (for voice message attachments)
184
- * @property {number} [duration] The duration of the attachment in seconds (for voice message attachments)
185
- */