<!DOCTYPE html>
<html>
<head>
  <title>Discord Message Sender</title>
</head>
<body>
  <h1>Discord Message Sender</h1>
  <input id="token" type="text" placeholder="Discord Token">
  <input id="channelId" type="text" placeholder="Channel ID">
  <input id="message" type="text" placeholder="Message">
  <button id="start-button">Start</button>
  <button id="stop-button">Stop</button>

  <script>
    const startButton = document.getElementById('start-button');
    const stopButton = document.getElementById('stop-button');
    const tokenInput = document.getElementById('token');
    const channelIdInput = document.getElementById('channelId');
    const messageInput = document.getElementById('message');

    let intervalId = null;

    startButton.addEventListener('click', () => {
      const token = tokenInput.value;
      const channelId = channelIdInput.value;
      const message = messageInput.value;

      if (!token || !channelId || !message) {
        alert('Please fill in all fields');
        return;
      }

      intervalId = setInterval(() => {
        sendMessage(token, channelId, message);
      }, 1000);
    });

    stopButton.addEventListener('click', () => {
      clearInterval(intervalId);
    });

    function sendMessage(token, channelId, message) {
      const url = `https://discord.com/api/v9/channels/${channelId}/messages`;
      const headers = {
        'Content-Type': 'application/json',
        'Authorization': token
      };
      const body = JSON.stringify({ content: message });

      fetch(url, {
        method: 'POST',
        headers: headers,
        body: body
      })
      .then(response => {
        if (response.ok) {
          console.log(`Message sent: ${message}`);
        } else {
          console.error(`Error: ${response.status}`);
        }
      })
      .catch(error => console.error('Error:', error));
    }
  </script>
</body>
</html>