Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Message): update typings and docs related to #edit #5745

Merged
merged 4 commits into from Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/structures/Message.js
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
Expand Up @@ -1184,8 +1184,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 @@ -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)[];
Expand Down