UNPKG

sheweny

Version:

The powerful framework for create discord bots

56 lines (55 loc) 1.87 kB
import { BaseStructure } from './BaseStructure.js'; import { ShewenyError } from '../helpers/index.js'; import type { ShewenyClient } from '../client/Client.js'; import type { ModalSubmitInteraction } from 'discord.js'; import type { Awaitable, ModalData, CustomId } from '../typescript/index.js'; /** * Represents an Modal structure * @extends {BaseStructure} */ export declare abstract class Modal extends BaseStructure { /** * Cooldown of a button in seconds * @type {number} */ cooldown: number; /** * Custom id for one or more modals * @type {CustomId} */ customId: CustomId; /** * Constructor to build a Modal * @param {ShewenyClient} [client] Client framework * @param {CustomId} [customId] Custom id for one or more modals * @param {ModalData | undefined} [options] The options of the modal */ constructor(client: ShewenyClient, customId: CustomId, options?: ModalData); /** * This function is executed before executing the `execute` function * @param {ModalSubmitInteraction} interaction Modal interaction * @returns {any | Promise<any>} */ before?(interaction: ModalSubmitInteraction): Awaitable<unknown>; /** * Main function `execute` for the modals * @param {ModalSubmitInteraction} interaction Modal interaction * @returns {any | Promise<any>} */ abstract execute(interaction: ModalSubmitInteraction): Awaitable<unknown>; /** * Register a modal in collections * @returns {Promise<Modal | ShewenyError>} */ register(): Promise<Modal | ShewenyError>; /** * Reload a modal * @returns {Promise<Modal> | ShewenyError>} */ reload(): Promise<Modal | ShewenyError>; /** * Unregister a modal from collections * @returns {boolean} */ unregister(): boolean; }