@wilcosp/rex
Version:
Rex is an automated command manager for discord js
79 lines (78 loc) • 3.38 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 { APIApplicationCommand, APIApplicationCommandBasicOption, APIApplicationCommandSubcommandOption, RESTPostAPIChatInputApplicationCommandsJSONBody, Snowflake } from "discord-api-types/v10";
import { ApplicationCommand, ApplicationCommandSubCommand, AutocompleteInteraction, ChatInputCommandInteraction } from "discord.js";
import { RexApplicationCommandBase } from "../applicationCommandBase.js";
import { RexContextMenuCommand } from "../contextmenu/contextMenuCommand.js";
import { RexSlashCommandInteraction } from "../interactions/slashCommands/slashCommand.js";
import { RexAutoCompleteExecuteFun, RexChatInputCommandInfo, rexExecuteFun } from "../types/types";
import { RexSlashCommandBase } from "./commandBase.js";
type rexOption = {
toJSON: () => APIApplicationCommandBasicOption;
} | APIApplicationCommandBasicOption;
export declare class RexSlashCommand extends RexSlashCommandBase {
private _options?;
private _commandInfo?;
private groupParent?;
private subParent?;
get commandInfo(): RexChatInputCommandInfo;
/**
* add an option to the command
* @param option the option you want
* @returns this
* @deprecated will be removed in v4 because you can use addoptions
*/
addOption(option: rexOption): this;
/**
* add multiple options to this command
* @param options multiple options
* @returns this
*/
addOptions(...options: rexOption[] | rexOption[][]): this;
/**
* Set multiple options for this command
* @param options multiple options
* @returns this
*/
setOptions(...options: rexOption[] | rexOption[][]): this;
/**
* @ignore internal only
*/
setCommandId(id: Snowflake, { group, sub }?: {
group?: string;
sub?: string;
}): this;
/**
* the function that needs to be executed when an user uses this command
* @param fun
* @returns this
*/
setExecute(fun: rexExecuteFun<RexSlashCommandInteraction, RexChatInputCommandInfo>): this;
/**
* set the function that will respond to autocomplete interaction if an option has it enabled
* @param fun the function that will respond to the autocomplete interaction
* @returns this
*/
setAutoCompleteFun(fun: RexAutoCompleteExecuteFun): this;
/**
* @private
* (manager only)
* @param aCom
* @returns
*/
run(aCom: ChatInputCommandInteraction, commands: Map<string, RexApplicationCommandBase | RexContextMenuCommand>): unknown | void | Promise<void | unknown>;
runAutoComplete(auto: AutocompleteInteraction, commands: Map<string, RexApplicationCommandBase | RexContextMenuCommand>): void;
/**
* converts this command into an usable slash command
* @private (manager only)
* @returns an converted slash command
*/
toCommand(): RESTPostAPIChatInputApplicationCommandsJSONBody;
toSlashSubCommand(): APIApplicationCommandSubcommandOption;
equalToCommand(aCom: APIApplicationCommand | ApplicationCommand): boolean;
equalToSubSlashCommand(opt: APIApplicationCommandSubcommandOption | ApplicationCommandSubCommand): boolean;
}
export {};