Skip to content

AttachmentBuilder

Constructors

new AttachmentBuilder(data)

1
new AttachmentBuilder(data: Partial<AttachmentData>): AttachmentBuilder

Creates a new Attachment instance.

Parameters

ParameterTypeDescription
dataPartial<AttachmentData>The partial attachment data.

Returns

AttachmentBuilder

Source

seyfert/src/builders/Attachment.ts:42

Properties

PropertyModifierTypeDescription
datapublicPartial<AttachmentData>The partial attachment data.

Accessors

spoiler

1
get spoiler(): boolean

Gets whether the attachment is a spoiler.

Returns

boolean

Source

seyfert/src/builders/Attachment.ts:104

Methods

setDescription()

1
setDescription(desc: string): this

Sets the description of the attachment.

Parameters

ParameterTypeDescription
descstringThe description of the attachment.

Returns

this

The Attachment instance.

Example

1
attachment.setDescription('This is an example attachment');

Source

seyfert/src/builders/Attachment.ts:63


setFile()

1
setFile<T>(type: T, data: AttachmentResolvableMap[T]): this

Sets the file data of the attachment.

Type parameters

Type parameterValue
T extends keyof AttachmentResolvableMapkeyof AttachmentResolvableMap

Parameters

ParameterTypeDescription
typeTThe type of the attachment data.
dataAttachmentResolvableMap[T]The resolvable data of the attachment.

Returns

this

The Attachment instance.

Example

1
attachment.setFile('url', 'https://example.com/example.jpg');
2
attachment.setFile('path', '../assets/example.jpg');
3
attachment.setFile('buffer', Buffer.from(image.decode()));

Source

seyfert/src/builders/Attachment.ts:78


setName()

1
setName(name: string): this

Sets the name of the attachment.

Parameters

ParameterTypeDescription
namestringThe name of the attachment.

Returns

this

The Attachment instance.

Example

1
attachment.setName('example.jpg');

Source

seyfert/src/builders/Attachment.ts:51


setSpoiler()

1
setSpoiler(spoiler: boolean): this

Sets whether the attachment is a spoiler.

Parameters

ParameterTypeDescription
spoilerbooleanWhether the attachment is a spoiler.

Returns

this

The Attachment instance.

Example

1
attachment.setSpoiler(true);

Source

seyfert/src/builders/Attachment.ts:91


toJSON()

1
toJSON(): AttachmentData

Converts the Attachment instance to JSON.

Returns

AttachmentData

The JSON representation of the Attachment instance.

Source

seyfert/src/builders/Attachment.ts:112