diff --git a/src/handler/events/readyEvent.ts b/src/handler/events/readyEvent.ts index 61217c8..c1bb14c 100644 --- a/src/handler/events/readyEvent.ts +++ b/src/handler/events/readyEvent.ts @@ -11,7 +11,7 @@ import { match } from 'ts-pattern'; import { ApplicationCommandType, ComponentType } from 'discord.js'; import { Err, Ok } from 'ts-results'; import { SernError } from '../structures/errors'; -import type { DefinetlyDefined, Override } from '../../types/handler'; +import type { DefinitelyDefined } from '../../types/handler'; export const onReady = (wrapper: Wrapper) => { const { client, commands } = wrapper; @@ -40,7 +40,7 @@ export const onReady = (wrapper: Wrapper) => { ( concat(ready$, processPlugins$) as Observable<{ - mod: DefinetlyDefined; + mod: DefinitelyDefined; cmdPluginsRes: { execute: Awaitable>; type: PluginType.Command; @@ -70,11 +70,11 @@ export const onReady = (wrapper: Wrapper) => { }); }; -function registerModule(mod: DefinetlyDefined) : Result { +function registerModule(mod: DefinitelyDefined) : Result { const name = mod.name; return match(mod) .with({ type: CommandType.Text }, mod => { - mod.alias.forEach(a => Files.TextCommands.aliases.set(a, mod)); + mod.alias?.forEach(a => Files.TextCommands.aliases.set(a, mod)); Files.TextCommands.text.set(name, mod); return Ok.EMPTY; }) @@ -84,7 +84,7 @@ function registerModule(mod: DefinetlyDefined) : Resul }) .with({ type: CommandType.Both }, mod => { Files.BothCommands.set(name, mod); - mod.alias.forEach(a => Files.TextCommands.aliases.set(a, mod)); + mod.alias?.forEach(a => Files.TextCommands.aliases.set(a, mod)); return Ok.EMPTY; }) .with({ type: CommandType.MenuUser }, mod => { diff --git a/src/handler/structures/module.ts b/src/handler/structures/module.ts index 26f932b..ac84611 100644 --- a/src/handler/structures/module.ts +++ b/src/handler/structures/module.ts @@ -23,7 +23,7 @@ export type TextCommand = { type: CommandType.Text; onEvent: EventPlugin[]; plugins: CommandPlugin[]; - alias: string[] | []; + alias?: string[]; } & BaseModule; export type SlashCommand = { @@ -37,7 +37,7 @@ export type BothCommand = { type: CommandType.Both; onEvent: EventPlugin[] plugins: CommandPlugin[] - alias: string[] | []; + alias?: string[]; options: ApplicationCommandOptionData[] | []; } & BaseModule; diff --git a/src/types/handler.ts b/src/types/handler.ts index 487d590..893386d 100644 --- a/src/types/handler.ts +++ b/src/types/handler.ts @@ -31,4 +31,4 @@ export type UnionToTuple = T extends readonly [infer V, infer S] : never : never; -export type DefinetlyDefined = T & Override \ No newline at end of file +export type DefinitelyDefined = T & Override \ No newline at end of file