From 2aa325058464741d57114b538ce358ea4de3bcd2 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Mon, 9 Oct 2023 09:18:41 +0200 Subject: [PATCH] types(MessageEditOptions): Correct `attachments` type (#9874) types(MessageEditOptions): fix `attachments` type Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/discord.js/src/managers/MessageManager.js | 10 ++++++++-- packages/discord.js/typings/index.d.ts | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/discord.js/src/managers/MessageManager.js b/packages/discord.js/src/managers/MessageManager.js index 6fb95eb66..d428324e2 100644 --- a/packages/discord.js/src/managers/MessageManager.js +++ b/packages/discord.js/src/managers/MessageManager.js @@ -152,11 +152,17 @@ class MessageManager extends CachedManager { * @returns {?Snowflake} */ + /** + * Data used to reference an attachment. + * @typedef {Object} MessageEditAttachmentData + * @property {Snowflake} id The id of the attachment + */ + /** * Options that can be passed to edit a message. * @typedef {BaseMessageOptions} MessageEditOptions - * @property {AttachmentPayload[]} [attachments] An array of attachments to keep, - * all attachments will be kept if omitted + * @property {Array} [attachments] An array of attachments to keep. + * All attachments will be kept if omitted * @property {MessageFlags} [flags] Which flags to set for the message * Only the {@link MessageFlags.SuppressEmbeds} flag can be modified. */ diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 08305031c..04a60dfb7 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -6003,9 +6003,13 @@ export interface MessageCreateOptions extends BaseMessageOptions { export type GuildForumThreadMessageCreateOptions = BaseMessageOptions & Pick; +export interface MessageEditAttachmentData { + id: Snowflake; +} + export interface MessageEditOptions extends Omit { content?: string | null; - attachments?: JSONEncodable[]; + attachments?: (Attachment | MessageEditAttachmentData)[]; flags?: BitFieldResolvable, MessageFlags.SuppressEmbeds>; }