title: Javascript to send notice to discord based on webpage last updated
body: <p>I'm attempting to create a page that when it's been updated, it sends a notice to a channel in discord. I have a working page with a button that will send a notice to discord(uses webhooks and javascript). I'm stuck on executing use of document.lastModified to detect when the page was last updated so that it can execute the onclick=sendMessage(). Any/all help with this would be appreciated.</p>
  <p>-Matt</p>
  <p>My code</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
      &lt;meta charset=&quot;UTF-8&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
      &lt;title&gt;Discord Webhook Tutorial&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;button onclick=&quot;sendMessage()&quot;&gt;Send&lt;/button&gt;
    &lt;/body&gt;
  
    &lt;script&gt;
    mess1= document.lastModified;
    math=99;
    x = hidden(mess1);
    if (x == true)
       {
       
      function sendMessage() {
        var request = new XMLHttpRequest();
        request.open(&quot;POST&quot;, &quot;https://discordapp.com/api/webhooks/736073177125355570/yn5upyFa_7IkqwRXlO9XPzooIyMWkqM7wIXcIjqSR6SlhYD8eBCWOm7vEVl4vmNjQBxL&quot;);
  
        request.setRequestHeader('Content-type', 'application/json');
  
        var params = {
          username: &quot;Update Bot&quot;,
          avatar_url: &quot;&quot;,
          content: &quot;Testing bot... updating...&quot;
        }
  
        request.send(JSON.stringify(params));
      }
      
       }
    &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>