/** * Quetza's base type declarations. * * @see Architecture documentation for more understanding of its purpose. */ import { ApplicationCommandData, CommandInteraction, If } from "discord.js"; import Client from "$lib/client.js"; /** * Quetza's module declaration. * * @public */ export interface ModuleBase { /** Name of a module. */ name: string; /** Description of a module. */ description: string; /** Module controller. */ controller?: unknown; } /** * Complete {@link ModuleBase} declaration with commands and events. * * @public */ export interface Module extends ModuleBase { /** Module's commands. */ commands: CommandBase[]; /** Module's events. */ events: EventBase[]; } /** * Quetza's command interaction declaration. * * @public */ export interface CommandBase { /** Command metadata that will be passed to the Discord API. */ data: ApplicationCommandData; /** Function that will be executed upon invoking this interaction. */ execute: ( client: Client, interaction: CommandInteraction, controller?: unknown ) => Promise; } /** * {@link ModuleBase} with {@link Module} included. * * @public */ export interface Command extends CommandBase { /** Module containing this Command. */ module: Module; } /** * Quetza's event declaration. * * @public */ export interface EventBase { /** Name of an event to listen. */ name: string; /** Function that will be executed upon event emitting. */ execute: (client: Client, eventee: unknown[], controller?: unknown) => Promise; } /** * {@link EventBase} with {@link Module} included. * * @public */ export interface Event extends EventBase { /** Module containing this Event. */ module: ModuleBase; } /** * Application status provides information that may be useful at initialization. * * @public */ export interface ApplicationStatus { /** Discord's ID of an application. */ applicationId: If; /** Tag of a bot user. */ tag: If; /** List of each module imported. */ modules: Module[]; }