mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import { DiscordInputTextComponent, MessageComponentTypes, TextStyles } from "../../vendor/external.ts";
|
|
|
|
export class InputTextBuilder {
|
|
constructor() {
|
|
this.#data = {} as DiscordInputTextComponent;
|
|
this.type = 4;
|
|
}
|
|
#data: DiscordInputTextComponent;
|
|
type: MessageComponentTypes.InputText;
|
|
|
|
setStyle(style: TextStyles) {
|
|
this.#data.style = style;
|
|
return this;
|
|
}
|
|
|
|
setLabel(label: string) {
|
|
this.#data.label = label;
|
|
return this;
|
|
}
|
|
|
|
setPlaceholder(placeholder: string) {
|
|
this.#data.placeholder = placeholder;
|
|
return this;
|
|
}
|
|
|
|
setLength(max?: number, min?: number) {
|
|
this.#data.max_length = max;
|
|
this.#data.min_length = min;
|
|
return this;
|
|
}
|
|
|
|
setCustomId(id: string) {
|
|
this.#data.custom_id = id;
|
|
return this;
|
|
}
|
|
|
|
setValue(value: string) {
|
|
this.#data.value = value;
|
|
return this;
|
|
}
|
|
|
|
setRequired(required = true) {
|
|
this.#data.required = required;
|
|
return this;
|
|
}
|
|
toJSON() {
|
|
return { ...this.#data };
|
|
}
|
|
}
|