Options
All
  • Public
  • Public/Protected
  • All
Menu

Class default

Hierarchy

Index

Constructors

constructor

Properties

Private #private

#private: any

Private Readonly aggressive

aggressive: boolean

aliases

aliases: string[]

The aliases for this piece.

since

0.0.1

Readonly client

client: Client

The client this Piece was created with.

since

0.0.1

cooldownLevel

cooldownLevel: CooldownLevel

The level at which cooldowns should apply

since

0.5.0

cooldowns

cooldowns: RateLimitManager

The cooldowns for this command

since

0.6.0

deletable

deletable: boolean

Whether this command should have it's responses deleted if the triggering message is deleted

since

0.5.0

description

description: string | ((language: Language) => string)

The description of the command

since

0.0.1

Readonly directory

directory: string

The base directory this Piece is stored in.

since

0.0.1

Private dm

dm: Colors = new Colors({ background: 'magenta' })

Readonly emitter

emitter: EventEmitter

The emitter this event is for

since

0.0.1

enabled

enabled: boolean

Whether or not the Piece is enabled.

since

0.0.1

Readonly event

event: string

The event to listen for

since

0.0.1

extendedHelp

extendedHelp: string | ((language: Language) => string)

The extended help for the command

since

0.0.1

Readonly file

file: keyof string[]

The file location where this Piece is stored.

since

0.0.1

flagSupport

flagSupport: boolean

Whether to use flag support for this command or not

since

0.2.1

Private Readonly friendlyPerms

friendlyPerms: {} = Object.keys(Permissions.FLAGS).reduce((obj, key) => {Reflect.set(obj, key, toTitleCase(key.split('_').join(' ')));return obj;}, {}) as Record<PermissionsFlags, string>

Type declaration

fullCategory

fullCategory: string[]

The full category for the command

since

0.0.1

guarded

guarded: boolean

Whether this command should not be able to be disabled in a guild or not

since

0.5.0

hidden

hidden: boolean

Whether this command is hidden or not

since

0.5.0

Private Readonly impliedPermissions

impliedPermissions: Permissions = new Permissions(515136).freeze()

language

language: Record<string, LanguageValue> & { DEFAULT: (term: string) => string }

name

name: string

The name of the Piece.

since

0.0.1

nsfw

nsfw: boolean

Whether this command should only run in NSFW channels or not

since

0.5.0

Readonly once

once: boolean

If this event should only be run once and then unloaded

since

0.0.1

permissionLevel

permissionLevel: number

The required permissionLevel to run this command

since

0.0.1

promptLimit

promptLimit: number

The number or attempts allowed for re-prompting an argument

since

0.5.0

promptTime

promptTime: number

The time allowed for re-prompting of this command

since

0.5.0

quotedStringSupport

quotedStringSupport: boolean

Whether to use quoted string support for this command or not

since

0.2.1

Private Readonly regExp

regExp: RegExp = /\\\\?|\//g

Private reprompted

reprompted: Colors[] = [new Colors({ background: 'blue' }), new Colors({ background: 'red' })]

requiredPermissions

requiredPermissions: Permissions

The required bot permissions to run this command

since

0.0.1

requiredSettings

requiredSettings: string[]

The required per guild settings to run this command

since

0.0.1

runIn

runIn: ChannelType[]

What channels the command should run in

since

0.0.1

Private shard

shard: Colors = new Colors({ background: 'cyan', text: 'black' })

Private Readonly slowmode

slowmode: RateLimitManager

spamProtection

spamProtection: boolean

If this inhibitor is meant for spamProtection (disables the inhibitor while generating help)

since

0.0.1

Readonly store

store: Store<Piece>

The store this Piece is from.

since

0.0.1

subcommands

subcommands: boolean

Whether to enable subcommands or not

since

0.5.0

Private text

text: Colors = new Colors({ background: 'green', text: 'black' })

usage

The parsed usage for the command

since

0.0.1

Private user

user: Colors = new Colors({ background: 'yellow', text: 'black' })

