mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
chore: update the regex for command names/option names (#7733)
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user