Class: Provider

Provider

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

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

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

Properties


client :KlasaClient

Type:
Since:
  • 0.0.1
Source:
lib/structures/Provider.js#L32

description :string

The description of the provider
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Provider.js#L74

dir :string

The directory to where this provider piece is stored
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Provider.js#L39

enabled :boolean

If the provider is enabled or not
Type:
  • boolean
Since:
  • 0.0.1
Source:
lib/structures/Provider.js#L67

file :string

The file location where this provider is stored
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Provider.js#L46

name :string

The name of the provider
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Provider.js#L53

sql :boolean

If the provider provides to a sql datasource
Type:
  • boolean
Since:
  • 0.0.1
Source:
lib/structures/Provider.js#L81

type :string

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

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 provider pieces
Since:
  • 0.0.1
Source:
lib/structures/Provider.js#L90
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

<async, abstract> shutdown()

The shutdown method to be optionaly overwritten in actual provider pieces
Since:
  • 0.3.0
Source:
lib/structures/Provider.js#L100
Returns:
Type
void

unload()

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

Type Definitions


ProviderOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
name string <optional>
theFileName The name of the provider
enabled boolean <optional>
true Whether the provider is enabled or not
description string <optional>
'' The provider description
sql boolean <optional>
false If the provider provides to a sql datasource
Source:
lib/structures/Provider.js#L11