From c63bde9479359a863be4ffa4916d683a88eb46f1 Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Mon, 19 Aug 2024 17:30:47 +0200 Subject: [PATCH] feat(Attachment): add `title` (#10423) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/discord.js/src/structures/Attachment.js | 11 +++++++++++ packages/discord.js/typings/index.d.ts | 1 + 2 files changed, 12 insertions(+) diff --git a/packages/discord.js/src/structures/Attachment.js b/packages/discord.js/src/structures/Attachment.js index a7d5841f97eb..e175e5b60751 100644 --- a/packages/discord.js/src/structures/Attachment.js +++ b/packages/discord.js/src/structures/Attachment.js @@ -133,6 +133,17 @@ class Attachment { } else { this.flags ??= new AttachmentFlagsBitField().freeze(); } + + if ('title' in data) { + /** + * The title of this attachment + * This will only be available if the attachment name contains special characters. + * @type {?string} + */ + this.title = data.title; + } else { + this.title ??= null; + } } /** diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 1b50d8f606b5..a82ded63b5f8 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2187,6 +2187,7 @@ export class Attachment { public proxyURL: string; public size: number; public get spoiler(): boolean; + public title: string | null; public url: string; public waveform: string | null; public width: number | null;