-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |