discord-api-docs
discord-api-docs copied to clipboard
Unintuitive error in channel patches when the topic contains an emoji message format for an emoji hosted in a guild the editing entity is not in
Description
The API rejects PATCH /channels/:id
requests if the topic contains emoji message formats <:name:id>
/<a:name:id>
of emojis hosted in guilds the changing entity (moderator/bot) is not in.
I see how it makes sense to restrict the emojis one can set initially, but the current behavior prevents any changes from being applied to the channel by staff/bots that do not share the guild the emoji is hosted in.
Error code 50035
CHANNEL_TOPIC_INVALID
"Channel topic contains at least one word that is not allowed." is not particularly helpful to figure this out. (This is also the error message displayed to end-users in-client).
Steps to Reproduce
A)
- Change the description of a channel to an emoji hosted in a server you are not in
<:name:id>
format - Get a rejection of the form above
B)
- Have another person change the topic of a channel to an emoji hosted in a server you do not share with them
- Try to edit any property of the channel (age restrict, slow mode, etc.)
- Get the rejection of the form above
Expected Behavior
Either allow changes, if the emoji is not initially set, or at least provide a better end-user experience by displaying a useful error that explains the issue at hand. (This is also true for developer experience with the error returned from the API)
Current Behavior
Unfitting/Unhelpful error message
{
"message": "Invalid Form Body",
"code": 50035,
"errors": {
"topic": {
"_errors": [
{
"code": "CHANNEL_TOPIC_INVALID",
"message": "Channel topic contains at least one word that is not allowed."
}
]
}
}
}
Screenshots/Videos
Client and System Information
canary 280235 (59a8878) Host 1.0.306 x64 (45844) Windows 11 64-bit (10.0.22631) (likely not relevant, since this is about API behavior)
This was introduced as part of a larger security issue they fixed. I was told they were going to revert this specifically but they never did.
There is another issue where users without Nitro cannot use emojis in the channel topic, even if they are from the current server, which should not happen, since you will have access to an emoji that is in the current server.