ThumbnailBuilder

export declare class ThumbnailBuilder extends ComponentBuilder<APIThumbnailComponent>
export declare class ThumbnailBuilder extends ComponentBuilder<APIThumbnailComponent>

No summary provided.

constructor(data?)
Creates a new thumbnail from API data.
Example
Creating a thumbnail from an API data object:
const thumbnail = new ThumbnailBuilder({
description: 'some text',
media: {
url: 'https://cdn.discordapp.com/embed/avatars/4.png',
},
});
const thumbnail = new ThumbnailBuilder({
description: 'some text',
media: {
url: 'https://cdn.discordapp.com/embed/avatars/4.png',
},
});
Example
Creating a thumbnail using setters and API data:
const thumbnail = new ThumbnailBuilder({
media: {
url: 'attachment://image.png',
},
})
.setDescription('alt text');
const thumbnail = new ThumbnailBuilder({
media: {
url: 'attachment://image.png',
},
})
.setDescription('alt text');
NameTypeOptionalDescription
dataPartial<APIThumbnailComponent>YesThe API data to create this thumbnail with
The API data associated with this component.
Inherited from ComponentBuilder
clearDescription():this
Clears the description of this thumbnail.
clearId():this
Clears the id of this component, defaulting to a default incremented id.
Inherited from ComponentBuilder
setDescription(description):this
Sets the description of this thumbnail.
NameTypeOptionalDescription
descriptionstringNoThe description to use
setId(id):this
Sets the id (not the custom id) for this component.
NameTypeOptionalDescription
idnumberNoThe id for this component
Inherited from ComponentBuilder
setSpoiler(spoiler?):this
Sets the spoiler status of this thumbnail.
NameTypeOptionalDescription
spoilerbooleanYesThe spoiler status to use
setURL(url):this
Sets the media URL of this thumbnail.
NameTypeOptionalDescription
urlstringNoThe URL to use
Serializes this builder to API-compatible JSON data.
Remarks
This method runs validations on the data before serializing it. As such, it may throw an error if the data is invalid.