discord-api-docs
discord-api-docs copied to clipboard
Problems with certain fields in the automod endpoint
Description
API is applying configurations with invalid fields that should return an error explaining that the fields are invalid, I tested applying it by the test bot and the API is accepting these configurations, I verified in the Discord Client that they are actually applying and the API is returning a status code 500 when the settings are applied.
(I'm using google translator there will probably be a typo.) :(
Steps to Reproduce
Bug actions[0].type
:
I added this field as string and it returned in status code 500
{
"id": "1008883493918490738",
"name": "Commonly Flagged Words",
"guild_id": "1005158228419694712",
"event_type": "1",
"trigger_type": 4,
"trigger_metadata": {
"presets": [
1,
3,
2
],
"allow_list": ["testing", "hi", true, false, 12345679]
},
"actions": [
{
"type": "1",
"metadata": {}
}
],
"enabled": true,
"creator_id": "822865770504519700",
"exempt_channels": null,
"exempt_roles": null
}
Field trigger_metadata.allow_list
:
I added numbers to this list, boolean
{
"id": "1008883493918490738",
"name": "Commonly Flagged Words",
"guild_id": "1005158228419694712",
"event_type": 1,
"trigger_type": 4,
"trigger_metadata": {
"presets": [
1,
3,
2
],
"allow_list": ["testing", "hi", true, false, 12345679]
},
"actions": [
{
"type": 1,
"metadata": {}
}
],
"enabled": true,
"creator_id": "822865770504519700",
"exempt_channels": null,
"exempt_roles": null
}
Expected Behavior
In the actions[0].type field I should get a message saying that that field was supposed to be a number.
In the trigger_metadata.allow_list
field I should get an error saying that this list contains invalid items and that this item has to be a string.
Current Behavior
I added string in actions[0].type
field and got status code 500 in discord API.
Adding boolean, numbers in trigger_metadata.allow_list
field API is applying settings and it should return an error saying it only accepts string
Screenshots/Videos
This message that is saying an internal error on the server is because of the
actions[0].type
field and in the discord client is the list that the API accepted in the configuration.
Client and System Information
Discord Canary: Canary 141694 (726d89d) Host 1.0.48 Windows 10 64-Bit (10.0.22622)
Library: I didn't use any, I used Insomnia to make a request in the API
Thanks for catching and reporting these issues :)
Sorry it took awhile for us to address this. The fix for handling the action_type field should be out this week. However for string fields, it seems like accepting any value and force casting to string is the convention in the rest of the discord API so going to keep that as is to favor consistency here.
The fix for this should be out at this point, let me know if you are still seeing the issue.