Represents an argument for a command.

Constructors

Properties

command: Command

The command this argument belongs to.

default: any

The default value of the argument or a function supplying the default value.

description: any

Description of the command.

flag: null | string | string[]

The string(s) to use for flag or option match.

index: null | number

The index to start from.

limit: number

The amount of phrases to match for rest, separate, content, or text match.

match:
    | "none"
    | "content"
    | "option"
    | "text"
    | "rest"
    | "phrase"
    | "flag"
    | "separate"
    | "restContent"

The method to match text.

modifyOtherwise: null | OtherwiseContentModifier

Function to modify otherwise content.

multipleFlags: boolean

Whether to process multiple option flags instead of just the first.

otherwise:
    | null
    | MessageSendResolvable
    | (
        ...args: [message: TextCommandMessage, data: FailureData],
    ) => SyncOrAsync<MessageSendResolvable>

The content or function supplying the content sent when argument parsing fails.

prompt: null | boolean | ArgumentPromptOptions

The prompt options.

type:
    | ArgumentType
    | (...args: [message: TextCommandMessage, phrase: string]) => unknown

The type to cast to or a function to use to cast.

unordered: number | boolean | number[]

Whether or not the argument is unordered.

Accessors

Methods

  • Collects input from the user by prompting.

    Parameters

    • message: TextCommandMessage

      Message to prompt.

    • commandInput: string = ""

      Previous input from command if there was one.

    • parsedInput: any = null

      Previous parsed input from command if there was one.

    Returns Promise<any>

  • Creates a type that is the left-to-right composition of the given types. If any of the types fails, the entire composition fails.

    Type Parameters

    • T extends ATC<unknown>

    Parameters

    • ...types: T[]

      Types to use.

    Returns ATCATCR<T>

  • Creates a type that is the left-to-right composition of the given types. If any of the types fails, the entire composition fails.

    Type Parameters

    Parameters

    • ...types: T[]

      Types to use.

    Returns ATCBAT<T>

  • Creates a type that is the left-to-right composition of the given types. If any of the types fails, the entire composition fails.

    Parameters

    Returns ATC<unknown>

  • Creates a type that is the left-to-right composition of the given types. If any of the types fails, the composition still continues with the failure passed on.

    Type Parameters

    • T extends ATC<unknown>

    Parameters

    • ...types: T[]

      Types to use.

    Returns ATCATCR<T>

  • Creates a type that is the left-to-right composition of the given types. If any of the types fails, the composition still continues with the failure passed on.

    Type Parameters

    Parameters

    • ...types: T[]

      Types to use.

    Returns ATCBAT<T>

  • Creates a type that is the left-to-right composition of the given types. If any of the types fails, the composition still continues with the failure passed on.

    Parameters

    Returns ATC<unknown>

  • Creates a type where the parsed value must be within a range.

    Type Parameters

    • T extends ATC<unknown>

    Parameters

    • type: T

      The type to use.

    • min: number

      Minimum value.

    • max: number

      Maximum value.

    • Optionalinclusive: boolean

      Whether or not to be inclusive on the upper bound.

    Returns ATCATCR<T>

  • Creates a type where the parsed value must be within a range.

    Type Parameters

    Parameters

    • type: T

      The type to use.

    • min: number

      Minimum value.

    • max: number

      Maximum value.

    • Optionalinclusive: boolean

      Whether or not to be inclusive on the upper bound.

    Returns ATCBAT<T>

  • Creates a type where the parsed value must be within a range.

    Parameters

    • type: ArgumentType | ATC<unknown>

      The type to use.

    • min: number

      Minimum value.

    • max: number

      Maximum value.

    • Optionalinclusive: boolean

      Whether or not to be inclusive on the upper bound.

    Returns ATC<unknown>

  • Creates a type that parses as normal but also tags it with some data. Result is in an object { tag, value } and wrapped in Flag.fail when failed.

    Type Parameters

    • T extends ATC<unknown>

    Parameters

    • type: T

      The type to use.

    • Optionaltag: any

      Tag to add. Defaults to the type argument, so useful if it is a string.

    Returns ATCATCR<T>

  • Creates a type that parses as normal but also tags it with some data. Result is in an object { tag, value } and wrapped in Flag.fail when failed.

    Type Parameters

    Parameters

    • type: T

      The type to use.

    • Optionaltag: any

      Tag to add. Defaults to the type argument, so useful if it is a string.

    Returns ATCBAT<T>

  • Creates a type that parses as normal but also tags it with some data. Result is in an object { tag, value } and wrapped in Flag.fail when failed.

    Parameters

    • type: ArgumentType | ATC<unknown>

      The type to use.

    • Optionaltag: any

      Tag to add. Defaults to the type argument, so useful if it is a string.

    Returns ATC<unknown>

  • Creates a type from multiple types (union type). The first type that resolves to a non-void value is used. Each type will also be tagged using tagged with themselves.

    Type Parameters

    • T extends ATC<unknown>

    Parameters

    • ...types: T[]

      Types to use.

    Returns ATCATCR<T>

  • Creates a type from multiple types (union type). The first type that resolves to a non-void value is used. Each type will also be tagged using tagged with themselves.

    Type Parameters

    Parameters

    • ...types: T[]

      Types to use.

    Returns ATCBAT<T>

  • Creates a type from multiple types (union type). The first type that resolves to a non-void value is used. Each type will also be tagged using tagged with themselves.

    Parameters

    Returns ATC<unknown>

  • Creates a type that parses as normal but also tags it with some data and carries the original input. Result is in an object { tag, input, value } and wrapped in Flag.fail when failed.

    Type Parameters

    • T extends ATC<unknown>

    Parameters

    • type: T

      The type to use.

    • Optionaltag: any

      Tag to add. Defaults to the type argument, so useful if it is a string.

    Returns ATCATCR<T>

  • Creates a type that parses as normal but also tags it with some data and carries the original input. Result is in an object { tag, input, value } and wrapped in Flag.fail when failed.

    Type Parameters

    Parameters

    • type: T

      The type to use.

    • Optionaltag: any

      Tag to add. Defaults to the type argument, so useful if it is a string.

    Returns ATCBAT<T>

  • Creates a type that parses as normal but also tags it with some data and carries the original input. Result is in an object { tag, input, value } and wrapped in Flag.fail when failed.

    Parameters

    • type: ArgumentType | ATC<unknown>

      The type to use.

    • Optionaltag: any

      Tag to add. Defaults to the type argument, so useful if it is a string.

    Returns ATC<unknown>