So here is my problem.
I am trying to send messages via a discord webhook with buttons in but they don't display or sometimes just give an error code.
The error code basicly says that my JSON stringicicator does not function because of a syntrax error, which is weird because if i send a message without any button components it does function with no problem.
Here is my code:
const request = new XMLHttpRequest();
request.open("POST", "/* the url of the bot */");
request.setRequestHeader('Content-type', 'application/json');
const params = {
"embeds": [
{
"title": "test",
"description": "test",
"color": 65474
}
],
"components": [
{
"type": 1,
"components": [
{
"type": 2,
"style": 5,
"label": "kaas",
"url": "/* url website */"
}
]
}
]
request.send(JSON.stringify(params));
You are missing a } to close the params object.