【发布时间】:2020-09-22 18:42:10
【问题描述】:
我尝试了很多东西但它不起作用,我试图让它发送一个不和谐的 webhook 但我无法得到它,我得到的最接近的是一个发布错误,我知道它是什么意味着或者如果它是我的 json var 这是我的代码或我拥有的代码
function sendMessage() {
var textimput = document.getElementById("userInput");
var request = new XMLHttpRequest();
request.open(
"POST",
"https://discord.com/api/webhooks/1234567890/1234567890qwertyuiosdfghxcvbn"
);
request.setRequestHeader("Content-type", "application/json");
var i = 0;
var message = {
content: "Text",
embeds: [
{
title: "Title",
description: "message",
color: 16711680,
footer: {
text: "Footer",
},
},
],
};
message.embeds[0].description = textimput;
request.send(JSON.stringify(message));
}
我有这样的输入集
<input id="userInput" placeholder="INSERT TEXT LINK HERE">
【问题讨论】:
-
扩展一点“无法理解”。您的“POST 错误”的错误消息是什么?
-
我希望它从 webhook 嵌入到我的不和谐服务器中,但它使描述空白
-
尝试使用
message.embeds[0].description = textimput代替message.embeds[0].description = textimput.value -
谢谢,我已经尝试了将近 5 个小时了!非常感谢
标签: javascript html json discord