seyfert
Version:
The most advanced framework for discord bots
62 lines (61 loc) • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Thumbnail = void 0;
const types_1 = require("../types");
const Base_1 = require("./Base");
/**
* Represents a thumbnail component builder.
* Used to display a small image preview, often alongside other content.
* @example
* ```ts
* const thumbnail = new Thumbnail()
* .setMedia('https://example.com/thumbnail.jpg')
* .setDescription('A cool thumbnail');
* ```
*/
class Thumbnail extends Base_1.BaseComponentBuilder {
/**
* Constructs a new Thumbnail component.
* @param data Optional initial data for the thumbnail component.
*/
constructor(data = {}) {
super({ type: types_1.ComponentType.Thumbnail, ...data });
}
/**
* Sets whether the thumbnail should be visually marked as a spoiler.
* @param spoiler Whether the thumbnail is a spoiler (defaults to true).
* @returns The updated Thumbnail instance.
*/
setSpoiler(spoiler = true) {
this.data.spoiler = spoiler;
return this;
}
/**
* Sets the description for the thumbnail.
* @param description The description text. Can be undefined to remove the description.
* @returns The updated Thumbnail instance.
*/
setDescription(description) {
this.data.description = description;
return this;
}
/**
* Sets the ID for the thumbnail component.
* @param id The ID to set.
* @returns The updated Thumbnail instance.
*/
setId(id) {
this.data.id = id;
return this;
}
/**
* Sets the media URL for the thumbnail.
* @param url The URL of the image to display as a thumbnail.
* @returns The updated Thumbnail instance.
*/
setMedia(url) {
this.data.media = { url };
return this;
}
}
exports.Thumbnail = Thumbnail;