Automatically boosts/collects eggs every second in Bird's Empire game
Size
6.9 KB
Version
1.0.1
Created
Dec 1, 2025
Updated
2 months ago
1// ==UserScript==
2// @name Bird's Empire Auto Egg Booster
3// @description Automatically boosts/collects eggs every second in Bird's Empire game
4// @version 1.0.1
5// @match https://*.web.telegram.org/*
6// @match https://birdsbot.website/*
7// @icon https://web.telegram.org/a/favicon.ico
8// @grant GM.getValue
9// @grant GM.setValue
10// ==/UserScript==
11(function() {
12 'use strict';
13
14 console.log('Bird\'s Empire Auto Egg Booster loaded');
15
16 // Debounce function to prevent excessive calls
17 function debounce(func, wait) {
18 let timeout;
19 return function executedFunction(...args) {
20 const later = () => {
21 clearTimeout(timeout);
22 func(...args);
23 };
24 clearTimeout(timeout);
25 timeout = setTimeout(later, wait);
26 };
27 }
28
29 // Function to find and click the egg boost/collect button
30 async function boostEggs() {
31 try {
32 // Common selectors for egg collection/boost buttons in games
33 const selectors = [
34 'button[class*="collect"]',
35 'button[class*="boost"]',
36 'button[class*="claim"]',
37 'button[class*="egg"]',
38 'div[class*="collect"][role="button"]',
39 'div[class*="boost"][role="button"]',
40 'div[class*="claim"][role="button"]',
41 'button:has(img[alt*="egg" i])',
42 'button:has(span:contains("Collect"))',
43 'button:has(span:contains("Boost"))',
44 'button:has(span:contains("Claim"))',
45 '[onclick*="collect"]',
46 '[onclick*="boost"]',
47 '[onclick*="claim"]'
48 ];
49
50 let buttonFound = false;
51
52 // Try each selector
53 for (const selector of selectors) {
54 try {
55 const button = document.querySelector(selector);
56 if (button && button.offsetParent !== null) { // Check if visible
57 console.log('Found egg button with selector:', selector);
58 button.click();
59 buttonFound = true;
60
61 // Update stats
62 const clicks = await GM.getValue('totalClicks', 0);
63 await GM.setValue('totalClicks', clicks + 1);
64 await GM.setValue('lastClickTime', new Date().toISOString());
65
66 console.log('Egg boosted! Total clicks:', clicks + 1);
67 break;
68 }
69 } catch (e) {
70 // Continue to next selector
71 }
72 }
73
74 if (!buttonFound) {
75 // If no button found with common selectors, try to find any clickable element with egg-related text
76 const allButtons = document.querySelectorAll('button, div[role="button"], [onclick]');
77 for (const btn of allButtons) {
78 const text = btn.textContent.toLowerCase();
79 const hasEggText = text.includes('egg') || text.includes('collect') ||
80 text.includes('boost') || text.includes('claim');
81
82 if (hasEggText && btn.offsetParent !== null) {
83 console.log('Found egg button by text content:', text);
84 btn.click();
85
86 const clicks = await GM.getValue('totalClicks', 0);
87 await GM.setValue('totalClicks', clicks + 1);
88 await GM.setValue('lastClickTime', new Date().toISOString());
89
90 console.log('Egg boosted! Total clicks:', clicks + 1);
91 buttonFound = true;
92 break;
93 }
94 }
95 }
96
97 if (!buttonFound) {
98 console.log('No egg boost button found on this page');
99 }
100
101 } catch (error) {
102 console.error('Error boosting eggs:', error);
103 }
104 }
105
106 // Function to initialize the auto-booster
107 async function init() {
108 console.log('Initializing Bird\'s Empire Auto Egg Booster');
109
110 // Check if we're on the game page
111 const isGamePage = window.location.href.includes('birdsbot.website');
112 const isTelegramPage = window.location.href.includes('web.telegram.org');
113
114 if (isGamePage) {
115 console.log('Running on game page - starting auto-booster');
116
117 // Wait for page to fully load
118 await new Promise(resolve => setTimeout(resolve, 3000));
119
120 // Start boosting eggs every second
121 setInterval(async () => {
122 await boostEggs();
123 }, 1000);
124
125 // Show status indicator
126 const statusDiv = document.createElement('div');
127 statusDiv.id = 'egg-booster-status';
128 statusDiv.style.cssText = `
129 position: fixed;
130 top: 10px;
131 right: 10px;
132 background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
133 color: white;
134 padding: 12px 20px;
135 border-radius: 8px;
136 font-family: Arial, sans-serif;
137 font-size: 14px;
138 font-weight: bold;
139 z-index: 999999;
140 box-shadow: 0 4px 6px rgba(0,0,0,0.3);
141 cursor: pointer;
142 user-select: none;
143 `;
144 statusDiv.innerHTML = '🥚 Auto Booster: Active';
145
146 // Add click to show stats
147 statusDiv.addEventListener('click', async () => {
148 const clicks = await GM.getValue('totalClicks', 0);
149 const lastClick = await GM.getValue('lastClickTime', 'Never');
150 alert(`🥚 Egg Booster Stats\n\nTotal Clicks: ${clicks}\nLast Click: ${lastClick}`);
151 });
152
153 document.body.appendChild(statusDiv);
154
155 console.log('Auto-booster started! Clicking every second.');
156
157 } else if (isTelegramPage) {
158 console.log('Running on Telegram page - monitoring for game iframe');
159
160 // Monitor for iframe loading
161 const observer = new MutationObserver(debounce(() => {
162 const iframe = document.querySelector('iframe[src*="birdsbot.website"]');
163 if (iframe) {
164 console.log('Game iframe detected!');
165 }
166 }, 500));
167
168 observer.observe(document.body, {
169 childList: true,
170 subtree: true
171 });
172 }
173 }
174
175 // Start when page is ready
176 if (document.readyState === 'loading') {
177 document.addEventListener('DOMContentLoaded', init);
178 } else {
179 init();
180 }
181
182})();