raju014 commited on
Commit
e6bf0af
·
verified ·
1 Parent(s): bae63bc

Upload bot.py

Browse files
Files changed (1) hide show
  1. bot.py +15 -13
bot.py CHANGED
@@ -148,23 +148,25 @@ class AviatorBot:
148
  """Navigate to Aviator and find the game iframe"""
149
  logger.info(f"Navigating to: {self.config['BASE_URL']}")
150
  await self.page.goto(self.config['BASE_URL'], wait_until="domcontentloaded", timeout=60000)
151
- logger.info("Game page loaded. Waiting 5s for game iframe to initialize...")
152
- await asyncio.sleep(5)
153
-
154
- try:
155
- # Search all frames for any spribegaming/aviator URL
156
  for f in self.page.frames:
157
- logger.info(f" Frame URL: {f.url}")
158
- if any(k in f.url for k in ["spribegaming", "aviator", "launch.spribe"]):
 
 
 
 
159
  self.game_frame = f
160
  logger.info(f"✅ Aviator iframe found: {f.url}")
161
  return True
162
-
163
- logger.error("❌ Could not find Aviator game iframe after scanning all frames.")
164
- return False
165
- except Exception as e:
166
- logger.error(f"Error entering game: {e}")
167
- return False
168
 
169
  async def monitor_results(self):
170
  """Monitor game events by polling the DOM inside the Aviator iframe"""
 
148
  """Navigate to Aviator and find the game iframe"""
149
  logger.info(f"Navigating to: {self.config['BASE_URL']}")
150
  await self.page.goto(self.config['BASE_URL'], wait_until="domcontentloaded", timeout=60000)
151
+ logger.info("Game page loaded. Waiting up to 30s for game iframe to initialize...")
152
+
153
+ for _ in range(30):
 
 
154
  for f in self.page.frames:
155
+ logger.debug(f" Frame URL: {f.url}")
156
+ if "spribe" in f.url or "aviator" in f.url:
157
+ # Check if it's the demo game
158
+ if "demo" in f.url:
159
+ logger.warning("⚠️ Demo game loaded instead of real game!")
160
+
161
  self.game_frame = f
162
  logger.info(f"✅ Aviator iframe found: {f.url}")
163
  return True
164
+
165
+ # Wait 1s and check again
166
+ await asyncio.sleep(1)
167
+
168
+ logger.error(" Could not find Aviator game iframe after scanning all frames.")
169
+ return False
170
 
171
  async def monitor_results(self):
172
  """Monitor game events by polling the DOM inside the Aviator iframe"""