UNPKG

sheweny

Version:

The powerful framework for create discord bots

68 lines 2.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ModalsManager = 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 Modals */ class ModalsManager extends index_js_2.BaseManager { /** * Constructor to manage modals * @param {ShewenyClient} [client] Client framework * @param {boolean} [options] The options of the manager */ constructor(client, options) { super(client, options); /** * Default data for the buttons * @type {ModalsManagerDefaultOptions} */ Object.defineProperty(this, "default", { enumerable: true, configurable: true, writable: true, value: void 0 }); /** * Collection of modals * @type {Collection<CustomId, Modal> | undefined} */ Object.defineProperty(this, "modals", { enumerable: true, configurable: true, writable: true, value: void 0 }); this.default = { cooldown: options.default?.cooldown || 0, }; } /** * Load all modals in collection * @returns {Promise<Collection<CustomId, Modal> | undefined>} */ async loadAll() { const loader = new Loader_js_1.Loader(this.client, this.directory, 'customId', { manager: this, instance: index_js_3.Modal, asyncRead: this.asyncRead, }); this.modals = await loader.load(); new index_js_1.ShewenyInformation(this.client, `- Modals loaded : ${this.modals.size}`); return this.modals; } /** * Unload all modals * @returns {void} */ unloadAll() { this.modals = new discord_js_1.Collection(); this.client.collections.modals.clear(); } } exports.ModalsManager = ModalsManager; //# sourceMappingURL=ModalsManager.js.map