Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
types(MessageEditOptions): Correct attachments type (#9874)
types(MessageEditOptions): fix `attachments` type

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
Jiralite and kodiakhq[bot] committed Oct 9, 2023
1 parent ec47e72 commit 2aa3250
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions packages/discord.js/src/managers/MessageManager.js
Expand Up @@ -152,11 +152,17 @@ class MessageManager extends CachedManager {
* @returns {?Snowflake}
*/

/**
* Data used to reference an attachment.
* @typedef {Object} MessageEditAttachmentData
* @property {Snowflake} id The id of the attachment
*/

/**
* Options that can be passed to edit a message.
* @typedef {BaseMessageOptions} MessageEditOptions
* @property {AttachmentPayload[]} [attachments] An array of attachments to keep,
* all attachments will be kept if omitted
* @property {Array<Attachment|MessageEditAttachmentData>} [attachments] An array of attachments to keep.
* All attachments will be kept if omitted
* @property {MessageFlags} [flags] Which flags to set for the message
* <info>Only the {@link MessageFlags.SuppressEmbeds} flag can be modified.</info>
*/
Expand Down
6 changes: 5 additions & 1 deletion packages/discord.js/typings/index.d.ts
Expand Up @@ -6003,9 +6003,13 @@ export interface MessageCreateOptions extends BaseMessageOptions {
export type GuildForumThreadMessageCreateOptions = BaseMessageOptions &
Pick<MessageCreateOptions, 'flags' | 'stickers'>;

export interface MessageEditAttachmentData {
id: Snowflake;
}

export interface MessageEditOptions extends Omit<BaseMessageOptions, 'content'> {
content?: string | null;
attachments?: JSONEncodable<AttachmentPayload>[];
attachments?: (Attachment | MessageEditAttachmentData)[];
flags?: BitFieldResolvable<Extract<MessageFlagsString, 'SuppressEmbeds'>, MessageFlags.SuppressEmbeds>;
}

Expand Down

0 comments on commit 2aa3250

Please sign in to comment.