chore: update the regex for command names/option names (#7733)

This commit is contained in:
Vlad Frangu
2022-04-12 18:16:08 +03:00
committed by GitHub
parent 78a3afcd7f
commit 3582fe917d
2 changed files with 2 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ import type { ContextMenuCommandType } from './ContextMenuCommandBuilder';
const namePredicate = s.string
.lengthGe(1)
.lengthLe(32)
.regex(/^( *[\p{L}\p{N}_-]+ *)+$/u);
.regex(/^( *[\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+ *)+$/u);
const typePredicate = s.union(s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message));

View File

@@ -8,7 +8,7 @@ import type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder
const namePredicate = s.string
.lengthGe(1)
.lengthLe(32)
.regex(/^[\P{Lu}\p{N}_-]+$/u);
.regex(/^[\P{Lu}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
export function validateName(name: unknown): asserts name is string {
namePredicate.parse(name);