seyfert/packages/biscuit/structures/builders/components/InputTextComponentBuilder.ts
Yuzu 67c43e8fcf
compat: remove mixer (#53)
Co-authored-by: Yuzu <yuzuru@programmer.net>
Co-authored-by: Nicolás Serna <nicolito128@hotmail.com>

* compat: replace the mixer

Co-authored-by: Marcos Susaña <66887817+socram03@users.noreply.github.com>
Co-authored-by: Nicolás Serna <nicolito128@hotmail.com>
2022-07-14 17:45:27 +00:00

50 lines
1.1 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.#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(): DiscordInputTextComponent {
return { ...this.#data, type: this.type };
}
}