我正在嘗試創建一個頁面,當它被更新時,它會向不和諧的頻道發送通知。我有一個帶有按鈕的工作頁面,該按鈕會向 discord 發送通知(使用 webhooks 和 javascript)。我堅持使用 document.lastModified 來檢測頁面的最后更新時間,以便它可以執行 onclick=sendMessage()。對此的任何/所有幫助將不勝感激。-馬特我的代碼<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Discord Webhook Tutorial</title> </head> <body> <button onclick="sendMessage()">Send</button> </body> <script> mess1= document.lastModified; math=99; x = hidden(mess1); if (x == true) { function sendMessage() { var request = new XMLHttpRequest(); request.open("POST", "https://discordapp.com/api/webhooks/736073177125355570/yn5upyFa_7IkqwRXlO9XPzooIyMWkqM7wIXcIjqSR6SlhYD8eBCWOm7vEVl4vmNjQBxL"); request.setRequestHeader('Content-type', 'application/json'); var params = { username: "Update Bot", avatar_url: "", content: "Testing bot... updating..." } request.send(JSON.stringify(params)); } } </script></html>
Javascript 根據上次更新的網頁向不和諧發送通知
梵蒂岡之花
2022-12-02 10:50:16