Class: Finalizer

Finalizer

Base class for all Klasa Finalizers. See Creating Finalizers for more information how to use this class to build custom finalizers.

new Finalizer(client, dir, file [, options])

Parameters:
Name Type Argument Default Description
client KlasaClient The Klasa Client
dir string The path to the core or user finalizer pieces folder
file string The path from the pieces folder to the finalizer file
options FinalizerOptions <optional>
{} Optional Finalizer settings
Since:
  • 0.0.1
Implements:
Source:
lib/structures/Finalizer.js#L25
Tutorials:

Properties


client :KlasaClient

Type:
Since:
  • 0.0.1
Source:
lib/structures/Finalizer.js#L30

dir :string

The directory to where this finalizer piece is stored
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Finalizer.js#L37

enabled :boolean

If the finalizer is enabled or not
Type:
  • boolean
Since:
  • 0.0.1
Source:
lib/structures/Finalizer.js#L65

file :string

The file location where this finalizer is stored
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Finalizer.js#L44

name :string

The name of the finalizer
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Finalizer.js#L51

type :string

The type of Klasa piece this is
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Finalizer.js#L58

Methods


disable()

Disables this piece
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Piece.js#L43
Returns:
This piece
Type
Piece

enable()

Enables this piece
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Piece.js#L54
Returns:
This piece
Type
Piece

<async, abstract> init()

The init method to be optionaly overwritten in actual finalizers
Since:
  • 0.0.1
Source:
lib/structures/Finalizer.js#L87
Returns:
Type
void

<async> reload()

Reloads this piece
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Piece.js#L21
Returns:
The newly loaded piece
Type
Piece

<abstract> run(msg, mes, start)

The run method to be overwritten in actual finalizers
Parameters:
Name Type Description
msg CommandMessage The command message mapped on top of the message used to trigger this finalizer
mes external:Message The bot's response message, if one is returned
start number The performance now start time including all command overhead
Since:
  • 0.0.1
Source:
lib/structures/Finalizer.js#L77
Returns:
Type
void

unload()

Unloads this piece
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Piece.js#L33
Returns:
Type
void

Type Definitions


FinalizerOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
name string <optional>
theFileName The name of the finalizer
enabled boolean <optional>
true Whether the finalizer is enabled or not
Source:
lib/structures/Finalizer.js#L11