@oceanicjs/builders
Version:
Helpful builders for various Discord related things.
58 lines (57 loc) • 2.14 kB
TypeScript
import Component from "./Component";
import { ComponentTypes, RawTextInput, TextInput as ITextInput, TextInputStyles } from "oceanic.js";
export default class TextInput extends Component<ComponentTypes.TEXT_INPUT> {
customID: string;
label: string;
maxLength?: number;
minLength?: number;
placeholder?: string;
required?: boolean;
style: TextInputStyles;
value?: string;
constructor(style: TextInputStyles, label: string, 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;
/**
* Set the custom id of this text input.
* @param customID A developer-defined identifier for the input, max 100 characters.
*/
setCustomID(customID: string): this;
/**
* Set the label of this text input.
* @param label The label to display on this text input.
*/
setLabel(label: string): this;
/**
* Set the minimum/maximum length of this text input.
* @param min The minimum length.
* @param max The maximum length.
*/
setLength(min?: number, max?: number): this;
/**
* Make this text input optional.
*/
setOptional(): this;
/**
* Set the placeholder of this text input.
* @param placeholder Custom placeholder text if nothing is selected, max 100 characters.
*/
setPlaceholder(placeholder: string): this;
/**
* Make this text input required.
* @param required If this text input should be required or not - default true, setOptional also exists.
*/
setRequired(required?: boolean): this;
/**
* Set the style of this text input.
* @param style The [style](https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles) of this text input.
*/
setStyle(style: TextInputStyles): this;
/**
* Set the initial value of this text input.
* @param value A pre-filled value for this component, max 4000 characters.
*/
setValue(value: string): this;
toJSON(): ITextInput;
toJSONRaw(): RawTextInput;
}