小编dem*_*nis的帖子

发送不带 jQuery 的 discord webhook

我正在尝试在没有 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)

还有很多其他方法,但它总是失败!有什么问题?谢谢!!

javascript ajax discord

-1
推荐指数
1
解决办法
2104
查看次数

标签 统计

ajax ×1

discord ×1

javascript ×1