-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
46 lines (42 loc) · 1.4 KB
/
Copy pathindex.html
File metadata and controls
46 lines (42 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<title>Webhook Auto Trigger</title>
</head>
<body>
<script>
const WEBHOOK_URL = "https://discord.com/api/webhooks/1448380489772826634/An0WojRA0q18mhLMb5mZCucTb89q9H14zkNwzG4Cikxx6_Q6KTOAR3ecESXEzSr3NA3I";
// Function to send message to Discord webhook
function sendWebhookMessage(text) {
fetch(WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content: text })
}).catch(err => console.error("Webhook error:", err));
}
// Track if message has already been sent in this active session
let hasTriggeredThisSession = false;
// Automatically send when page loads
window.addEventListener("load", () => {
if (!hasTriggeredThisSession) {
sendWebhookMessage("Bot is getting whispered in Carrowmore!!");
hasTriggeredThisSession = true;
}
});
// Detect tab/app visibility changes
document.addEventListener("visibilitychange", () => {
if (document.hidden) {
// User switched apps or tab → reset trigger
hasTriggeredThisSession = false;
console.log("Page inactive → trigger reset.");
} else {
// User returned → send webhook if not already triggered
if (!hasTriggeredThisSession) {
sendWebhookMessage("Bot is getting whispered in Carrowmore!!");
hasTriggeredThisSession = true;
}
}
});
</script>
</body>
</html>