diff --git a/src/interactions/contextMenuCommands/Assertions.ts b/src/interactions/contextMenuCommands/Assertions.ts index 5a22e2f3..b0ad273d 100644 --- a/src/interactions/contextMenuCommands/Assertions.ts +++ b/src/interactions/contextMenuCommands/Assertions.ts @@ -11,10 +11,10 @@ export function validateRequiredParameters(name: string, type: number) { } const namePredicate = z - .string() + .string({ required_error: 'Name must be provided' }) .min(1) .max(32) - .regex(/^( *[\p{L}\p{N}_-]+ *)+$/u); + .regex(/^( *[\p{L}\p{N}_-]+ *)+$/u, 'Name must match /^( *[\\p{L}\\p{N}_-]+ *)+$/u'); export function validateName(name: unknown): asserts name is string { namePredicate.parse(name); diff --git a/src/interactions/slashCommands/Assertions.ts b/src/interactions/slashCommands/Assertions.ts index 24f2240e..3da05521 100644 --- a/src/interactions/slashCommands/Assertions.ts +++ b/src/interactions/slashCommands/Assertions.ts @@ -21,16 +21,16 @@ export function validateRequiredParameters( } const namePredicate = z - .string() + .string({ required_error: 'Name must be provided' }) .min(1) .max(32) - .regex(/^[\P{Lu}\p{N}_-]+$/u); + .regex(/^[\P{Lu}\p{N}_-]+$/u, 'Name must match /^[\\P{Lu}\\p{N}_-]+$/u'); export function validateName(name: unknown): asserts name is string { namePredicate.parse(name); } -const descriptionPredicate = z.string().min(1).max(100); +const descriptionPredicate = z.string({ required_error: 'Description must be provided' }).min(1).max(100); export function validateDescription(description: unknown): asserts description is string { descriptionPredicate.parse(description);