Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CommandPrompt

A class to handle argument collection and parameter resolution for commands

Hierarchy

Index

Constructors

constructor

Properties

Private #currentUsage

#currentUsage: Tag | null = null

A cache of the current usage while validating

since

0.0.1

Private #prompted

#prompted: number = 0

How many time this class has reprompted

since

0.0.1

Private #repeat

#repeat: boolean = false

Whether the current usage is a repeating arg

since

0.0.1

Private #required

#required: TagRequirement = TagRequirement.Optional

Whether the current usage is required

since

0.0.1

args

args: (undefined | null | string)[] = []

The string arguments derived from the usageDelim of the command

since

0.0.1

channel

channel: TextBasedChannel

The channel to prompt in

since

0.5.0

Readonly client

client: Client

The client this TextPrompt was created with

since

0.5.0

flagSupport

flagSupport: boolean

Whether this prompt should respect flags

since

0.5.0

flags

flags: Record<string, string>

The flag arguments resolved by this class

since

0.5.0

limit

limit: number

The number of re-prompts before this TextPrompt gives up

since

0.5.0

message

message: Message

The message this prompt is for

since

0.5.0

params

params: unknown[] = []

The parameters resolved by this class

since

0.0.1

quotedStringSupport

quotedStringSupport: boolean

Whether this prompt should respect quoted strings

since

0.5.0

reprompted

reprompted: boolean = false

If the command reprompted for missing args

since

0.0.1

target

target: User

The target this prompt is for

since

0.5.0

time

time: number

The time-limit for re-prompting

since

0.5.0

Protected typing

typing: boolean

The typing state of this CommandPrompt

since

0.5.0

usage

The usage for this prompt

since

0.5.0

Static delims

delims: Cache<string, RegExp> = new Cache<string, RegExp>()

Map of RegExps caching usageDelim's RegExps.

since

0.5.0

Static flagRegex

flagRegex: RegExp = new RegExp(`(?:--|—)(\\w[\\w-]+)(?:=(?:${quotes.map(qu => `[${qu}]((?:[^${qu}\\\\]|\\\\.)*)[${qu}]`).join('|')}|([\\w<>@#&!-]+)))?`, 'g')

Regular Expression to match flags with quoted string support.

since

0.5.0

Methods

reprompt

  • reprompt(prompt: string): Promise<unknown[]>

run

  • run(): Promise<unknown[]>

Protected validateArgs

  • validateArgs(): Promise<unknown[]>

Generated using TypeDoc