feat(sern.ts): changing default value of args in text based cmd to string[], from string

This commit is contained in:
Jacob Nguyen
2022-02-19 13:23:58 -06:00
parent b11f999674
commit e0541f777b
2 changed files with 3 additions and 3 deletions

View File

@@ -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<T = string> {
visibility: Visibility;
type: CommandType;
test: boolean;
execute: (eventParams: Context, args: Ok<T>) => Awaitable<possibleOutput| void>;
execute: (eventParams: Context, args: Ok<T>) => Awaitable<possibleOutput | void>;
parse?: (ctx: Context, args: Arg) => Utils.ArgType<T>;
}

View File

@@ -26,7 +26,7 @@ export type Context = {
interaction: Option<CommandInteraction>;
};
export type Arg = ParseType<{ text: string; slash: SlashOptions }>;
export type Arg = ParseType<{ text: string[]; slash: SlashOptions }>;
// TypeAlias for interaction.options
export type SlashOptions = Omit<CommandInteractionOptionResolver, 'getMessage' | 'getFocused'>;