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;