Class: Event

Event

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

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

Parameters:
Name Type Argument Default Description
client KlasaClient The klasa client
dir string The path to the core or user event pieces folder
file string The path from the pieces folder to the event file
options EventOptions <optional>
{} The Event options
Since:
  • 0.0.1
Implements:
Source:
lib/structures/Event.js#L25
Tutorials:

Properties


client :KlasaClient

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

dir :string

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

enabled :boolean

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

file :string

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

name :string

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

type :string

The type of Klasa piece this is
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Event.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 events
Since:
  • 0.0.1
Source:
lib/structures/Event.js#L96
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(param)

The run method to be overwritten in actual event handlers
Parameters:
Name Type Description
param any The event parameters emited
Since:
  • 0.0.1
Source:
lib/structures/Event.js#L86
Returns:
Type
void

unload()

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

Type Definitions


EventOptions

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