Skip to content

Commit

Permalink
Create bloxflip-notifier.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
valxe authored Aug 12, 2024
1 parent ec3aaad commit dbf97a2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions bloxflip-notifier.user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// ==UserScript==
// @name Bloxflip Rain Notifier
// @namespace http://tampermonkey.net/
// @version 1.0.2
// @description Notify about rain !
// @author Valentineuh
// @match https://bloxflip.com/*
// @icon https://bloxflip.com/favicon.ico
// @license MIT
// @grant GM_xmlhttpRequest
// ==/UserScript==

window.addEventListener('load', () => {

let raining = false;

if (Notification.permission !== 'granted') {
Notification.requestPermission();
}

setInterval(async () => {
let data = await (await fetch('https://api.bloxflip.com/chat/history')).json();
let prize = data.rain.prize
if (data.rain.active && !raining) {
if (Notification.permission === 'granted') {
new Notification("Rain detected! 😋", {
body: `Rain has started yeppie!! Prize : ${prize} bobux.`,
icon: 'https://raw.githubusercontent.com/valxe/bloxflip-rain-joiner/main/icone.png'
});
}
raining = true;

} else if (!data.rain.active && raining) {
raining = false;
}
}, 5000);
});

0 comments on commit dbf97a2

Please sign in to comment.