UNPKG

commandbot

Version:

A framework that helps you create your own Discord bot easier.

54 lines (53 loc) 1.88 kB
import { Interaction, Message } from "discord.js"; import { FunctionCommand } from "../commands/base/FunctionCommand.js"; import { ParameterType, InputParameterValue, InputParameter, TargetID } from "./Parameter.js"; /** * Object that stores all interaction input data (target, arguments, content and the interaction itself) * @class */ export declare class InputManager { /** * Command related to this manager * @type {FunctionCommand} * @public * @readonly */ readonly command: FunctionCommand; /** * Command interaction or message * @type {Interaction | Message} * @public * @readonly */ readonly interaction: Interaction | Message; /** * Command target (when using context menu interactions) * @type {?TargetID<any>} * @public * @readonly */ readonly target?: TargetID<any>; /** * All input arguments * @type {Array<InputParameter<any>>} * @private * @readonly */ private readonly arguments; /** * @constructor * @param {FunctionCommand} command - command related to this manager * @param {Interaction | Message} interaction - interaction or message * @param {Array<InputManager<any>>} args - list of input arguments * @param {?TargetID<any>} [target] - interaction target (when using context menu interactions) */ constructor(command: FunctionCommand, interaction: Interaction | Message, args: InputParameter<any>[], target?: TargetID<any>); /** * Get input values * @param {string} query - parameter name * @param {T} type - parameter type * @returns {ParameterResolvable} Argument value bound to a parameter * @public */ get<T extends ParameterType>(query: string, type: T): InputParameterValue<T> | null; }