Skip to content

Commit

Permalink
fix(Message): update typings and docs related to #edit (#5745)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan <[email protected]>
  • Loading branch information
iShibi and vaporoxx authored Jun 3, 2021
1 parent ff4d6dd commit a2f0c11
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Message>}
* @example
* // Update the content of a message
Expand Down
11 changes: 8 additions & 3 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1186,8 +1186,13 @@ declare module 'discord.js' {
options?: ReactionCollectorOptions,
): ReactionCollector;
public delete(): Promise<Message>;
public edit(content: string | null | MessageEditOptions | MessageEmbed | APIMessage): Promise<Message>;
public edit(content: string | null, options: MessageEditOptions | MessageEmbed): Promise<Message>;
public edit(
content: string | null | MessageEditOptions | MessageEmbed | APIMessage | MessageAttachment | MessageAttachment[],
): Promise<Message>;
public edit(
content: string | null,
options: MessageEditOptions | MessageEmbed | MessageAttachment | MessageAttachment[],
): Promise<Message>;
public equals(message: Message, rawData: unknown): boolean;
public fetchReference(): Promise<Message>;
public fetchWebhook(): Promise<Webhook>;
Expand Down Expand Up @@ -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)[];
Expand Down

0 comments on commit a2f0c11

Please sign in to comment.