From bddd66d1f9dc1335b83bc5317dcde38ded9c6b1f Mon Sep 17 00:00:00 2001 From: Shubham Parihar Date: Thu, 3 Jun 2021 20:44:39 +0530 Subject: [PATCH 1/4] fix(Message): update typings and docs related to #edit --- src/structures/Message.js | 4 ++-- typings/index.d.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 8058009975be..000886ec5e1a 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -486,8 +486,8 @@ class Message extends Base { /** * Edits the content of the message. - * @param {string|APIMessage} [content] The new content for the message - * @param {MessageEditOptions|MessageEmbed} [options] The options to provide + * @param {string|APIMessage|null} [content] The new content for the message + * @param {MessageEditOptions|MessageEmbed|MessageAttachment|MessageAttachment[]} [options] The options to provide * @returns {Promise} * @example * // Update the content of a message diff --git a/typings/index.d.ts b/typings/index.d.ts index 7f781319c8e3..ce9d05b83cda 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1184,8 +1184,13 @@ declare module 'discord.js' { options?: ReactionCollectorOptions, ): ReactionCollector; public delete(): Promise; - public edit(content: string | null | MessageEditOptions | MessageEmbed | APIMessage): Promise; - public edit(content: string | null, options: MessageEditOptions | MessageEmbed): Promise; + public edit( + content: string | null | MessageEditOptions | MessageEmbed | APIMessage | MessageAttachment | MessageAttachment[], + ): Promise; + public edit( + content: string | null, + options: MessageEditOptions | MessageEmbed | MessageAttachment | MessageAttachment[], + ): Promise; public equals(message: Message, rawData: unknown): boolean; public fetchReference(): Promise; public fetchWebhook(): Promise; @@ -3195,7 +3200,7 @@ declare module 'discord.js' { interface MessageEditOptions { attachments?: MessageAttachment[]; - content?: string; + content?: string | null; embed?: MessageEmbed | MessageEmbedOptions | null; code?: string | boolean; files?: (FileOptions | BufferResolvable | Stream | MessageAttachment)[]; From 775af9135adc04e0d236a8b53936a1a639f47d22 Mon Sep 17 00:00:00 2001 From: Shubham Parihar Date: Thu, 3 Jun 2021 20:58:42 +0530 Subject: [PATCH 2/4] docs(MessageEditOptions): #content can be null --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 000886ec5e1a..bb820cc9e06f 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -474,7 +474,7 @@ class Message extends Base { /** * Options that can be passed into {@link Message#edit}. * @typedef {Object} MessageEditOptions - * @property {string} [content] Content to be edited + * @property {string|null} [content] Content to be edited * @property {MessageEmbed|Object} [embed] An embed to be added/edited * @property {string|boolean} [code] Language for optional codeblock formatting to apply * @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content From f5ff348fd790587aeebc05126b4dc94c5f66ec06 Mon Sep 17 00:00:00 2001 From: Shubham Parihar Date: Thu, 3 Jun 2021 21:19:32 +0530 Subject: [PATCH 3/4] docs(MessageEditOptions): use ? instead of null for content Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index bb820cc9e06f..a9f8d464286f 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -474,7 +474,7 @@ class Message extends Base { /** * Options that can be passed into {@link Message#edit}. * @typedef {Object} MessageEditOptions - * @property {string|null} [content] Content to be edited + * @property {?string} [content] Content to be edited * @property {MessageEmbed|Object} [embed] An embed to be added/edited * @property {string|boolean} [code] Language for optional codeblock formatting to apply * @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content From 147b99111ef407701eada76e7e6a10e0c707321a Mon Sep 17 00:00:00 2001 From: Shubham Parihar Date: Thu, 3 Jun 2021 21:23:17 +0530 Subject: [PATCH 4/4] docs(Message#edit): use ? instead of explicit null for content param Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index a9f8d464286f..382a3f04a062 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -486,7 +486,7 @@ class Message extends Base { /** * Edits the content of the message. - * @param {string|APIMessage|null} [content] The new content for the message + * @param {?string|APIMessage} [content] The new content for the message * @param {MessageEditOptions|MessageEmbed|MessageAttachment|MessageAttachment[]} [options] The options to provide * @returns {Promise} * @example