MCPcopy Create free account
hub / github.com/HiddenCodeDevs/BlumTelegramBot / play_drop_game

Method play_drop_game

bot/core/tapper.py:151–218  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

149 return is_task_started
150
151 async def play_drop_game(self):
152 if settings.PLAY_GAMES is not True or not self.play_passes:
153 return
154
155 if settings.USE_CUSTOM_PAYLOAD_SERVER is not True:
156 return self._log.warning(f"Payload server not used. Pass play games!")
157
158 if not await check_payload_server(settings.CUSTOM_PAYLOAD_SERVER_URL, full_test=True):
159 self._log.warning(
160 f"Payload server not available. Skip games... "
161 f"Info: https://github.com/HiddenCodeDevs/BlumTelegramBot/blob/main/PAYLOAD-SERVER.MD"
162 )
163 return
164
165 tries = 3
166
167 while self.play_passes:
168 if tries <= 0:
169 return self._log.warning('No more trying, gonna skip games')
170 if not await check_payload_server(settings.CUSTOM_PAYLOAD_SERVER_URL):
171 self._log.info(f"Couldn't start play in game! Reason: payload server not available")
172 tries -= 1
173 continue
174
175
176 await asyncio.sleep(uniform(1, 3))
177 game_data = await self._api.start_game()
178 game_assets = game_data.get("assets", {})
179 game_id = game_data.get("gameId")
180 if not game_id:
181 self._log.info(f"Couldn't start play in game! Reason: error get game_id!")
182 tries -= 1
183 continue
184
185 is_normal_structure = True
186
187 for asset in ("BOMB", "CLOVER", "FREEZE"):
188 if not asset in game_assets:
189 is_normal_structure = False
190 break
191
192 if not is_normal_structure:
193 settings.PLAY_GAMES = False
194 self._log.error("<r>STOP PLAYING GAMES!</r> Unknown game data structure. Say developers for this!")
195
196 sleep_time = uniform(30, 42)
197 self._log.info(f"Started playing game. <r>Sleep {int(sleep_time)}s...</r>")
198
199 await asyncio.sleep(sleep_time)
200 freezes = int((sleep_time - 30) / 3)
201 clover = ((randint(settings.POINTS[0], settings.POINTS[1])) // 3) * 3 # blum points
202
203 blum_amount = clover
204 earned_points = {"BP": {"amount": blum_amount}}
205 asset_clicks = {
206 "BOMB": {"clicks": 0},
207 "CLOVER": {"clicks": clover},
208 "FREEZE": {"clicks": freezes},

Callers 1

runMethod · 0.95

Calls 7

update_user_balanceMethod · 0.95
update_points_balanceMethod · 0.95
check_payload_serverFunction · 0.90
get_payloadFunction · 0.90
start_gameMethod · 0.80
getMethod · 0.80
claim_gameMethod · 0.80

Tested by

no test coverage detected