Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Usage

Converts usage strings into objects to compare against later

Hierarchy

Index

Constructors

constructor

  • new Usage(client: Client, usageString: string, usageDelim: string): Usage
  • since

    0.0.1

    Parameters

    • client: Client

      The klasa client

    • usageString: string

      The raw usage string

    • usageDelim: string

      The deliminator for this usage

    Returns Usage

Properties

Readonly client

client: Client

The client this Usage was created with

since

0.0.1

customResolvers

customResolvers: Cache<string, CustomUsageArgument> = new Cache<string, CustomUsageArgument>()

Stores one-off custom resolvers for use with the custom type arg

since

0.5.0

deliminatedUsage

deliminatedUsage: string

The usage string re-deliminated with the usageDelim

since

0.0.1

parsedUsage

parsedUsage: Tag[]

The usage object to compare against later

since

0.0.1

usageDelim

usageDelim: string

The usage delim

since

0.5.0

usageString

usageString: string

The usage string

since

0.0.1

Methods

createCustomResolver

  • Registers a one-off custom resolver

    since

    0.5.0

    chainable

    Parameters

    • type: string

      The type of the usage argument

    • resolver: CustomUsageArgument

      The one-off custom resolver

    Returns this

createPrompt

customizeResponse

  • customizeResponse(name: string, response: string | TagResponse): this
  • Customizes the response of an argument if it fails resolution.

    since

    0.5.0

    chainable

    Parameters

    • name: string

      The name of the usage argument

    • response: string | TagResponse

      The custom response or i18n function

    Returns this

toJSON

  • toJSON(): Tag[]

toString

  • toString(): string

Static Private parseUsage

  • parseUsage(usageString: string): Tag[]
  • Method responsible for building the usage object to check against

    since

    0.0.1

    Parameters

    • usageString: string

      The usage string to parse

    Returns Tag[]

Static tagClose

  • Method responsible for handling tag closes

    since

    0.0.1

    Parameters

    • usage: UsageContext

      The current usage interim object

    • char: string

      The character that triggered this function

    Returns void

Static Private tagOpen

  • Method responsible for handling tag opens

    since

    0.0.1

    Parameters

    • usage: UsageContext

      The current usage interim object

    • char: string

      The character that triggered this function

    Returns void

Static Private tagSpace

  • Method responsible for handling tag spacing

    since

    0.0.1

    Parameters

    • usage: UsageContext

      The current usage interim object

    • char: string

      The character that triggered this function

    Returns void

Generated using TypeDoc