From f0e0bd0aefe8dded3a14bf0a56310dbd5be60974 Mon Sep 17 00:00:00 2001 From: Fleny Date: Fri, 25 Apr 2025 21:21:27 +0200 Subject: [PATCH] Update Slash Command Name regex (#4102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update Slash Command Command Name regex * Update comments to reflect the change * Use the correct apostrophe in the regex While the docs use the regular ', discord accepts the unicode apostrophe ʼ. --- packages/bot/src/constants.ts | 2 +- packages/types/src/discord/interactions.ts | 4 ++-- packages/types/src/discordeno.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/bot/src/constants.ts b/packages/bot/src/constants.ts index 2e939842a..b9bbf617f 100644 --- a/packages/bot/src/constants.ts +++ b/packages/bot/src/constants.ts @@ -1,4 +1,4 @@ -export const SLASH_COMMANDS_NAME_REGEX = /^[-_\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$/u +export const SLASH_COMMANDS_NAME_REGEX = /^[-_ʼ\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$/u export const CONTEXT_MENU_COMMANDS_NAME_REGEX = /^[\w-\s]{1,32}$/ export const CHANNEL_MENTION_REGEX = /<#[0-9]+>/g export const DISCORD_SNOWFLAKE_REGEX = /^(?\d{17,19})$/ diff --git a/packages/types/src/discord/interactions.ts b/packages/types/src/discord/interactions.ts index 7abf6698e..4fb152307 100644 --- a/packages/types/src/discord/interactions.ts +++ b/packages/types/src/discord/interactions.ts @@ -267,7 +267,7 @@ export interface DiscordApplicationCommandOption { * @remarks * This value should be unique within an array of {@link DiscordApplicationCommandOption} * - * {@link ApplicationCommandTypes.ChatInput | ChatInput} command names must match the following regex `^[-_\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$` with the unicode flag set. + * {@link ApplicationCommandTypes.ChatInput | ChatInput} command names must match the following regex `^[-_ʼ\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$` with the unicode flag set. * If there is a lowercase variant of any letters used, you must use those. * Characters with no lowercase variants and/or uncased letters are still allowed. * @@ -622,7 +622,7 @@ export interface DiscordCreateApplicationCommand { type?: ApplicationCommandTypes /** * Name of command, 1-32 characters. - * `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$` with the unicode flag set. + * `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_ʼ\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$` with the unicode flag set. * If there is a lowercase variant of any letters used, you must use those. * Characters with no lowercase variants and/or uncased letters are still allowed. * ApplicationCommandTypes.User` and `ApplicationCommandTypes.Message` commands may be mixed case and can include spaces. diff --git a/packages/types/src/discordeno.ts b/packages/types/src/discordeno.ts index 9964e9ba6..768721fee 100644 --- a/packages/types/src/discordeno.ts +++ b/packages/types/src/discordeno.ts @@ -480,7 +480,7 @@ export type CreateApplicationCommand = CreateSlashApplicationCommand | CreateCon export interface CreateSlashApplicationCommand { /** * Name of command, 1-32 characters. - * `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$` with the unicode flag set. + * `ApplicationCommandTypes.ChatInput` command names must match the following regex `^[-_ʼ\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$` with the unicode flag set. * If there is a lowercase variant of any letters used, you must use those. * Characters with no lowercase variants and/or uncased letters are still allowed. * ApplicationCommandTypes.User` and `ApplicationCommandTypes.Message` commands may be mixed case and can include spaces.