Size
5.2 KB
Version
1.0.1
Created
Mar 8, 2026
Updated
14 days ago
1// ==UserScript==
2// @name BetNare Auto Rain Claimer
3// @description Automatically claims rain rewards on BetNare
4// @version 1.0.1
5// @match https://*.betnare.com/*
6// @icon https://pcdn.i-gamingplatform.com/d8a6fb4680ad860c4f6b862f1bb5b8d4/global_config/d0513638-7539-46d7-b339-37373b8f2be2.webp
7// ==/UserScript==
8(function() {
9 'use strict';
10
11 console.log('BetNare Auto Rain Claimer initialized');
12
13 // Debounce function to prevent excessive calls
14 function debounce(func, wait) {
15 let timeout;
16 return function executedFunction(...args) {
17 const later = () => {
18 clearTimeout(timeout);
19 func(...args);
20 };
21 clearTimeout(timeout);
22 timeout = setTimeout(later, wait);
23 };
24 }
25
26 // Function to check for and claim rain
27 function checkAndClaimRain() {
28 console.log('Checking for rain...');
29
30 // Look for various possible rain claim button selectors
31 const possibleSelectors = [
32 'button[class*="rain"][class*="claim"]',
33 'button[class*="claim"][class*="rain"]',
34 'div[class*="rain"] button[class*="claim"]',
35 'div[class*="rain-notification"] button',
36 'div[class*="rain-popup"] button',
37 'button:has-text("Claim")',
38 'button:has-text("claim")',
39 '[class*="rain-claim"]',
40 '[class*="claimRain"]',
41 '[data-testid*="rain"]',
42 '[data-testid*="claim"]'
43 ];
44
45 // Try to find rain claim button
46 for (const selector of possibleSelectors) {
47 try {
48 const elements = document.querySelectorAll(selector);
49 for (const element of elements) {
50 const text = element.textContent.toLowerCase();
51 const classList = element.className.toLowerCase();
52
53 // Check if it's a rain-related claim button
54 if ((text.includes('claim') || text.includes('rain')) ||
55 (classList.includes('rain') && classList.includes('claim'))) {
56 console.log('Found potential rain claim button:', element);
57
58 // Check if button is visible and clickable
59 const rect = element.getBoundingClientRect();
60 if (rect.width > 0 && rect.height > 0) {
61 console.log('Clicking rain claim button!');
62 element.click();
63 return true;
64 }
65 }
66 }
67 } catch (e) {
68 // Skip invalid selectors
69 }
70 }
71
72 // Alternative approach: look for any modal/popup with "rain" text and a claim button
73 const modals = document.querySelectorAll('div[class*="modal"], div[class*="popup"], div[class*="notification"], div[class*="toast"]');
74 for (const modal of modals) {
75 const modalText = modal.textContent.toLowerCase();
76 if (modalText.includes('rain')) {
77 console.log('Found rain modal/popup:', modal);
78
79 // Look for claim button within this modal
80 const claimButtons = modal.querySelectorAll('button');
81 for (const button of claimButtons) {
82 const buttonText = button.textContent.toLowerCase();
83 if (buttonText.includes('claim') || buttonText.includes('collect') || buttonText.includes('get')) {
84 console.log('Found claim button in rain modal:', button);
85 const rect = button.getBoundingClientRect();
86 if (rect.width > 0 && rect.height > 0) {
87 console.log('Clicking claim button in rain modal!');
88 button.click();
89 return true;
90 }
91 }
92 }
93 }
94 }
95
96 return false;
97 }
98
99 // Debounced version of the check function
100 const debouncedCheck = debounce(checkAndClaimRain, 500);
101
102 // Set up MutationObserver to watch for DOM changes
103 const observer = new MutationObserver((mutations) => {
104 debouncedCheck();
105 });
106
107 // Start observing when body is ready
108 function init() {
109 if (document.body) {
110 console.log('Starting rain claimer observer...');
111
112 // Observe the entire document for changes
113 observer.observe(document.body, {
114 childList: true,
115 subtree: true,
116 attributes: true,
117 attributeFilter: ['class', 'style']
118 });
119
120 // Also check periodically in case observer misses something
121 setInterval(checkAndClaimRain, 5000);
122
123 // Initial check
124 checkAndClaimRain();
125 } else {
126 setTimeout(init, 1000);
127 }
128 }
129
130 // Start the extension
131 if (document.readyState === 'loading') {
132 document.addEventListener('DOMContentLoaded', init);
133 } else {
134 init();
135 }
136
137 console.log('BetNare Auto Rain Claimer is active and monitoring for rain rewards!');
138})();