diff --git a/src/handler/events/readyEvent.ts b/src/handler/events/readyEvent.ts index a728ed3..e9c0e78 100644 --- a/src/handler/events/readyEvent.ts +++ b/src/handler/events/readyEvent.ts @@ -50,6 +50,7 @@ export const onReady = (wrapper: Wrapper) => { return { ...plug, name: plug?.name ?? 'Unnamed Plugin', + description: plug?.description ?? '...', execute: plug.execute(client, mod, controller), }; }) ?? []; @@ -59,7 +60,7 @@ export const onReady = (wrapper: Wrapper) => { ( concat(ready$, processPlugins$) as Observable<{ - mod: DefinitelyDefined; + mod: DefinitelyDefined; cmdPluginsRes: { execute: Awaitable>; type: PluginType.Command; @@ -99,7 +100,9 @@ export const onReady = (wrapper: Wrapper) => { }); }; -function registerModule(mod: DefinitelyDefined): Result { +function registerModule( + mod: DefinitelyDefined, +): Result { const name = mod.name; return match(mod) .with({ type: CommandType.Text }, mod => { diff --git a/src/handler/plugins/plugin.ts b/src/handler/plugins/plugin.ts index 27a815c..387eb8f 100644 --- a/src/handler/plugins/plugin.ts +++ b/src/handler/plugins/plugin.ts @@ -13,7 +13,7 @@ import type { Awaitable, Client } from 'discord.js'; import type { Err, Ok, Result } from 'ts-results'; -import type { Module, Override } from '../..'; +import type { DefinitelyDefined, Module, Override } from '../..'; import { CommandType } from '../..'; import type { AutocompleteCommand, BaseModule, ModuleDefs } from '../structures/module'; import { PluginType } from '../structures/enums'; @@ -37,7 +37,7 @@ export type CommandPlugin = { type: PluginType.Command; execute: ( wrapper: Client, - module: ModuleDefs[T], + module: DefinitelyDefined, controller: Controller, ) => Awaitable>; } @@ -63,7 +63,7 @@ export type EventPlugin = { // return plug; // } -type ModuleNoPlugins = { +export type ModuleNoPlugins = { [T in keyof ModuleDefs]: Omit; }; diff --git a/src/handler/structures/wrapper.ts b/src/handler/structures/wrapper.ts index d38e238..2343940 100644 --- a/src/handler/structures/wrapper.ts +++ b/src/handler/structures/wrapper.ts @@ -6,6 +6,7 @@ import type SernEmitter from '../sernEmitter'; * An object to be passed into Sern.Handler constructor. * @typedef {object} Wrapper * @property {readonly Client} client + * @prop { readonly SernEmitter } sernEmitter * @property {readonly string} defaultPrefix * @property {readonly string} commands * @prop { readonly DiscordEvent[] } events diff --git a/src/types/handler.ts b/src/types/handler.ts index 2c40816..439d61b 100644 --- a/src/types/handler.ts +++ b/src/types/handler.ts @@ -28,7 +28,11 @@ export type SlashOptions = Omit = Omit & T2; -export type DefinitelyDefined = T & Override; +export type DefinitelyDefined = { + [L in K]-?: T[L] extends Record + ? DefinitelyDefined + : Required[L]; +} & T; type Reconstruct = T extends Omit ? O & Reconstruct : T;