declare class AttachmentBuilder implements JSONEncodable<RESTAPIAttachment>A builder that creates API-compatible JSON data for attachments.
Constructors
externalconstructor(data?: Partial<RESTAPIAttachment>)
Creates a new attachment builder.
const attachment = new AttachmentBuilder().setId(1).setFileData(':)').setFilename('smiley.txt')Clears the content type of the file data from this attachment.
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(data: Buffer | Uint8Array | string) : this
Sets the file data to upload with this attachment.
external setFilename(filename: string) : this
Sets the filename of this 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.