@wilcosp/rex
Version:
Rex is an automated command manager for discord js
45 lines (44 loc) • 1.96 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 { ApplicationCommandType } from "discord-api-types/v10";
import { ContextMenuCommandInteraction } from "discord.js";
import { RexApplicationCommandBase } from "../applicationCommandBase.js";
import { RexContextMenuInteraction } from "../interactions/context/contextBase.js";
import { RexContextCommandInfo, rexExecuteFun } from "../types/types";
/**
* create a context menu command that can be used as a user or message context command
*/
export declare class RexContextMenuCommand<I extends RexContextMenuInteraction = RexContextMenuInteraction> extends RexApplicationCommandBase<ApplicationCommandType.Message | ApplicationCommandType.User> {
readonly name: string;
private _commandInfo?;
/**
* create a context menu command
* @param name the name of the context command
* @param desc a description for a help command
* @param type the type of context command
*/
constructor(name: string, type: ApplicationCommandType.Message | ApplicationCommandType.User, description?: string);
get commandInfo(): Exclude<RexContextCommandInfo, "descriptionLocalizations">;
/**
* set the function that will handle the incoming command
* @param fun the function that will handle the command
* @returns this
*/
setExecute(fun: rexExecuteFun<I, RexContextCommandInfo>): this;
/**
*
* @ignore internal use only
*/
toCommand(): import("discord.js").RESTPostAPIApplicationCommandsJSONBody;
/**
* run this command
* @param inter the interaction
* @returns unknown
*/
run(inter: ContextMenuCommandInteraction): unknown;
static checkName(name: string): void;
static checkDescription(name: string, description: string): void;
}