import { CommandAttributes, CommandClient } from '../commandclient'; import { CommandRatelimit, CommandRatelimitItem, CommandRatelimitOptions } from '../commandratelimit'; import { Message } from '../structures/message'; import { ArgumentOptions, Argument, ArgumentDefault, ArgumentType } from './argument'; import { ArgumentParser, ParsedArgs, ParsedErrors } from './argumentparser'; import { Context } from './context'; export declare type CommandRatelimitInfo = { item: CommandRatelimitItem; ratelimit: CommandRatelimit; remaining: number; }; export declare type CommandRatelimitMetadata = { global: boolean; now: number; }; export declare type FailedPermissions = Array; /** * @category Command */ export declare type CommandCallbackDmBlocked = (context: Context) => Promise | any | Message; /** * @category Command */ export declare type CommandCallbackBefore = (context: Context) => Promise | boolean; /** * @category Command */ export declare type CommandCallbackBeforeRun = (context: Context, args: ParsedArgs) => Promise | boolean; /** * @category Command */ export declare type CommandCallbackCancel = (context: Context) => Promise | any | Message; /** * @category Command */ export declare type CommandCallbackCancelRun = (context: Context, args: ParsedArgs) => Promise | any | Message; /** * @category Command */ export declare type CommandCallbackError = (context: Context, args: ParsedArgs, error: any) => Promise | any; /** * @category Command */ export declare type CommandCallbackPermissionsFail = (context: Context, permissions: FailedPermissions) => Promise | any | Message; /** * @category Command */ export declare type CommandCallbackSuccess = (context: Context, args: ParsedArgs) => Promise | any; /** * @category Command */ export declare type CommandCallbackRatelimit = (context: Context, ratelimits: Array, metadata: CommandRatelimitMetadata) => Promise | any | Message; /** * @category Command */ export declare type CommandCallbackRun = (context: Context, args: ParsedArgs) => Promise | any | Message; /** * @category Command */ export declare type CommandCallbackRunError = (context: Context, args: ParsedArgs, error: any) => Promise | any; /** * @category Command */ export declare type CommandCallbackTypeError = (context: Context, args: ParsedArgs, errors: ParsedErrors) => Promise | any | Message; /** * Command Options * @category Command Options */ export interface CommandOptions extends ArgumentOptions { _file?: string; args?: Array; disableDm?: boolean; disableDmReply?: boolean; metadata?: Record; name: string; permissions?: Array; permissionsClient?: Array; permissionsIgnoreClientOwner?: boolean; priority?: number; ratelimit?: boolean | CommandRatelimitOptions | null; ratelimits?: Array; responseOptional?: boolean; triggerTypingAfter?: number; onDmBlocked?: CommandCallbackDmBlocked; onBefore?: CommandCallbackBefore; onBeforeRun?: CommandCallbackBeforeRun; onCancel?: CommandCallbackCancel; onCancelRun?: CommandCallbackCancelRun; onError?: CommandCallbackError; onPermissionsFail?: CommandCallbackPermissionsFail; onPermissionsFailClient?: CommandCallbackPermissionsFail; onRatelimit?: CommandCallbackRatelimit; run?: CommandCallbackRun; onRunError?: CommandCallbackRunError; onSuccess?: CommandCallbackSuccess; onTypeError?: CommandCallbackTypeError; } /** * Command itself * Command flow is ratelimit check -> dm/permission check -> `onBefore` -> arg parse -> `onBeforeRun` -> `run` -> `onSuccess | onRunError` * @category Command */ export declare class Command { readonly _file?: string; readonly argParser: ArgumentParser; readonly commandClient: CommandClient; arg: Argument; disableDm: boolean; disableDmReply: boolean; metadata: Record; permissions?: Array; permissionsClient?: Array; permissionsIgnoreClientOwner?: boolean; priority: number; ratelimits: Array; responseOptional: boolean; triggerTypingAfter: number; onDmBlocked?(context: Context): Promise | any | Message; onBefore?(context: Context): Promise | boolean; onBeforeRun?(context: Context, args: ParsedArgs): Promise | boolean; onCancel?(context: Context): Promise | any | Message; onCancelRun?(context: Context, args: ParsedArgs): Promise | any | Message; onError?(context: Context, args: ParsedArgs, error: any): Promise | any; onPermissionsFail?(context: Context, permissions: FailedPermissions): Promise | any | Message; onPermissionsFailClient?(context: Context, permissions: FailedPermissions): Promise | any | Message; onRatelimit?(context: Context, ratelimits: Array, metadata: CommandRatelimitMetadata): Promise | any | Message; run?(context: Context, args: ParsedArgsFinished): Promise | any | Message; onRunError?(context: Context, args: ParsedArgsFinished, error: any): Promise | any | Message; onSuccess?(context: Context, args: ParsedArgsFinished): Promise | any; onTypeError?(context: Context, args: ParsedArgs, errors: ParsedErrors): Promise | any | Message; constructor(commandClient: CommandClient, options: CommandOptions); get aliases(): Array; set aliases(value: Array); set args(value: Array); get choices(): Array | undefined; set choices(value: Array | undefined); get default(): ArgumentDefault; set default(value: ArgumentDefault); get fullName(): string; get help(): string; set help(value: string); get label(): string; set label(value: string); get name(): string; set name(value: string); get names(): string[]; set prefixes(value: Array); set type(value: ArgumentType); setAliases(value: Array): this; setArgs(value: Array): this; setChoices(value: Array | undefined): this; setDefault(value: ArgumentDefault): this; setHelp(value: string): this; setLabel(value: string): this; setName(value: string): this; setPrefixes(value: Array): this; setType(value: ArgumentType): this; check(name: string): boolean; getArgs(attributes: CommandAttributes, context: Context): Promise<{ errors: ParsedErrors; parsed: ParsedArgs; }>; getName(content: string): null | string; }