UNPKG

discord-module-loader

Version:

A package that lets you load events and commands easily and fast.

35 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const discord_js_1 = require("discord.js"); class DiscordModule { constructor(name, callback, options) { this.name = name; this.callback = callback; this.disabled = false; this.events = new discord_js_1.Collection(); this.commands = new discord_js_1.Collection(); this.modules = new discord_js_1.Collection(); if (options === null || options === void 0 ? void 0 : options.disabled) this.disable(); } enable() { this.disabled = false; for (const event of this.events.values()) event.enable(); for (const command of this.commands.values()) command.enable(); for (const module of this.modules.values()) module.enable(); } disable() { this.disabled = true; for (const event of this.events.values()) event.disable(); for (const command of this.commands.values()) command.disable(); for (const module of this.modules.values()) module.disable(); } } exports.default = DiscordModule; //# sourceMappingURL=DiscordModule.js.map