From e0541f777bc3dcb1ec0c0cccf219b9fa66199a2b Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Sat, 19 Feb 2022 13:23:58 -0600 Subject: [PATCH] feat(sern.ts): changing default value of args in text based cmd to string[], from string --- src/handler/sern.ts | 4 ++-- src/types/handler.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/handler/sern.ts b/src/handler/sern.ts index dd30487..587443c 100644 --- a/src/handler/sern.ts +++ b/src/handler/sern.ts @@ -129,7 +129,7 @@ export class Handler { interaction: None, }; const args = message.content.slice(this.prefix.length).trim().split(/s+/g); - const parsedArgs = module.mod.parse?.(context, ['text', args.join(' ')]) ?? Ok(args); + const parsedArgs = module.mod.parse?.(context, ['text', args]) ?? Ok(args); if (parsedArgs.err) return parsedArgs.val; return (await module.mod.execute?.(context, parsedArgs) as possibleOutput | undefined); } @@ -290,7 +290,7 @@ export interface Module { visibility: Visibility; type: CommandType; test: boolean; - execute: (eventParams: Context, args: Ok) => Awaitable; + execute: (eventParams: Context, args: Ok) => Awaitable; parse?: (ctx: Context, args: Arg) => Utils.ArgType; } diff --git a/src/types/handler.ts b/src/types/handler.ts index 062113a..bc6bf79 100644 --- a/src/types/handler.ts +++ b/src/types/handler.ts @@ -26,7 +26,7 @@ export type Context = { interaction: Option; }; -export type Arg = ParseType<{ text: string; slash: SlashOptions }>; +export type Arg = ParseType<{ text: string[]; slash: SlashOptions }>; // TypeAlias for interaction.options export type SlashOptions = Omit;