Class: Monitor

Monitor

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

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

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

Properties


client :KlasaClient

Type:
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L33

dir :string

The directory to where this monitor piece is stored
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L40

enabled :boolean

If the monitor is enabled or not
Type:
  • boolean
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L68

file :string

The file location where this monitor is stored
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L47

ignoreBots :boolean

Whether the monitor ignores bots or not
Type:
  • boolean
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L75

ignoreOthers :boolean

Whether the monitor ignores others or not
Type:
  • boolean
Since:
  • 0.4.0
Source:
lib/structures/Monitor.js#L89

ignoreSelf :boolean

Whether the monitor ignores itself or not
Type:
  • boolean
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L82

name :string

The name of the monitor
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L54

type :string

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

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 monitor pieces
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L109
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)

The run method to be overwritten in actual monitor pieces
Parameters:
Name Type Description
msg external:Message The discord message
Since:
  • 0.0.1
Source:
lib/structures/Monitor.js#L99
Returns:
Type
void

unload()

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

Type Definitions


MonitorOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
name string <optional>
theFileName The name of the monitor
enabled boolean <optional>
true Whether the monitor is enabled or not
ignoreBots boolean <optional>
true Whether the monitor ignores bots or not
ignoreSelf boolean <optional>
true Whether the monitor ignores itself or not
ignoreOthers boolean <optional>
true Whether the monitor ignores others or not
Source:
lib/structures/Monitor.js#L11