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

54 lines
1.4 KiB
TypeScript

import type { DiscordSelectMenuComponent, MessageComponentTypes } from "../../../../discordeno/mod.ts";
import type { SelectMenuOptionBuilder } from "./SelectMenuOptionBuilder.ts";
export class SelectMenuBuilder {
constructor() {
this.#data = {} as DiscordSelectMenuComponent;
this.type = 3;
this.options = [];
}
#data: DiscordSelectMenuComponent;
type: MessageComponentTypes.SelectMenu;
options: SelectMenuOptionBuilder[];
setPlaceholder(placeholder: string) {
this.#data.placeholder = placeholder;
return this;
}
setValues(max?: number, min?: number) {
this.#data.max_values = max;
this.#data.min_values = min;
return this;
}
setDisabled(disabled = true) {
this.#data.disabled = disabled;
return this;
}
setCustomId(id: string) {
this.#data.custom_id = id;
return this;
}
setOptions(...options: SelectMenuOptionBuilder[]) {
this.options.splice(
0,
this.options.length,
...options,
);
return this;
}
addOptions(...options: SelectMenuOptionBuilder[]) {
this.options.push(
...options,
);
}
toJSON(): DiscordSelectMenuComponent {
return { ...this.#data, type: this.type, options: this.options.map((option) => option.toJSON()) };
}
}