sheweny
Version:
The powerful framework for create discord bots
69 lines • 2.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InhibitorsManager = void 0;
const Loader_js_1 = require("../utils/Loader.js");
const index_js_1 = require("../helpers/index.js");
const index_js_2 = require("./index.js");
const index_js_3 = require("../structures/index.js");
const discord_js_1 = require("discord.js");
/**
* Manager for Inhibitors
*/
class InhibitorsManager extends index_js_2.BaseManager {
/**
* Constructor to manage inhibitors
* @param {ShewenyClient} [client] Client framework
* @param {boolean} [options] The options of the manager
*/
constructor(client, options) {
super(client, options);
/**
* Default data for the inhibitors
* @type {InhibitorsManagerDefaultOptions}
*/
Object.defineProperty(this, "default", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
/**
* Collection of the inhibitors
* @type {Collection<string, Inhibitor[]> | undefined}
*/
Object.defineProperty(this, "inhibitors", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.default = {
priority: options.default?.priority,
type: options.default?.type,
};
}
/**
* Load all inhibitors in collection
* @returns {Promise<Collection<string, Inhibitor[]> | undefined>}
*/
async loadAll() {
const loader = new Loader_js_1.Loader(this.client, this.directory, 'name', {
manager: this,
instance: index_js_3.Inhibitor,
asyncRead: this.asyncRead,
});
this.inhibitors = await loader.load();
new index_js_1.ShewenyInformation(this.client, `- Inhibitors loaded : ${this.inhibitors.size}`);
return this.inhibitors;
}
/**
* Unload all inhibitors
* @returns {void}
*/
unloadAll() {
this.inhibitors = new discord_js_1.Collection();
this.client.collections.inhibitors.clear();
}
}
exports.InhibitorsManager = InhibitorsManager;
//# sourceMappingURL=InhibitorsManager.js.map