|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html> |
3 | 3 | <head> |
4 | | - <title>Safe Webhook Trigger</title> |
| 4 | + <title>Webhook Auto Trigger</title> |
5 | 5 | </head> |
6 | 6 | <body> |
7 | | - <h2>Trigger Discord Webhook (Only This Device)</h2> |
8 | | - <button id="triggerBtn">Send Alert</button> |
| 7 | + <button id="triggerButton">Trigger Webhook</button> |
| 8 | + <p id="status"></p> |
9 | 9 |
|
10 | | - <script> |
11 | | - const WEBHOOK_URL = "https://discord.com/api/webhooks/your_webhook_here"; |
| 10 | +<script> |
| 11 | +const WEBHOOK_URL = "https://discord.com/api/webhooks/1448380489772826634/An0WojRA0q18mhLMb5mZCucTb89q9H14zkNwzG4Cikxx6_Q6KTOAR3ecESXEzSr3NA3I"; |
12 | 12 |
|
13 | | - // Function to send a message to Discord webhook |
14 | | - function sendWebhookMessage(text) { |
15 | | - fetch(WEBHOOK_URL, { |
16 | | - method: "POST", |
17 | | - headers: { "Content-Type": "application/json" }, |
18 | | - body: JSON.stringify({ content: text }) |
19 | | - }) |
20 | | - .then(() => alert("Webhook sent! ✅")) |
21 | | - .catch(err => console.error("Webhook error:", err)); |
22 | | - } |
23 | | - |
24 | | - // Check if this device has already triggered |
25 | | - const hasTriggered = localStorage.getItem("webhookTriggered"); |
| 13 | +// Function to send message to Discord webhook |
| 14 | +function sendWebhookMessage(text) { |
| 15 | + fetch(WEBHOOK_URL, { |
| 16 | + method: "POST", |
| 17 | + headers: { "Content-Type": "application/json" }, |
| 18 | + body: JSON.stringify({ content: text }) |
| 19 | + }) |
| 20 | + .then(() => { |
| 21 | + localStorage.setItem("webhookTriggered", "true"); |
| 22 | + updateStatus(); |
| 23 | + }) |
| 24 | + .catch(err => console.error("Webhook error:", err)); |
| 25 | +} |
26 | 26 |
|
27 | | - const btn = document.getElementById("triggerBtn"); |
28 | | - |
29 | | - if (hasTriggered) { |
30 | | - btn.disabled = true; |
31 | | - btn.innerText = "Already triggered on this device"; |
| 27 | +// Update the button and status message |
| 28 | +function updateStatus() { |
| 29 | + const triggered = localStorage.getItem("webhookTriggered") === "true"; |
| 30 | + const button = document.getElementById("triggerButton"); |
| 31 | + const status = document.getElementById("status"); |
| 32 | + |
| 33 | + if (triggered) { |
| 34 | + button.disabled = true; |
| 35 | + status.textContent = "Webhook already triggered on this device."; |
| 36 | + } else { |
| 37 | + button.disabled = false; |
| 38 | + status.textContent = "You can trigger the webhook."; |
32 | 39 | } |
| 40 | +} |
| 41 | + |
| 42 | +// Trigger button click |
| 43 | +document.getElementById("triggerButton").addEventListener("click", () => { |
| 44 | + sendWebhookMessage("Bot is getting whispered in Fingals!!"); |
| 45 | +}); |
33 | 46 |
|
34 | | - btn.addEventListener("click", () => { |
35 | | - if (!localStorage.getItem("webhookTriggered")) { |
36 | | - sendWebhookMessage("Alert from this device only!"); |
37 | | - localStorage.setItem("webhookTriggered", "true"); |
38 | | - btn.disabled = true; |
39 | | - btn.innerText = "Already triggered on this device"; |
40 | | - } |
41 | | - }); |
42 | | - </script> |
| 47 | +// Initialize status on page load |
| 48 | +window.addEventListener("load", updateStatus); |
| 49 | +</script> |
43 | 50 | </body> |
44 | 51 | </html> |
0 commit comments