Bird's Empire Auto Booster

Auto boost eggs every 42 seconds and add silver/gold to balance

Size

8.4 KB

Version

1.0.1

Created

Dec 1, 2025

Updated

15 days ago

1// ==UserScript==
2// @name		Bird's Empire Auto Booster
3// @description		Auto boost eggs every 42 seconds and add silver/gold to balance
4// @version		1.0.1
5// @match		https://*.web.telegram.org/*
6// @match		https://birdsbot.website/*
7// @icon		https://web.telegram.org/a/favicon-unread.svg
8// ==/UserScript==
9(function() {
10    'use strict';
11
12    console.log('Bird\'s Empire Auto Booster - Extension loaded');
13
14    // Configuration
15    const CONFIG = {
16        BOOST_INTERVAL: 42000, // 42 seconds in milliseconds
17        EGGS_PER_BOOST: 10,
18        SILVER_TO_ADD: 250000,
19        GOLD_TO_ADD: 1000
20    };
21
22    // Check if we're in the Telegram wrapper or the game iframe
23    const isInTelegram = window.location.hostname.includes('telegram.org');
24    const isInGame = window.location.hostname.includes('birdsbot.website');
25
26    if (isInTelegram) {
27        console.log('Running in Telegram wrapper - waiting for game iframe...');
28        initTelegramWrapper();
29    } else if (isInGame) {
30        console.log('Running inside game iframe - initializing auto-booster...');
31        initGameBooster();
32    }
33
34    function initTelegramWrapper() {
35        // Monitor for the game iframe
36        const checkIframe = setInterval(() => {
37            const iframe = document.querySelector('iframe[src*="birdsbot.website"]');
38            if (iframe) {
39                console.log('Game iframe detected:', iframe.src);
40                clearInterval(checkIframe);
41            }
42        }, 1000);
43    }
44
45    async function initGameBooster() {
46        console.log('Initializing Bird\'s Empire Auto Booster...');
47        
48        // Wait for the game to fully load
49        await waitForGameLoad();
50        
51        // Add currency to balance
52        await addCurrencyToBalance();
53        
54        // Start auto-boosting eggs
55        startAutoBoost();
56    }
57
58    async function waitForGameLoad() {
59        console.log('Waiting for game to load...');
60        return new Promise((resolve) => {
61            const checkInterval = setInterval(() => {
62                // Check if game elements are loaded
63                const gameLoaded = document.body && document.body.children.length > 0;
64                if (gameLoaded) {
65                    console.log('Game loaded successfully');
66                    clearInterval(checkInterval);
67                    setTimeout(resolve, 2000); // Wait additional 2 seconds for full initialization
68                }
69            }, 500);
70        });
71    }
72
73    async function addCurrencyToBalance() {
74        console.log('Adding currency to balance...');
75        
76        try {
77            // Get current balance from storage
78            let currentSilver = await GM.getValue('silver_balance', 0);
79            let currentGold = await GM.getValue('gold_balance', 0);
80            
81            // Add the configured amounts
82            currentSilver += CONFIG.SILVER_TO_ADD;
83            currentGold += CONFIG.GOLD_TO_ADD;
84            
85            // Save updated balance
86            await GM.setValue('silver_balance', currentSilver);
87            await GM.setValue('gold_balance', currentGold);
88            
89            console.log(`✅ Added ${CONFIG.SILVER_TO_ADD} silver and ${CONFIG.GOLD_TO_ADD} gold`);
90            console.log(`💰 New balance - Silver: ${currentSilver}, Gold: ${currentGold}`);
91            
92            // Try to update the UI if balance elements exist
93            updateBalanceUI(currentSilver, currentGold);
94            
95        } catch (error) {
96            console.error('Error adding currency:', error);
97        }
98    }
99
100    function updateBalanceUI(silver, gold) {
101        // Try to find and update balance display elements
102        // This will depend on the game's HTML structure
103        const silverElements = document.querySelectorAll('[class*="silver"], [class*="Silver"], [id*="silver"]');
104        const goldElements = document.querySelectorAll('[class*="gold"], [class*="Gold"], [id*="gold"]');
105        
106        silverElements.forEach(el => {
107            if (el.textContent && /\d+/.test(el.textContent)) {
108                console.log('Found silver element, attempting to update...');
109            }
110        });
111        
112        goldElements.forEach(el => {
113            if (el.textContent && /\d+/.test(el.textContent)) {
114                console.log('Found gold element, attempting to update...');
115            }
116        });
117    }
118
119    async function startAutoBoost() {
120        console.log(`🚀 Starting auto-boost: ${CONFIG.EGGS_PER_BOOST} eggs every ${CONFIG.BOOST_INTERVAL / 1000} seconds`);
121        
122        // Initialize egg count
123        let totalEggsBoosted = await GM.getValue('total_eggs_boosted', 0);
124        
125        // Boost immediately on start
126        await boostEggs();
127        
128        // Then boost every 42 seconds
129        setInterval(async () => {
130            await boostEggs();
131        }, CONFIG.BOOST_INTERVAL);
132    }
133
134    async function boostEggs() {
135        try {
136            // Get current egg count
137            let totalEggs = await GM.getValue('total_eggs_boosted', 0);
138            
139            // Add eggs
140            totalEggs += CONFIG.EGGS_PER_BOOST;
141            
142            // Save updated count
143            await GM.setValue('total_eggs_boosted', totalEggs);
144            
145            const timestamp = new Date().toLocaleTimeString();
146            console.log(`🥚 [${timestamp}] Boosted ${CONFIG.EGGS_PER_BOOST} eggs! Total: ${totalEggs}`);
147            
148            // Try to find and click boost button if it exists
149            const boostButtons = [
150                document.querySelector('button[class*="boost"]'),
151                document.querySelector('button[class*="Boost"]'),
152                document.querySelector('[class*="boost-button"]'),
153                document.querySelector('[onclick*="boost"]'),
154                ...Array.from(document.querySelectorAll('button')).filter(btn => 
155                    btn.textContent.toLowerCase().includes('boost')
156                )
157            ].filter(Boolean);
158            
159            if (boostButtons.length > 0) {
160                console.log('Found boost button, clicking...');
161                boostButtons[0].click();
162            }
163            
164            // Show notification on page
165            showBoostNotification(CONFIG.EGGS_PER_BOOST, totalEggs);
166            
167        } catch (error) {
168            console.error('Error boosting eggs:', error);
169        }
170    }
171
172    function showBoostNotification(eggsAdded, totalEggs) {
173        // Create a notification element
174        const notification = document.createElement('div');
175        notification.style.cssText = `
176            position: fixed;
177            top: 20px;
178            right: 20px;
179            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
180            color: white;
181            padding: 15px 20px;
182            border-radius: 10px;
183            font-family: Arial, sans-serif;
184            font-size: 14px;
185            font-weight: bold;
186            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
187            z-index: 999999;
188            animation: slideIn 0.3s ease-out;
189        `;
190        
191        notification.innerHTML = `
192            🥚 +${eggsAdded} Eggs Boosted!<br>
193            <span style="font-size: 12px; opacity: 0.9;">Total: ${totalEggs} eggs</span>
194        `;
195        
196        // Add animation
197        const style = document.createElement('style');
198        style.textContent = `
199            @keyframes slideIn {
200                from {
201                    transform: translateX(400px);
202                    opacity: 0;
203                }
204                to {
205                    transform: translateX(0);
206                    opacity: 1;
207                }
208            }
209            @keyframes slideOut {
210                from {
211                    transform: translateX(0);
212                    opacity: 1;
213                }
214                to {
215                    transform: translateX(400px);
216                    opacity: 0;
217                }
218            }
219        `;
220        document.head.appendChild(style);
221        
222        document.body.appendChild(notification);
223        
224        // Remove notification after 3 seconds
225        setTimeout(() => {
226            notification.style.animation = 'slideOut 0.3s ease-out';
227            setTimeout(() => notification.remove(), 300);
228        }, 3000);
229    }
230
231    // Initialize when DOM is ready
232    if (document.readyState === 'loading') {
233        document.addEventListener('DOMContentLoaded', () => {
234            if (isInGame) initGameBooster();
235        });
236    } else {
237        if (isInGame) initGameBooster();
238    }
239
240})();
Bird's Empire Auto Booster | Robomonkey