class AttachmentBuilder

external
declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment>

A builder that creates API-compatible JSON data for attachments.

Constructors

external
constructor()

Creates a new attachment builder.

Examples:
const attachment = new AttachmentBuilder().setId(1).setFileData(':)').setFilename('smiley.txt')

external
clearDescription() : this

Clears the description of this attachment.

external
clearDuration() : this

Clears the duration of this attachment.

external
clearFileContentType() : this

Clears the content type of the file data from this attachment.

external
clearFileData() : this

Clears the file data from this attachment.

external
clearFilename() : this

Clears the filename of this attachment.

external
clearTitle() : this

Clears the title of this attachment.

external
clearWaveform() : this

Clears the waveform of this attachment.

external
getRawFile() : Partial<RawFile> | undefined

Converts this attachment to a RawFile for uploading.

Returns: A RawFile object, or undefined if no file data is set

external
setDescription(
description: string
) : this

Sets the description of this attachment.

external
setDuration(
duration: number
) : this

Sets the duration of this attachment (audio clips).

external
setFileContentType(
contentType: string
) : this

Sets the content type of the file data to upload with this attachment.

external
setFileData() : this

Sets the file data to upload with this attachment.

external
setFilename(
filename: string
) : this

Sets the filename of this attachment.

external
setId() : this

Sets the id of the attachment.

external
setTitle(
title: string
) : this

Sets the title of this attachment.

external
setWaveform(
waveform: string
) : this

Sets the waveform of this attachment (audio clips).

external
toJSON(
validationOverride?: boolean
) : RESTAPIAttachment

Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.