Appearance
AttachmentBuilder
Package: @erinjs/builders
Builder for attachment metadata (filename, description, spoiler). Actual file data is passed separately when sending.
Constructor
| Name | Type | Optional | Description |
|---|---|---|---|
id | number | No | Index of the attachment (0-based). Must match the FormData part order. |
filename | string | No | |
options | Partial<AttachmentPayloadOptions> | Yes |
Properties
| Name | Type | Readonly | Optional | Description |
|---|---|---|---|---|
description | string | null | No | Yes | |
filename | string | No | No | |
id | number | Yes | No | |
spoiler | boolean | No | No |
Methods
setDescription()
Set the attachment description (alt text).
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
description | string | null | No |
setName()
Set the displayed filename.
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
name | string | No |
setSpoiler()
Mark the attachment as a spoiler (blurred until clicked).
Returns: this
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
spoiler | boolean | No |
toJSON()
Convert to API format for MessagePayload.
Returns: APIAttachmentPayload
Parameters:
None