mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
feat(MessageAttachment): add spoiler getter (#3713)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
const { basename } = require('path');
|
||||
|
||||
/**
|
||||
* Represents an attachment in a message.
|
||||
*/
|
||||
@@ -63,6 +65,15 @@ class MessageAttachment {
|
||||
*/
|
||||
this.width = data.width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not this attachment has been marked as a spoiler
|
||||
* @type {boolean}
|
||||
* @readonly
|
||||
*/
|
||||
get spoiler() {
|
||||
return basename(this.url).startsWith('SPOILER_');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MessageAttachment;
|
||||
|
||||
Reference in New Issue
Block a user