feat: make description optional, default is '...'

This commit is contained in:
Jacob Nguyen
2022-06-05 13:58:09 -05:00
parent d4ac129b05
commit df2a92cac2
2 changed files with 7 additions and 7 deletions

View File

@@ -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<Module, { name: string }>;
mod: DefinitelyDefined<Module, { name: string; description: string }>;
cmdPluginsRes: {
execute: Awaitable<Result<void, void>>;
type: PluginType.Command;

View File

@@ -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<void | unknown>;
}