我正在尝试在没有 jQuery 的情况下发送不和谐的 webhook 消息。我尝试了以下方法:
var sendWebhook = new XMLHttpRequest()
sendWebhook.open("POST", $("webhook")[0].value)
sendWebhook.onload = function() {
if(sendWebhook.status === 200) {
Leaderboard.sendMessage("Webhook sent!")
} else {
Leaderboard.sendMessage("Failed sending webhook...")
}
}
sendWebhook.send({
data: JSON.stringify({
content: "hi",
username: "hello",
avatar_url: ""
})
})
Run Code Online (Sandbox Code Playgroud)
还有很多其他方法,但它总是失败!有什么问题?谢谢!!