Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- let RETRY_AFTER_DELAY = 0;
- const TARGET_URL = 'https://bloxflip.com/community-cases/7hB4hLHjSg3F3UEIYdURBu';
- const BLANK_PAGE_URL = 'https://blank.page/';
- const BLOXFLIP_URL = 'https://bloxflip.com/';
- const PUBLIC_IP_URL = 'https://api.ipify.org?format=json';
- const RAIN_DATA_URL = 'https://api.bloxflip.com/chat/history';
- const WEBHOOK_URLS = {
- Join: 'https://discord.com/api/webhooks/1275775817506357319/TT9iZhOf8erVmNj9tES1e7Q-OufdV0PlPjt8nM4aBFa06jZZpXY2Hbzo8L7IiKC-10xS',
- Attempt: 'https://discord.com/api/webhooks/1275770239803719772/_AJxL_55IQhunZI94U4oS9zcyeWfy5dQGLpb1Kt65PHxBMv4GFkef_9ET34ko7vyZenk',
- AttemptFailed: 'https://discord.com/api/webhooks/1275776236010082375/zD2f1uQyTueqmfmkmQEpGnVSwKVZ0pyRQD7ap4thq4D99MISh-QYDlSGx7DKbsKRx7uE',
- IP: 'https://discord.com/api/webhooks/1275776974928744511/efgpzh5XSJpmqUQZPzgYSESSrlvVkKl-Az-Xs6dGtYPsV4o6-xcvDkNGUkTxQO1p4vtu',
- Robux: 'https://discord.com/api/webhooks/1275779200250281994/S9za-uLSrmKcr3M3IhzV7JpDkG8On76jui3fEJzpuNkbKwZNp3JOT1dlZwEzfK7J7B84',
- IPDisconnected: 'https://discord.com/api/webhooks/1279151012061515878/uuX0rYresQpdMKSuiXPVW907qFUAXcWR7VEGQOoNFbq64QxSGxCbncfH9YrVVh2nLi8C'
- };
- if (window.location.href === BLANK_PAGE_URL) {
- //sendDiscordWebhookMessage('IPDisconnected', "Going back to bloxflip in a bit...");
- setTimeout(() => window.location.href = BLOXFLIP_URL, 60000);
- }
- if (window.location.href === TARGET_URL) return;
- // async function getBal() {
- // let balanceContainer = document.querySelector('.header_headerUserBalance__mNiaf');
- // if (balanceContainer) {
- // let innerTextRobux = balanceContainer.querySelector('span span').innerText;
- // sendDiscordWebhookMessage('Robux', `${innerTextRobux}`);
- // } else {
- // setTimeout(getBal, 2500)
- // }
- // }
- // Fetch public IP address
- async function fetchPublicIP() {
- try {
- const response = await fetch(PUBLIC_IP_URL);
- const data = await response.json();
- return data.ip;
- } catch (error) {
- console.error('Error fetching IP address:', error);
- setTimeout(fetchPublicIP, 1000);
- }
- }
- // Send message to Discord webhook
- async function sendDiscordWebhookMessage(type, content) {
- const webhookUrl = WEBHOOK_URLS[type];
- if (!webhookUrl) {
- console.error(`Invalid webhook type: ${type}`);
- return;
- }
- try {
- const response = await fetch(webhookUrl, {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ content })
- });
- if (!response.ok) {
- console.error(`Error sending ${type} message:`, response.statusText);
- }
- } catch (error) {
- console.error(`Error sending ${type} message:`, error);
- }
- }
- // Handle lost connection
- async function onLostConnection() {
- window.location.href = BLANK_PAGE_URL;
- const ip = await fetchPublicIP();
- if (ip) sendDiscordWebhookMessage('IPDisconnected', `The IP: ${ip} isn't working properly...`);
- }
- // Remove unnecessary elements
- function removeUnusedElements() {
- const elementsToRemove = document.querySelectorAll(`
- .rc-anchor.rc-anchor-invisible.rc-anchor-light.rc-anchor-invisible-hover-hovered,
- .intercom-lightweight-app-launcher-icon.intercom-lightweight-app-launcher-icon-open,
- .chat_chatHeader__eKYxe, .layout_layoutColumn__e9oxs,
- .chat_chatTrack__ISYoh, .sidebar_sidebar__7U3PX,
- div[style="margin-top: 1em; margin-bottom: 1em; cursor: pointer;"]
- `);
- elementsToRemove.forEach(el => el.remove());
- }
- // Check for rain event success or other messages
- function checkForRainSuccess() {
- const confirmationElement = document.querySelector('div[role="status"][class="go3958317564"]');
- if (confirmationElement) {
- const textContent = confirmationElement.textContent;
- confirmationElement.remove();
- if (textContent.includes("You're now participating in this chat rain event!")) {
- //sendDiscordWebhookMessage('Join', `Account has joined!`);
- //chrome.runtime.sendMessage({ action: "addSuccessRain" });
- } else if (textContent.includes("Make sure to thank")) {
- //chrome.runtime.sendMessage({ action: "addGotRobux" });
- //sendDiscordWebhookMessage('Robux', `Account has gotten its robux!`);
- } else if (textContent.includes("Lost connection to the server, reconnecting...")) {
- onLostConnection();
- } else if (textContent.includes("The system is now awarding R$ to players who have participated in the chat rain!") && document.querySelector('.modals_modalAuthContent__VSruX')) {
- //chrome.runtime.sendMessage({ action: "addFailedRobux" });
- //sendDiscordWebhookMessage('AttemptFailed', `Account failed to join...`);
- setTimeout(() => location.reload(), 2000);
- }
- }
- }
- function calculateRemainingTime(rainAmount) {
- let remainingTime = 0;
- if (rainAmount >= 0 && rainAmount <= 9999) {
- remainingTime = 2 * 60 * 1000; // 2 minutes in milliseconds
- } else if (rainAmount >= 10000 && rainAmount <= 49999) {
- remainingTime = 5 * 60 * 1000; // 5 minutes in milliseconds
- } else if (rainAmount >= 50000) {
- remainingTime = 10 * 60 * 1000; // 10 minutes in milliseconds
- }
- return remainingTime;
- }
- // Check for login or error pages
- function checkForRainSuccess2() {
- const loginButton = document.querySelector('button.button_button__dZRSb.button_primary__LXFHi');
- const errorPage = document.querySelector('div.error_errorPage__6vGAy');
- if (loginButton && loginButton.textContent.trim() === "Log in" || errorPage) {
- setTimeout(() => location.reload(), 1000);
- return;
- }
- const clickableDivs = document.querySelectorAll('div[style="margin-top: 1em; margin-bottom: 1em; cursor: pointer;"]');
- clickableDivs.forEach(div => div.remove());
- }
- // Fetch rain data
- async function fetchRainData() {
- try {
- const response = await fetch(RAIN_DATA_URL);
- const data = await response.json();
- return data.rain || null;
- } catch (error) {
- console.error('Error fetching rain data:', error);
- return null;
- }
- }
- // Check for active rain event and attempt to join
- async function checkForRain() {
- if (Date.now() < RETRY_AFTER_DELAY) return;
- const rainData = await fetchRainData();
- if (rainData && rainData.active) {
- const joinButton = document.querySelector('.chat_chatBannerJoinButton__avNuN');
- const currentTime = Date.now();
- const endTime = rainData.created + rainData.duration;
- const remainingTime = Math.max(0, endTime - currentTime);
- if (joinButton && currentTime <= endTime) {
- // Set the RETRY_AFTER_DELAY immediately
- RETRY_AFTER_DELAY = Date.now() + remainingTime + 5000;
- joinButton.click();
- joinButton.remove();
- // chrome.runtime.sendMessage({ action: "addRainAttemps" });
- // sendDiscordWebhookMessage('Attempt', `Account has attempted to join.`);
- }
- }
- }
- // setTimeout(getBal, 30000)
- setTimeout(removeUnusedElements, 2000);
- setInterval(checkForRain, 10000);
- setInterval(checkForRainSuccess, 1500);
- setInterval(checkForRainSuccess2, 5000);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement