seyfert/packages/biscuit/structures/builders/components/InputTextComponentBuilder.ts
Yuzu b15666f20e
chore: use single quotes (#68)
* chore: single quote
2022-07-18 18:25:23 +00:00

50 lines
1.2 KiB
TypeScript

import type { DiscordInputTextComponent, MessageComponentTypes, TextStyles } from '../../../../discordeno/mod.ts';
export class InputTextBuilder {
constructor() {
this.#data = {} as DiscordInputTextComponent;
this.type = 4;
}
#data: DiscordInputTextComponent;
type: MessageComponentTypes.InputText;
setStyle(style: TextStyles): this {
this.#data.style = style;
return this;
}
setLabel(label: string): this {
this.#data.label = label;
return this;
}
setPlaceholder(placeholder: string): this {
this.#data.placeholder = placeholder;
return this;
}
setLength(max?: number, min?: number): this {
this.#data.max_length = max;
this.#data.min_length = min;
return this;
}
setCustomId(id: string): this {
this.#data.custom_id = id;
return this;
}
setValue(value: string): this {
this.#data.value = value;
return this;
}
setRequired(required = true): this {
this.#data.required = required;
return this;
}
toJSON(): DiscordInputTextComponent {
return { ...this.#data, type: this.type };
}
}