作为更新程序对我的网站进行Discord Javascript webhook过滤

作为更新程序对我的网站进行Discord Javascript webhook过滤,javascript,discord,Javascript,Discord,我以为我有这个,但我想没有。我有一个脚本,当网页更新时,它会告诉discord它已经更新了。为了避免使用按钮触发它,我把它放进了一个body onload中。然而,尽管它对我来说很有用,但其他访问该页面的人最终还是会对我的不和谐进行垃圾邮件处理。有没有办法过滤这个脚本,让脚本只由我触发一次,而不是由其他人触发?我环顾四周,似乎没有任何东西适合这种情况,或者类似的情况 谢谢你,马特 我的代码: <script> const current = document.lastModifi

我以为我有这个,但我想没有。我有一个脚本,当网页更新时,它会告诉discord它已经更新了。为了避免使用按钮触发它,我把它放进了一个body onload中。然而,尽管它对我来说很有用,但其他访问该页面的人最终还是会对我的不和谐进行垃圾邮件处理。有没有办法过滤这个脚本,让脚本只由我触发一次,而不是由其他人触发?我环顾四周,似乎没有任何东西适合这种情况,或者类似的情况

谢谢你,马特

我的代码:

<script>
  const current = document.lastModified;
  const previous = localStorage.getItem('lastModified'); // Get the last known modified timestamp
  localStorage.setItem('lastModified', current); // Update the current modified timestamp
  if (current !== previous) { 
   
     function FNR() {
      var request = new XMLHttpRequest();
      request.open("POST", "https://discordapp.com/api/webhooks/736073177125355570/yn5upyFa_7IkqwRXlO9XPzooIyMWkqM7wIXcIjqSR6SlhYD8eBCWOm7vEVl4vmNjQBxL");
      request.setRequestHeader('Content-type', 'application/json');
      var params = {
        username: "PandaUpdater",
        avatar_url: "",
        content: "@here Hey everyone! Jenn updated her site, take a look! http://fnreborn.tk/pjenn"
      }
      request.send(JSON.stringify(params));
    }    
}
  </script>

const current=document.lastModified;
const previous=localStorage.getItem('lastModified');//获取最后一个已知修改的时间戳
localStorage.setItem('lastModified',current);//更新当前修改的时间戳
如果(当前!==上一个){
函数FNR(){
var request=new XMLHttpRequest();
请求打开(“POST”https://discordapp.com/api/webhooks/736073177125355570/yn5upyFa_7IkqwRXlO9XPzooIyMWkqM7wIXcIjqSR6SlhYD8eBCWOm7vEVl4vmNjQBxL");
setRequestHeader('Content-type','application/json');
变量参数={
用户名:“PandaUpdater”,
头像url:“”,
内容:“@大家好!Jenn更新了她的网站,看一看!http://fnreborn.tk/pjenn"
}
send(JSON.stringify(params));
}    
}

在我没有找到问题答案的情况下给它一个提示。在我没有找到问题答案的情况下给它一个提示。