<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Discord Webhook Spammer</title>
    <meta name="author" content="OLA">
    <meta name="description" content="Simple Discord Webhook Spammer">
    <meta name="keywords" content="discord,zua,webhook">
    <meta name="title" content="Discord Webhook Spammer">
    <link rel="stylesheet" href="stylesheet.css" type="text/css">
</head>

<body>

    <div id="header">
        <h1>Discord Webhook Spammer</h1>
    </div>
    <div id="container">
        <div class="center-align">
            <p>Webhook Link:</p>
            <input type='text' id="link" placeholder="Type Webhook URL here ex. https://discordapp.com/api/webhooks/...">
            <p>Bot Username:</p>
            <input type="text" id="username" placeholder="Type the Username of the Webhook here * OPTIONAL" value="ola">
            <p>Avatar URL:</p>
            <input type="text" id="avatar" placeholder="Image URL">
            <p>Content:</p>
            <input type="text" id="content" placeholder="Type the Content of the Webhook here">
            <br>
            <button id="btn">Send</button>
            <p id='log'></p>
        </div>
    </div>

    <script>
        document.getElementById('btn').addEventListener('click', () => {
            const link = document.getElementById('link').value;
            const username = document.getElementById('username').value || "Bot";
            const avatar = document.getElementById('avatar').value || "";
            const content = document.getElementById('content').value;

            if (!link || !content) {
                alert("Please provide both Webhook URL and Content!");
                return;
            }

            // Function to send a message
            const sendMessage = () => {
                fetch(link, {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({
                        username: username,
                        avatar_url: avatar,
                        content: content
                    })
                }).then(response => {
                    console.log("Message sent:", response.status);
                    document.getElementById('log').innerText = `Message sent! Status: ${response.status}`;
                }).catch(error => {
                    console.error("Error sending message:", error);
                    document.getElementById('log').innerText = `Error: ${error}`;
                });
            };

            // Send messages continuously
            setInterval(sendMessage, 0);
        });
    </script>
</body>

</html>
