diff --git a/src/structures/APIMessage.js b/src/structures/APIMessage.js index 01695b061..a0dcf9f52 100644 --- a/src/structures/APIMessage.js +++ b/src/structures/APIMessage.js @@ -196,6 +196,7 @@ class APIMessage { typeof content === 'undefined' && typeof message_reference === 'undefined' ? undefined : allowedMentions, flags, message_reference, + attachments: this.options.attachments, }; return this; } diff --git a/src/structures/Message.js b/src/structures/Message.js index d07f2be88..186372f57 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -478,6 +478,7 @@ class Message extends Base { * @property {string|boolean} [code] Language for optional codeblock formatting to apply * @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content * @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be edited. + * @property {MessageAttachment[]} [attachments] The new attachments of the message (can only be removed, not added) */ /** @@ -656,6 +657,14 @@ class Message extends Base { return this.edit({ flags }); } + /** + * Removes the attachments from this message. + * @returns {Promise} + */ + removeAttachments() { + return this.edit({ attachments: [] }); + } + /** * Used mainly internally. Whether two messages are identical in properties. If you want to compare messages * without checking all the properties, use `message.id === message2.id`, which is much more efficient. This diff --git a/typings/index.d.ts b/typings/index.d.ts index 77fbcddff..6ab43f7d8 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1138,6 +1138,7 @@ declare module 'discord.js' { public fetch(force?: boolean): Promise; public pin(options?: { reason?: string }): Promise; public react(emoji: EmojiIdentifierResolvable): Promise; + public removeAttachments(): Promise; public reply( content: APIMessageContentResolvable | (MessageOptions & { split?: false }) | MessageAdditions, ): Promise; @@ -3099,6 +3100,7 @@ declare module 'discord.js' { code?: string | boolean; flags?: BitFieldResolvable; allowedMentions?: MessageMentionOptions; + attachments?: MessageAttachment[]; } interface MessageEmbedAuthor {