UNPKG

commandbot

Version:

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

44 lines (43 loc) 973 B
/** * Holds global state variables responsible for application life cycle * @class */ export class StateManager { /** * Whether the bot is up and running * @type {boolean} * @private */ _isRunning = false; /** * Whether this version of CommandBot is an unstable release * @type {boolean} * @private * @readonly */ _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; } } }