Class

AttachmentBuilder

File attachment for files: [builder] send paths.

Constructor

new AttachmentBuilder(file: AttachmentFileInput, options: AttachmentBuilderOptions)

Properties

NameTypeDescription
attachmentread-onlyBlob | ArrayBuffer | Uint8Array | nullLocal file bytes when constructed with a buffer/blob.
description?string | nullAlt text / description for accessibility.
filenameread-onlystringFilename alias used by send helpers (same as name).
namestringDisplay / upload name (may include SPOILER_ prefix).
spoilerbooleanWhether this attachment should be hidden until clicked.
urlread-onlystring | nullRemote URL when constructed with a string URL.

Methods

.toFileData()

| { name: string; data: Blob | ArrayBuffer | Uint8Array; filename: string } | { name: string; url: string; filename: string }

Convert to the { name, data | url } shape used by message send helpers.

attachmentBuilder.toFileData();