UNPKG

@wilcosp/rex

Version:

Rex is an automated command manager for discord js

88 lines (87 loc) 3.88 kB
/*! * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { APIApplicationCommandOptionChoice, APIApplicationCommandStringOption, ApplicationCommandOptionType, LocalizationMap } from "discord-api-types/v10"; import { RexArray } from "../../types/types.js"; import { RexSlashCommandOptionBase } from "./optionsBase.js"; export declare class RexSlashCommandStringOption extends RexSlashCommandOptionBase<ApplicationCommandOptionType.String> { private _choices?; private _autocomplete?; private _minLength?; private _maxLength?; constructor(name: string, description: string); get autocomplete(): boolean | undefined; /** * add a choice to this stringoption * @param name name of the choice * @param value the value of the option * @param name_localizations name localizations * @returns this */ addChoice(name: string, value: string, name_localizations?: LocalizationMap): Omit<this, "setAutocomplete">; /** * add multiple choices to this string option * @param choices all the different choices * @returns this */ addChoices(...choices: RexArray<APIApplicationCommandOptionChoice<string>>): Omit<this, "setAutocomplete">; /** * add choices to this string option which share the same name & value * @param values all the different values * @returns this */ addChoicesNormalized(...values: RexArray<string | number | BigInt>): Omit<this, "setAutocomplete">; /** * set all choices for this string option, all earlier set choices will be wiped * @param choices all the choices */ setChoices(...choices: RexArray<APIApplicationCommandOptionChoice<string>>): Omit<this, "setAutocomplete">; /** * remove all the choices from this string option */ setChoices(): this & Pick<RexSlashCommandStringOption, "setAutocomplete">; /** * set all choices for this string option where by the value & name are the same, all earlier set choices will be wiped * @param values all the different values */ setChoicesNormalized(...values: RexArray<string | number | BigInt>): Omit<this, "setAutocomplete">; /** * remove all the choices from this string option */ setChoicesNormalized(): this & Pick<RexSlashCommandStringOption, "setAutocomplete">; /** * turn on autocompletion for this string option * @param value true */ setAutocomplete(value: true): Omit<this, "setChoices" | "setChoicesNormalized" | "addChoicesNormalized" | "addChoices">; /** * turn off autocompletion for this string option * @param value false */ setAutocomplete(value: false): this & Pick<RexSlashCommandStringOption, "setChoices" | "setChoicesNormalized" | "addChoicesNormalized" | "addChoices">; /** * set the minimal length of this string option, at minimal 0 * @param minLength the wanted minimal length * @returns this */ setMinLength(minLength: number): this; /** * set the maximum length of this string option, needs to be bigger min length or 1 * @param maxLength the wanted maximum length * @returns this */ setMaxLength(maxLength: number): this; /** * set both the minimal and maximum length of this string option * @param minLength the minimal length of this string option (needs to be at least 0 and smaller then max length) * @param maxLength the maximum length of this string option (needs to be at least 1 and bigger then min length) * @returns this */ setMinMaxLength(minLength: number, maxLength: number): this; /** * @ignore meant for internal use */ toJSON(): APIApplicationCommandStringOption; }