Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Action<T, S>

The common class for all actions.

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

Readonly Private #listener

#listener: Event["run"]

Stored bound on method, so it can be properly unlistened to later

since

0.0.1

Readonly client

client: Client

The client this Piece was created with.

since

0.0.1

Readonly clientEvent

clientEvent: string

The name of the event that the Client will fire.

since

0.0.1

Readonly directory

directory: string

The base directory this Piece is stored in.

since

0.0.1

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

Readonly file

file: keyof string[]

The file location where this Piece is stored.

since

0.0.1

name

name: string

The name of the Piece.

since

0.0.1

Readonly once

once: boolean

If this event should only be run once and then unloaded

since

0.0.1

Readonly store

store: Store<Piece>

The store this Piece is from.

since

0.0.1

Accessors

path

  • get path(): string

type

  • get type(): string

Methods

Abstract build

  • build(data: T): S | null
  • Builds the structure from raw data.

    Parameters

    • data: T

      The raw data from {@link Client#ws}

    Returns S | null

Abstract cache

  • cache(data: S): void
  • Stores the data into the cache.

    Parameters

    • data: S

      The build structure from {@link Action#build} to be cached

    Returns void

Abstract check

  • check(data: T): S | null
  • Checks whether or not the data structure was already cached, returning it if it was.

    since

    0.0.1

    Parameters

    • data: T

      The raw data from {@link Client#ws}

    Returns S | null

disable

  • disable(): this

enable

  • enable(): this

init

  • init(): unknown

reload

  • reload(): Promise<Piece | null>

run

  • run(data: T): unknown
  • Processes the event data from the websocket.

    since

    0.0.1

    Parameters

    • data: T

      The raw data from {@link Client#ws}

    Returns unknown

toJSON

  • toJSON(): Record<string, unknown>

toString

  • toString(): string

unload

  • unload(): boolean

Generated using TypeDoc