class FileBuilder

external
declare class FileBuilder extends ComponentBuilder<APIFileComponent>

Constructors

external
constructor()

Creates a new file from API data.

Examples:Creating a file from an API data object:
const file = new FileBuilder({
	spoiler: true,
	file: {
		url: 'attachment://file.png',
	},
});
Creating a file using setters and API data:
const file = new FileBuilder({
	file: {
		url: 'attachment://image.jpg',
	},
})
	.setSpoiler(false);

protectedreadonlyexternal
data : Partial<APIFileComponent>

external
clearId() : this

Clears the id of this component, defaulting to a default incremented id.

Inherited from: ComponentBuilder

external
setId(
id: number
) : this

Sets the id of this component.

Inherited from: ComponentBuilder

external
setSpoiler(
spoiler?: boolean
) : this

Sets the spoiler status of this file.

external
setURL(
url: string
) : this

Sets the media URL of this file.

external
toJSON(
validationOverride?: boolean
) : APIFileComponent

Serializes this builder to API-compatible JSON data.Note that by disabling validation, there is no guarantee that the resulting object will be valid.