sheweny
Version:
The powerful framework for create discord bots
68 lines • 2.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectMenusManager = 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 Select Menus
*/
class SelectMenusManager extends index_js_2.BaseManager {
/**
* Constructor to manage select menus
* @param {ShewenyClient} [client] Client framework
* @param {SelectMenusManagerOptions} [options] The options of the manager
*/
constructor(client, options) {
super(client, options);
/**
* Default data for the buttons
* @type {SelectMenusManagerDefaultOptions}
*/
Object.defineProperty(this, "default", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
/**
* Collection of the select menus
* @type {Collection<CustomId, SelectMenu[]> | undefined}
*/
Object.defineProperty(this, "selectMenus", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.default = {
cooldown: options.default?.cooldown || 0,
};
}
/**
* Load all select menus in collection
* @returns {Promise<Collection<string[], SelectMenu[]> | undefined>}
*/
async loadAll() {
const loader = new Loader_js_1.Loader(this.client, this.directory, 'customId', {
manager: this,
instance: index_js_3.SelectMenu,
asyncRead: this.asyncRead,
});
this.selectMenus = await loader.load();
new index_js_1.ShewenyInformation(this.client, `- Select-menus loaded : ${this.selectMenus.size}`);
return this.selectMenus;
}
/**
* Unload all selectMenus
* @returns {void}
*/
unloadAll() {
this.selectMenus = new discord_js_1.Collection();
this.client.collections.selectMenus.clear();
}
}
exports.SelectMenusManager = SelectMenusManager;
//# sourceMappingURL=SelectMenusManager.js.map