Javascript 将webhook发送到与.js不一致的地方
您好,我想使用webhooks将inputValue发送到discord。代码如下: 我想发送一条不一致的消息[使用webhooks],其中包含以下inputValue 我把//Send discord webhook和inputValue放在代码应该在的地方,并尝试了一些方法,但没有成功;(:Javascript 将webhook发送到与.js不一致的地方,javascript,html,discord,Javascript,Html,Discord,您好,我想使用webhooks将inputValue发送到discord。代码如下: 我想发送一条不一致的消息[使用webhooks],其中包含以下inputValue 我把//Send discord webhook和inputValue放在代码应该在的地方,并尝试了一些方法,但没有成功;(: $(function () { function display(bool) { if (bool) { $("#container"
$(function () {
function display(bool) {
if (bool) {
$("#container").show();
} else {
$("#container").hide();
}
}
display(false)
window.addEventListener('message', function(event) {
var item = event.data;
if (item.type === "ui") {
if (item.status == true) {
display(true)
} else {
display(false)
}
}
})
// if the person uses the escape key, it will exit the resource
document.onkeyup = function (data) {
if (data.which == 27) {
$.post('http://nui2/exit', JSON.stringify({}));
return
}
};
$("#close").click(function () {
$.post('http://nui2/exit', JSON.stringify({}));
return
})
//when the user clicks on the submit button, it will run
$("#submit").click(function () {
let inputValue = $("#input").val()
if (inputValue.length >= 100) {
$.post("http://nui2/error", JSON.stringify({
error: "The maximum number of characters is 100" // Error message to chat
}))
return
} else if (!inputValue) {
$.post("http://nui2/error", JSON.stringify({
error: "You didn't complete the box" // Error message to chat
}))
return
}
// if there are no errors from above, we can send the data back to the original callback and hanndle it from there
$.post('http://nui2/main', JSON.stringify({
text: inputValue, // Send text to chat
// send discord webhook with inputValue
}));
return;
})
})