AttachmentBuilder
Constructors
new AttachmentBuilder(data)
1new AttachmentBuilder(data: Partial<AttachmentData>): AttachmentBuilder
Creates a new Attachment instance.
Parameters
Parameter | Type | Description |
---|---|---|
data | Partial <AttachmentData > | The partial attachment data. |
Returns
Source
seyfert/src/builders/Attachment.ts:42
Properties
Property | Modifier | Type | Description |
---|---|---|---|
data | public | Partial <AttachmentData > | The partial attachment data. |
Accessors
spoiler
1get spoiler(): boolean
Gets whether the attachment is a spoiler.
Returns
boolean
Source
seyfert/src/builders/Attachment.ts:104
Methods
setDescription()
1setDescription(desc: string): this
Sets the description of the attachment.
Parameters
Parameter | Type | Description |
---|---|---|
desc | string | The description of the attachment. |
Returns
this
The Attachment instance.
Example
1attachment.setDescription('This is an example attachment');
Source
seyfert/src/builders/Attachment.ts:63
setFile()
1setFile<T>(type: T, data: AttachmentResolvableMap[T]): this
Sets the file data of the attachment.
Type parameters
Type parameter | Value |
---|---|
T extends keyof AttachmentResolvableMap | keyof AttachmentResolvableMap |
Parameters
Parameter | Type | Description |
---|---|---|
type | T | The type of the attachment data. |
data | AttachmentResolvableMap [T ] | The resolvable data of the attachment. |
Returns
this
The Attachment instance.
Example
1attachment.setFile('url', 'https://example.com/example.jpg');2attachment.setFile('path', '../assets/example.jpg');3attachment.setFile('buffer', Buffer.from(image.decode()));
Source
seyfert/src/builders/Attachment.ts:78
setName()
1setName(name: string): this
Sets the name of the attachment.
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The name of the attachment. |
Returns
this
The Attachment instance.
Example
1attachment.setName('example.jpg');
Source
seyfert/src/builders/Attachment.ts:51
setSpoiler()
1setSpoiler(spoiler: boolean): this
Sets whether the attachment is a spoiler.
Parameters
Parameter | Type | Description |
---|---|---|
spoiler | boolean | Whether the attachment is a spoiler. |
Returns
this
The Attachment instance.
Example
1attachment.setSpoiler(true);
Source
seyfert/src/builders/Attachment.ts:91
toJSON()
1toJSON(): AttachmentData
Converts the Attachment instance to JSON.
Returns
The JSON representation of the Attachment instance.