Class

AttachmentBuilder

Attachment metadata for message payloads (file bytes sent separately).

Constructor

new AttachmentBuilder(id: number, filename: string, options?: Partial<AttachmentPayloadOptions>)
id
number
filename
string
options?
Partial<AttachmentPayloadOptions>

Properties

NameTypeDescription
description?string | nullAlt text / description for accessibility.
filenamestringFilename (may be prefixed with SPOILER_ if spoiler is true).
idread-onlynumberAttachment ID (index in files array).
spoilerbooleanWhether this attachment should be hidden until clicked.

Methods

.setDescription(description)

description: string | null → this

Set attachment description (alt text for accessibility). Pass null to clear.

description
string | nullDescription text or null
attachmentBuilder.setDescription(description);

.setName(name)

name: string → this

Set attachment filename (preserves spoiler prefix if enabled).

name
stringNew filename
attachmentBuilder.setName(name);

.setSpoiler(spoiler)

spoiler: boolean → this

Toggle spoiler flag (adds/removes SPOILER_ prefix from filename).

spoiler
booleanWhether this attachment should be hidden
attachmentBuilder.setSpoiler(spoiler);