mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
feat(MessageAttachment): description (alt text) support (#6871)
Co-authored-by: D Trombett <maxtromb.dt@gmail.com>
This commit is contained in:
@@ -21,6 +21,16 @@ class MessageAttachment {
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the description of this attachment.
|
||||
* @param {string} description The description of the file
|
||||
* @returns {MessageAttachment} This attachment
|
||||
*/
|
||||
setDescription(description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file of this attachment.
|
||||
* @param {BufferResolvable|Stream} attachment The file
|
||||
@@ -122,6 +132,16 @@ class MessageAttachment {
|
||||
this.contentType ??= null;
|
||||
}
|
||||
|
||||
if ('description' in data) {
|
||||
/**
|
||||
* The description (alt text) of this attachment
|
||||
* @type {?string}
|
||||
*/
|
||||
this.description = data.description;
|
||||
} else {
|
||||
this.description ??= null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this attachment is ephemeral
|
||||
* @type {boolean}
|
||||
|
||||
Reference in New Issue
Block a user