From df2a92cac27f33a7ac13d9e849b29664b1ee999b Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Sun, 5 Jun 2022 13:58:09 -0500 Subject: [PATCH] feat: make description optional, default is '...' --- src/handler/events/readyEvent.ts | 12 ++++++------ src/handler/structures/module.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/handler/events/readyEvent.ts b/src/handler/events/readyEvent.ts index 224a2ae..a728ed3 100644 --- a/src/handler/events/readyEvent.ts +++ b/src/handler/events/readyEvent.ts @@ -29,11 +29,11 @@ export const onReady = (wrapper: Wrapper) => { const ready$ = fromEvent(client, 'ready').pipe(take(1), skip(1)); const processCommandFiles$ = Files.buildData(commands).pipe( map(({ mod, absPath }) => { - if (mod?.name === undefined) { - const name = Files.fmtFileName(basename(absPath)); - return { name, ...mod }; - } - return mod; + return { + name: mod?.name ?? Files.fmtFileName(basename(absPath)), + description: mod?.description ?? '...', + ...mod, + }; }), ); const processPlugins$ = processCommandFiles$.pipe( @@ -59,7 +59,7 @@ export const onReady = (wrapper: Wrapper) => { ( concat(ready$, processPlugins$) as Observable<{ - mod: DefinitelyDefined; + mod: DefinitelyDefined; cmdPluginsRes: { execute: Awaitable>; type: PluginType.Command; diff --git a/src/handler/structures/module.ts b/src/handler/structures/module.ts index 5afc91c..b28a973 100644 --- a/src/handler/structures/module.ts +++ b/src/handler/structures/module.ts @@ -25,7 +25,7 @@ import type { ApplicationCommandOptionType } from 'discord.js'; export interface BaseModule { type: CommandType | PluginType; name?: string; - description: string; + description?: string; execute: (ctx: Context, args: Args) => Awaitable; }