import { CommandInteractionOptionResolver } from 'discord.js'; import { PayloadType } from '../core'; import { AnyModule } from './core-modules'; export type Awaitable = PromiseLike | T; export type AnyFunction = (...args: unknown[]) => unknown; // Thanks to @kelsny type ParseType = { [K in keyof T]: T[K] extends unknown ? [k: K, args: T[K]] : never; }[keyof T]; export type SlashOptions = Omit; export type Args = ParseType<{ text: string[]; slash: SlashOptions }>; export interface SernEventsMapping { 'module.register': [Payload]; 'module.activate': [Payload]; error: [Payload]; warning: [Payload]; modulesLoaded: [never?]; } export type Payload = | { type: PayloadType.Success; module: AnyModule } | { type: PayloadType.Failure; module?: AnyModule; reason: string | Error } | { type: PayloadType.Warning; reason: string };