From a2f0c11474826bfd5b770d2a6990b6bd41c89451 Mon Sep 17 00:00:00 2001 From: Shubham Parihar Date: Thu, 3 Jun 2021 23:48:13 +0530 Subject: [PATCH] fix(Message): update typings and docs related to #edit (#5745) Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> --- src/structures/Message.js | 6 +++--- typings/index.d.ts | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 8058009975be..382a3f04a062 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} [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 @@ -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} [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 c0b27efec43f..e71150c4b5ad 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1186,8 +1186,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; @@ -3208,7 +3213,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)[];