discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Slash command names do not accept an apostrophe

Open Jiralite opened this issue 9 months ago • 1 comments
trafficstars

Description

Looking at #7303, an apostrophe is accepted for slash command names. However, apostrophes do not pass the API validation. From checking the source code, that character is U+0027 : APOSTROPHE {single quote; APL quote}.

Steps to Reproduce

Run the following replacing application_id with an application id and <token> with a token:

curl "https://discord.com/api/v10/applications/application_id/commands" \
	--request POST \
	--header "Authorization: Bot <token>" \
	--header "Content-Type: application/json" \
	--data '{"name":"isn'\''t","description":"Test.","type": 1}'

Expected Behavior

The command creates.

Current Behavior

{"message": "Invalid Form Body", "code": 50035, "errors": {"name": {"_errors": [{"code": "STRING_TYPE_REGEX", "message": "String value did not match validation regex."}]}}}

Screenshots/Videos

No response

Client and System Information

curl 8.7.1 (x86_64-apple-darwin24.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.62.0

Jiralite avatar Jan 27 '25 09:01 Jiralite

from the context it looks like the allowed character is U+02BC ʼ modifier letter apostrophe maybe the docs pr added the wrong character? the regex in the client also has not been updated so there are probably some ui issues with commnands containing this character (such as in command mentions)

advaith1 avatar Jan 27 '25 10:01 advaith1