Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Inhibitor

Base class for all Klasa Inhibitors. See {@tutorial CreatingInhibitors} for more information how to use this class to build custom inhibitors.

tutorial

CreatingInhibitors

Hierarchy

Index

Constructors

constructor

Properties

Readonly client

client: Client

The client this Piece was created with.

since

0.0.1

Readonly directory

directory: string

The base directory this Piece is stored in.

since

0.0.1

enabled

enabled: boolean

Whether or not the Piece is enabled.

since

0.0.1

Readonly file

file: keyof string[]

The file location where this Piece is stored.

since

0.0.1

name

name: string

The name of the Piece.

since

0.0.1

spamProtection

spamProtection: boolean

If this inhibitor is meant for spamProtection (disables the inhibitor while generating help)

since

0.0.1

Readonly store

store: Store<Piece>

The store this Piece is from.

since

0.0.1

Accessors

path

  • get path(): string
  • The absolute path to this piece

    since

    0.0.1

    Returns string

type

  • get type(): string
  • The type of piece this is

    since

    0.0.1

    Returns string

Methods

Protected _run

  • _run(message: Message, command: Command): Promise<boolean | string | void>
  • The async wrapper for running inhibitors

    since

    0.5.0

    Parameters

    • message: Message

      The message that triggered this inhibitor

    • command: Command

      The command to run

    Returns Promise<boolean | string | void>

disable

  • disable(): this
  • Disables this piece

    since

    0.0.1

    chainable

    Returns this

enable

  • enable(): this
  • Enables this piece

    since

    0.0.1

    chainable

    Returns this

init

  • init(): unknown
  • The init method to be optionally overwritten in actual pieces

    since

    0.0.1

    Returns unknown

reload

  • reload(): Promise<Piece | null>
  • Reloads this piece

    since

    0.0.1

    Returns Promise<Piece | null>

    The newly loaded piece

Abstract run

  • run(message: Message, command: Command): boolean | string | void | Promise<boolean | string | void>
  • The run method to be overwritten in actual inhibitors

    since

    0.0.1

    Parameters

    • message: Message

      The message that triggered this inhibitor

    • command: Command

      The command to run

    Returns boolean | string | void | Promise<boolean | string | void>

toJSON

  • toJSON(): Record<string, any>

toString

  • toString(): string
  • Defines toString behavior for pieces

    since

    0.0.1

    Returns string

    This piece name

unload

  • unload(): boolean
  • Unloads this piece

    since

    0.0.1

    Returns boolean

Generated using TypeDoc