Accessors

category

  • get category(): string

Private gateway

path

  • get path(): string
  • The absolute path to this piece

    since

    0.0.1

    Returns string

subCategory

  • get subCategory(): string

type

  • get type(): string
  • The type of piece this is

    since

    0.0.1

    Returns string

Methods

Protected _run

  • _run(message: Message, command: Command, responses: Message[] | undefined, runTime: Stopwatch): Promise<void>
  • Run a finalizer and catch any uncaught promises

    since

    0.5.0

    Parameters

    • message: Message

      The message that called the command

    • command: Command

      The command this finalizer is for (may be different than message.command)

    • responses: Message[] | undefined

      The bot's response message, if one is returned

    • runTime: Stopwatch

      The time it took to generate the command

    Returns Promise<void>

Private buildHelp

  • buildHelp(message: Message): Promise<Record<string, Record<string, string[]>>>

createCustomResolver

  • createCustomResolver(type: string, resolver: (arg: any, possible: Possible, message: Message, args: any[]) => any): this

customizeResponse

  • customizeResponse(name: string, response: string | ((message: Message) => string)): this
  • Customizes the response of an argument if it fails resolution. See tutorial {@link CommandsCustomResponses}

    since

    0.5.0

    chainable
    example

    // Changing the message for a parameter called 'targetUser' this.customizeResponse('targetUser', 'You did not give me a user...');

    // Or also using functions to have multilingual support: this.customizeResponse('targetUser', (message) => message.language.get('COMMAND_REQUIRED_USER_FRIENDLY'));

    Parameters

    • name: string

      The name of the usage argument

    • response: string | ((message: Message) => string)

      The custom response or i18n function

    Returns this

definePrompt

  • definePrompt(usageString: string, usageDelim: string): Usage

disable

  • disable(): this
  • Disables this piece

    since

    0.0.1

    chainable

    Returns this

Private displayEntry

Private displayEntryMultiple

  • displayEntryMultiple(entry: SchemaEntry, values: keyof unknown[], guild: Guild): string

Private displayEntrySingle

Private displayFolder

  • displayFolder(settings: Settings): string

enable

  • enable(): this
  • Enables this piece

    since

    0.0.1

    chainable

    Returns this

Private eval

everything

formatTime

  • formatTime(syncTime: string, asyncTime: string | undefined): string

get

  • get(term: string, ...args: keyof unknown[]): string
  • The method to get language strings

    since

    0.2.1

    Parameters

    • term: string

      The string or function to look up

    • Rest ...args: keyof unknown[]

      Any arguments to pass to the lookup

    Returns string

init

  • init(): unknown
  • The init method to be optionally overwritten in actual pieces

    since

    0.0.1

    Returns unknown

reload

  • reload(): Promise<Piece | null>
  • Reloads this piece

    since

    0.0.1

    Returns Promise<Piece | null>

    The newly loaded piece

remove

  • remove(message: Message, __namedParameters: [string, string]): Promise<Message[]>

reset

  • reset(message: Message, __namedParameters: [string]): Promise<Message[]>

Optional run

  • The run method to be overwritten in actual commands

    since

    0.0.1

    Parameters

    • message: Message

      The command message mapped on top of the message used to trigger this command

    • params: any[]

      The fully resolved parameters based on your usage / usageDelim

    Returns Promise<Message[]>

    You should return the response message whenever possible

set

  • set(message: Message, __namedParameters: [string, string]): Promise<Message[]>

show

  • show(message: Message, __namedParameters: [string]): Promise<Message[]>

toJSON

  • toJSON(): Record<string, any>

toString

  • toString(): string
  • Defines toString behavior for pieces

    since

    0.0.1

    Returns string

    This piece name

Private tryEach

  • tryEach(store: Store<Piece>, path: keyof string[]): Promise<undefined | null | Piece>

unload

  • unload(): boolean
  • Unloads this piece

    since

    0.0.1

    Returns boolean

Generated using TypeDoc