Class: EventStore

EventStore

Stores all the events that a part of Klasa

new EventStore(client)

Constructs our EventStore for use in Klasa
Parameters:
Name Type Description
client KlasaClient The klasa client initializing this store.
Since:
  • 0.0.1
Implements:
Source:
lib/structures/EventStore.js#L18

Extends

Properties


<readonly> client :KlasaClient

The client this EventStore was creaated with.
Type:
Since:
  • 0.0.1
Source:
lib/structures/EventStore.js#L21

coreDir :String

The directory of events in Klasa relative to where its installled.
Type:
  • String
Since:
  • 0.0.1
Source:
lib/structures/EventStore.js#L35

holds :Event

The type of structure this store holds
Type:
Since:
  • 0.1.1
Source:
lib/structures/EventStore.js#L49

name :String

The name of what this holds
Type:
  • String
Since:
  • 0.3.0
Source:
lib/structures/EventStore.js#L56

userDir :String

The directory of local events relative to where you run Klasa from.
Type:
  • String
Since:
  • 0.0.1
Source:
lib/structures/EventStore.js#L42

Methods


clear()

Clears the events from the store and removes the listeners.
Since:
  • 0.0.1
Source:
lib/structures/EventStore.js#L64
Returns:
Type
void

delete(name)

Deletes an event from the store.
Parameters:
Name Type Description
name Event | string An event object or a string representing the event name.
Since:
  • 0.0.1
Source:
lib/structures/EventStore.js#L74
Returns:
whether or not the delete was successful.
Type
boolean

init()

Initializes all pieces in this store.
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Store.js#L22
Returns:
Type
Array

load(dir, file)

Loads a piece into Klasa so it can be saved in this store.
Parameters:
Name Type Description
dir string The user directory or core directory where this file is saved.
file string | Array.<string> A string or array of strings showing where the file is located.
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Store.js#L33
Returns:
Type
Piece

<async> loadAll()

Loads all of our pieces from both the user and core directories.
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Store.js#L51
Returns:
The number of pieces loaded.
Type
number

resolve(name)

Resolve a string or piece into a piece object.
Parameters:
Name Type Description
name Piece | string The piece object or a string representing a piece's name
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Store.js#L68
Returns:
Type
Piece

set(event)

Sets up an event in our store.
Parameters:
Name Type Description
event Event The event object we are setting up.
Since:
  • 0.0.1
Source:
lib/structures/EventStore.js#L88
Returns:
Type
Event