Class: Inhibitor

Inhibitor

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

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

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

Properties


client :KlasaClient

Type:
Since:
  • 0.0.1
Source:
lib/structures/Inhibitor.js#L31

dir :string

The directory to where this inhibitor piece is stored
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Inhibitor.js#L38

enabled :boolean

If the inhibitor is enabled or not
Type:
  • boolean
Since:
  • 0.0.1
Source:
lib/structures/Inhibitor.js#L66

file :string

The file location where this inhibitor is stored
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Inhibitor.js#L45

name :string

The name of the inhibitor
Type:
  • string
Since:
  • 0.0.1
Source:
lib/structures/Inhibitor.js#L52

spamProtection :boolean

If this inhibitor is meant for spamProtection (disables the inhibitor while generating help)
Type:
  • boolean
Since:
  • 0.0.1
Source:
lib/structures/Inhibitor.js#L73

type :string

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

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 inhibitors
Since:
  • 0.0.1
Source:
lib/structures/Inhibitor.js#L94
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, cmd)

The run method to be overwritten in actual inhibitors
Parameters:
Name Type Description
msg external:Message The message that triggered this inhibitor
cmd Command The command to run
Since:
  • 0.0.1
Source:
lib/structures/Inhibitor.js#L84
Returns:
Type
void | string

unload()

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

Type Definitions


InhibitorOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
name string <optional>
theFileName The name of the inhibitor
enabled boolean <optional>
true Whether the inhibitor is enabled or not
spamProtection boolean <optional>
false If this inhibitor is meant for spamProtection (disables the inhibitor while generating help)
Source:
lib/structures/Inhibitor.js#L11