@wilcosp/rex
Version:
Rex is an automated command manager for discord js
58 lines (57 loc) • 2.3 kB
TypeScript
/*!
* 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 { APIApplicationCommandOptionBase } from "discord-api-types/payloads/v10/_interactions/_applicationCommands/_chatInput/base";
import { ApplicationCommandOptionType } from "discord-api-types/v10";
import { RexLocale } from "../../helpers/locale.js";
export declare abstract class RexSlashCommandOptionBase<OT extends Exclude<ApplicationCommandOptionType, ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup>> {
private _name;
private _description;
readonly type: OT;
private _required;
private _nameLocals?;
private _descriptionLocals?;
constructor(_name: string, _description: string, type: OT);
get name(): string;
get description(): string;
get required(): boolean;
/**
* set wether this option is required for the command
* @param req boolean
* @returns this
*/
setRequired(req: boolean): this;
/**
* Sets name localization
* @param locale either LangaugeName or Locale
* @param localizedName the locolazed name
* @returns this
*/
setNameLocalization(locale: RexLocale, localizedName?: string | null): this;
/**
* set name localizations
* @param localizedNames a dictionary containing all the name localizations
* @returns this
*/
setNameLocalizations(localizedNames: Partial<Record<RexLocale, string>>): this;
/**
* Sets description localization
* @param locale either LangaugeName or Locale
* @param localizedDescription the locolazed description
* @returns this
*/
setDescriptionLocalization(locale: RexLocale, localizedDescription?: string | null): this;
/**
* set description localizations
* @param localizedDescriptions a dictionary containing all the description localizations
* @returns this
*/
setDescriptionsLocalizations(localizedDescriptions: Partial<Record<RexLocale, string>>): this;
/**
* converts this option to a raw discord api option
* @returns raw API option
*/
toJSON(): APIApplicationCommandOptionBase<OT>;
}