seyfert
Version:
The most advanced framework for discord bots
53 lines (52 loc) • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.File = void 0;
const types_1 = require("../types");
const Base_1 = require("./Base");
/**
* Represents a file component builder.
* Used to display files within containers.
* @example
* ```ts
* const file = new File()
* .setMedia('https://example.com/image.png')
* .setSpoiler();
* ```
*/
class File extends Base_1.BaseComponentBuilder {
/**
* Constructs a new File component.
* @param data Optional initial data for the file component.
*/
constructor(data = {}) {
super({ type: types_1.ComponentType.File, ...data });
}
/**
* Sets the ID for the file component.
* @param id The ID to set.
* @returns The updated File instance.
*/
setId(id) {
this.data.id = id;
return this;
}
/**
* Sets the media URL for the file.
* @param url The URL of the file to display.
* @returns The updated File instance.
*/
setMedia(url) {
this.data.file = { url };
return this;
}
/**
* Sets whether the file should be visually marked as a spoiler.
* @param spoiler Whether the file is a spoiler (defaults to true).
* @returns The updated File instance.
*/
setSpoiler(spoiler = true) {
this.data.spoiler = spoiler;
return this;
}
}
exports.File = File;