Skip to content

Commit

Permalink
feat(sern.ts): changing default value of args in text based cmd to st…
Browse files Browse the repository at this point in the history
…ring[], from string
  • Loading branch information
jacoobes committed Feb 19, 2022
1 parent b11f999 commit 1397974
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/handler/sern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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>;
}

Expand Down
2 changes: 1 addition & 1 deletion src/types/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'>;

0 comments on commit 1397974

Please sign in to comment.