sheweny
Version:
The powerful framework for create discord bots
61 lines (60 loc) • 2.16 kB
TypeScript
import { BaseStructure } from './index.js';
import { ShewenyError } from '../helpers/index.js';
import type { ShewenyClient } from '../client/Client.js';
import type { Interaction, Message, ContextMenuCommandInteraction, CommandInteraction } from 'discord.js';
import type { Awaitable, InhibitorType, InhibitorData } from '../typescript/index.js';
/**
* Represents an Command structure
* @extends {BaseStructure}
*/
export declare abstract class Inhibitor extends BaseStructure {
/**
* Name of a inhibitor
* @type {string}
*/
name: string;
/**
* Priority of a inhibitor
* @type {number}
*/
priority: number;
/**
* Type(s) of a inhibitor
* @type {InhibitorType[]}
*/
type: InhibitorType[];
/**
* Constructor for build a Inhibitor
* @param {ShewenyClient} [client] Client framework
* @param {string} [name] Name of the event
* @param {InhibitorData | undefined} [options] Options of the inhibitor
*/
constructor(client: ShewenyClient, name: string, options?: InhibitorData);
/**
* Main function `execute` for the inhibitors
* @param {any[]} args Button interaction
* @returns: Awaitable<unknown>}
*/
abstract execute(structure: BaseStructure, ctx: Interaction | ContextMenuCommandInteraction | CommandInteraction | Message): Awaitable<unknown>;
/**
* This function is executed when the main `execute` function has failed
* @param {any[]} args Arguments
* @returns: Awaitable<unknown>}
*/
abstract onFailure(structure: BaseStructure, ctx: Interaction | ContextMenuCommandInteraction | CommandInteraction | Message): Awaitable<unknown>;
/**
* Register an inhibitor in collections
* @returns {Promise<Inhibitor | ShewenyError>} The loaded inhibitor
*/
register(): Promise<Inhibitor | ShewenyError>;
/**
* Reload the inhibitor
* @returns {Promise<Inhibitor | ShewenyError>} The loaded inhibitor
*/
reload(): Promise<Inhibitor | ShewenyError>;
/**
* Unregister the inhibitor from cache
* @returns {boolean}
*/
unregister(): boolean;
}