@oceanicjs/builders
Version:
Helpful builders for various Discord related things.
56 lines (55 loc) • 2.36 kB
TypeScript
import Component from "./Component";
import type { SelectOption, SelectMenuTypes, SelectMenuComponent, ChannelTypes, RawSelectMenuComponent, NullablePartialEmoji } from "oceanic.js";
export default class SelectMenu extends Component<SelectMenuTypes> {
channelTypes?: Array<ChannelTypes>;
customID: string;
disabled: boolean;
maxValues?: number;
minValues?: number;
options: Array<SelectOption>;
placeholder?: string;
/**
* Create a new SelectMenu.
* @param customID The custom ID of this select menu.
*/
constructor(type: SelectMenuTypes, customID: string);
/** this method is meant to be for internal use only, don't use it, as it may break or change at a moments notice */
private load;
/**
* Add an option to this select menu.
* @param label The label for this option.
* @param value The value of this option.
* @param description The description of this option.
* @param emoji The emoji to displayed with this option.
*/
addOption(label: string, value: string, description?: string, emoji?: NullablePartialEmoji, defaultSelection?: boolean): this;
/**
* Add options to this select menu in bulk.
* @param options The options to add.
*/
addOptions(...options: Array<SelectOption>): this;
/** Clear all currently present options on this select menu. */
clearOptions(): this;
/** Set the valid channel types for a channel select menu. */
setChannelTypes(...types: [types: Array<ChannelTypes>] | Array<ChannelTypes>): this;
/**
* Set the custom ID of this select menu.
* @param customID A developer-defined identifier for the button, max 100 characters.
*/
setCustomID(customID: string): this;
/**
* Set the placeholder of this select menu.
* @param placeholder Custom placeholder text if nothing is selected, max 100 characters.
*/
setPlaceholder(placeholder: string): this;
/**
* Set the minimum/maximum values of this select menu.
* @param min The minimum selected values.
* @param max The maximum selected values.
*/
setValues(min?: number, max?: number): this;
/** converts this SelectMenu instance to json. */
toJSON(): SelectMenuComponent;
/** converts this SelectMenu instance to json. */
toJSONRaw(): RawSelectMenuComponent;
}