UNPKG

commandbot

Version:

A framework that helps you create your own Discord bot easier.

50 lines (49 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StateManager = void 0; /** * Holds global state variables responsible for application life cycle * @class */ class StateManager { constructor() { /** * Whether the bot is up and running * @type {boolean} * @private */ this._isRunning = false; /** * Whether this version of CommandBot is an unstable release * @type {boolean} * @private * @readonly */ this._unstable = false; } /** * Whether the bot is running * @type {boolean} */ get running() { return this._isRunning; } /** * _unstable property getter * @type {boolean} */ get dev() { return this._unstable; } /** * Setter for running state * @remarks * Once set to true, it cannnot be switched back to *false* until the application restart or crash */ set running(bool) { if (!this._isRunning) { this._isRunning = bool; } } } exports.StateManager = StateManager;