advanced-command-handler
Version:
A package to help you create a bot with only 1 main file, directories for your events/commands, with some helpers classes and functions.
33 lines (32 loc) • 1.1 kB
TypeScript
import type { ClientEvents } from 'discord.js';
import { AdvancedClient } from './AdvancedClient';
import { EventContext } from './contexts';
/**
* @see {@link https://ayfri.gitbook.io/advanced-command-handler/concepts/events}
*/
export declare abstract class Event {
/**
* The name of the event.
*/
abstract readonly name: keyof ClientEvents & string;
/**
* If the event should be fired only once.
*/
once: boolean;
/**
* The run function, executed when the event is fired.
*/
abstract run(ctx: EventContext<this>, ...args: ClientEvents[this['name']] | undefined[]): any | Promise<any>;
/**
* Bind the event to the client, when the `something` event from {@link AdvancedClient} will be fire, this event will be also fired.
*
* @param client - The client to bind the event from.
*/
bind(client: AdvancedClient): void;
/**
* Unbinds the event to the client.
*
* @param client - The client to unbind the event from.
*/
unbind(client: AdvancedClient): void;
}