File

Represents a file component builder. Used to display files within containers.

Signature

export declare class File extends BaseComponentBuilder<APIFileComponent>
JSDoc
Examples
const file = new File()
 .setMedia('https://example.com/image.png')
 .setSpoiler();

Properties

0

No properties.

Methods

4

Methods

setId(id: number): this;

Sets the ID for the file component.

Parameters
id
The ID to set.
Returns

The updated File instance.

setMedia(url: string): this;

Sets the media URL for the file.

Parameters
url
The URL of the file to display.
Returns

The updated File instance.

setSpoiler(spoiler?: boolean): this;

Sets whether the file should be visually marked as a spoiler.

Parameters
spoiler
Whether the file is a spoiler (defaults to true).
Returns

The updated File instance.