Skip to content

Problems with certain fields in the automod endpoint #5331

@nayvcake

Description

@nayvcake

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

image
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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions