Skip to content

Commit

Permalink
🔥 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
shamhi committed Aug 2, 2024
1 parent 8f1089c commit cb0d5f3
Showing 1 changed file with 55 additions and 68 deletions.
123 changes: 55 additions & 68 deletions bot/core/tapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from bot.exceptions import InvalidSession

from bot.api.auth import login
from bot.api.clicker import get_config, get_profile_data, get_ip_info, get_account_info, send_taps
from bot.api.clicker import get_config, get_profile_data, get_ip_info, get_account_info, get_skins, send_taps
from bot.api.boosts import get_boosts, apply_boost
from bot.api.upgrades import get_upgrades, buy_upgrade
from bot.api.combo import claim_daily_combo, get_combo_cards
Expand Down Expand Up @@ -52,6 +52,9 @@ async def run(self, proxy: str | None) -> None:

tg_web_data = await get_tg_web_data(tg_client=self.tg_client, proxy=proxy, session_name=self.session_name)

if not tg_web_data:
return

while True:
try:
if http_client.closed:
Expand Down Expand Up @@ -87,6 +90,7 @@ async def run(self, proxy: str | None) -> None:
tasks = await get_tasks(http_client=http_client)
airdrop_tasks = await get_airdrop_tasks(http_client=http_client)
ip_info = await get_ip_info(http_client=http_client)
skins = await get_skins(http_client=http_client)

ip = ip_info.get('ip', 'NO')
country_code = ip_info.get('country_code', 'NO')
Expand All @@ -108,7 +112,7 @@ async def run(self, proxy: str | None) -> None:

upgrades = upgrades_data['upgradesForBuy']
daily_combo = upgrades_data.get('dailyCombo')
if daily_combo:
if daily_combo and settings.APPLY_COMBO:
bonus = daily_combo['bonusCoins']
is_claimed = daily_combo['isClaimed']
upgraded_list = daily_combo['upgradeIds']
Expand Down Expand Up @@ -178,23 +182,26 @@ async def run(self, proxy: str | None) -> None:
logger.success(f"{self.session_name} | Successfully claimed daily combo | "
f"Bonus: <lg>+{bonus:,}</lg>")

daily_task = tasks[-1]
rewards = daily_task['rewardsByDays']
is_completed = daily_task['isCompleted']
days = daily_task['days']

await asyncio.sleep(delay=2)

if is_completed is False:
status = await claim_daily_reward(http_client=http_client)
if status is True:
logger.success(f"{self.session_name} | Successfully get daily reward | "
f"Days: <lm>{days}</lm> | Reward coins: <lg>+{rewards[days - 1]['rewardCoins']}</lg>")
if settings.APPLY_DAILY_REWARD:
daily_task = tasks[-1]
rewards = daily_task['rewardsByDays']
is_completed = daily_task['isCompleted']
days = daily_task['days']

await asyncio.sleep(delay=2)

if is_completed is False:
status = await claim_daily_reward(http_client=http_client)
if status is True:
logger.success(f"{self.session_name} | Successfully get daily reward | "
f"Days: <lm>{days}</lm> | Reward coins: <lg>+{rewards[days - 1]['rewardCoins']}</lg>")

await asyncio.sleep(delay=2)

daily_cipher = game_config.get('dailyCipher')
if daily_cipher:
if daily_cipher and settings.APPLY_DAILY_CIPHER:
cipher = daily_cipher['cipher']
bonus = daily_cipher['bonusCoins']
is_claimed = daily_cipher['isClaimed']
Expand All @@ -213,7 +220,7 @@ async def run(self, proxy: str | None) -> None:
await asyncio.sleep(delay=2)

daily_mini_game = game_config.get('dailyKeysMiniGame')
if daily_mini_game:
if daily_mini_game and settings.APPLY_DAILY_MINI_GAME:
is_claimed = daily_mini_game['isClaimed']
seconds_to_next_attempt = daily_mini_game['remainSecondsToNextAttempt']
start_date = daily_mini_game['startDate']
Expand Down Expand Up @@ -262,70 +269,50 @@ async def run(self, proxy: str | None) -> None:

await asyncio.sleep(delay=2)

promos = game_config.get('clickerConfig', {}).get('promos')
if promos:
promo_apps = promos['apps']
event_timeout = promos['registerEventTimeoutSec']

for app in promo_apps:
promos_data = await get_promos(http_client=http_client)
promo_states = promos_data.get('states', [])
if settings.APPLY_PROMO_CODES:
promos_data = await get_promos(http_client=http_client)
promo_states = promos_data.get('states', [])

promo_activates = {promo['promoId']: promo['receiveKeysToday']
for promo in promo_states}
promo_activates = {promo['promoId']: promo['receiveKeysToday']
for promo in promo_states}

is_blocked = app['blocked']

if is_blocked:
continue
app_token = "d28721be-fd2d-4b45-869e-9f253b554e50"
promo_id = "43e35910-c168-4634-ad4f-52fd764a843f"

app_token = app['token']
promos = app['promos']
keys_per_day = 4
keys_per_code = 1

for promo in promos:
is_blocked = promo['blocked']
today_promo_activates_count = promo_activates.get(promo_id, 0)

if is_blocked:
continue
while today_promo_activates_count < keys_per_day:
promo_code = await get_promo_code(app_token=app_token,
promo_id=promo_id,
max_attempts=10,
event_timeout=20,
session_name=self.session_name,
proxy=proxy)

promo_id = promo['promoId']
prefix = promo['prefix']

max_attempts = promo['eventsCount']
keys_per_day = promo['keysPerDay']
keys_per_code = promo['keysPerCode']

today_promo_activates_count = promo_activates.get(promo_id, 0)

while today_promo_activates_count < keys_per_day:
promo_code = await get_promo_code(app_token=app_token,
promo_id=promo_id,
max_attempts=max_attempts,
event_timeout=event_timeout,
session_name=self.session_name,
proxy=proxy)

if not promo_code:
continue
if not promo_code:
continue

profile_data, promo_state = await apply_promo(http_client=http_client,
promo_code=promo_code)
profile_data, promo_state = await apply_promo(http_client=http_client,
promo_code=promo_code)

if profile_data and promo_state:
total_keys = profile_data.get('totalKeys', total_keys)
today_promo_activates_count = promo_state.get('receiveKeysToday',
today_promo_activates_count)
if profile_data and promo_state:
total_keys = profile_data.get('totalKeys', total_keys)
today_promo_activates_count = promo_state.get('receiveKeysToday',
today_promo_activates_count)

logger.success(f"{self.session_name} | "
f"Successfully activated promo code <lc>{promo_code}</lc> in <lm>{prefix}</lm> game | "
f"Get <ly>{today_promo_activates_count}</ly><lw>/</lw><ly>{keys_per_day}</ly> keys | "
f"Total keys: <le>{total_keys}</le> (<lg>+{keys_per_code}</lg>)")
else:
logger.info(f"{self.session_name} | "
f"Promo code <lc>{promo_code}</lc> was wrong in <lm>{prefix}</lm> game | "
f"Trying again...")
logger.success(f"{self.session_name} | "
f"Successfully activated promo code <lc>{promo_code}</lc> in <lm>BIKE</lm> game | "
f"Get <ly>{today_promo_activates_count}</ly><lw>/</lw><ly>{keys_per_day}</ly> keys | "
f"Total keys: <le>{total_keys}</le> (<lg>+{keys_per_code}</lg>)")
else:
logger.info(f"{self.session_name} | "
f"Promo code <lc>{promo_code}</lc> was wrong in <lm>BIKE</lm> game | "
f"Trying again...")

await asyncio.sleep(delay=2)
await asyncio.sleep(delay=2)

await asyncio.sleep(delay=2)

Expand Down

0 comments on commit cb0d5f3

Please sign in to comment.