mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 14:02:02 +00:00
feat(MessageAttachment): add spoiler property (#3561)
* feat(MessageAttachment): add spoiler property * typings * Implement suggestions * Make readonly Co-Authored-By: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
parent
cc466fa4b9
commit
38d370fb18
2 changed files with 9 additions and 0 deletions
|
|
@ -81,6 +81,14 @@ class MessageAttachment {
|
|||
this.width = typeof data.width !== 'undefined' ? data.width : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not this attachment has been marked as a spoiler
|
||||
* @type {boolean}
|
||||
*/
|
||||
get spoiler() {
|
||||
return Util.basename(this.url).startsWith('SPOILER_');
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return Util.flatten(this);
|
||||
}
|
||||
|
|
|
|||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
|
|
@ -1006,6 +1006,7 @@ declare module 'discord.js' {
|
|||
public size: number;
|
||||
public url: string;
|
||||
public width: number | null;
|
||||
public readonly spoiler: boolean;
|
||||
public setFile(attachment: BufferResolvable | Stream, name?: string): this;
|
||||
public setName(name: string): this;
|
||||
public toJSON(): object;
|
||||
|
|
|
|||
Loading…
Reference in a new issue