mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 04:56:07 +00:00
* feat: components v2 * fix: build * chore: apply formatting * refactor(components): some types * refactor(types): replace TopLevelComponents with APITopLevelComponent in REST * fix: unify components * refactor(TextDisplay): rename content method to setContent for clarity * refactor(builders): add missing builder from component * fix: touche * feat(webhook): webhook params for components v2 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { type APITextDispalyComponent, ComponentType } from '../types';
|
|
import { BaseComponentBuilder } from './Base';
|
|
|
|
/**
|
|
* Represents a text display component builder.
|
|
* Used to display simple text content.
|
|
* @example
|
|
* ```ts
|
|
* const text = new TextDisplay().content('Hello, world!');
|
|
* ```
|
|
*/
|
|
export class TextDisplay extends BaseComponentBuilder<APITextDispalyComponent> {
|
|
/**
|
|
* Constructs a new TextDisplay component.
|
|
* @param data Optional initial data for the text display component.
|
|
*/
|
|
constructor(data: Partial<APITextDispalyComponent> = {}) {
|
|
super({ type: ComponentType.TextDisplay, ...data });
|
|
}
|
|
|
|
/**
|
|
* Sets the ID for the text display component.
|
|
* @param id The ID to set.
|
|
* @returns The updated TextDisplay instance.
|
|
*/
|
|
setId(id: number) {
|
|
this.data.id = id;
|
|
return this;
|
|
}
|
|
|
|
/**
|
|
* Sets the text content to display.
|
|
* @param content The text content.
|
|
* @returns The updated TextDisplay instance.
|
|
*/
|
|
setContent(content: string) {
|
|
this.data.content = content;
|
|
return this;
|
|
}
|
|
}
|