Skip to content

Commit

Permalink
🛠 Fix mini games claim
Browse files Browse the repository at this point in the history
  • Loading branch information
shamhi committed Aug 31, 2024
1 parent da0a9a8 commit 0464d82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 3 additions & 5 deletions bot/core/tapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ async def run(self, proxy: str | None) -> None:
encoded_body = await get_mini_game_cipher(
user_id=user_id,
start_date=start_date,
score=0,
mini_game_id=mini_game_id,
)

Expand Down Expand Up @@ -327,7 +326,6 @@ async def run(self, proxy: str | None) -> None:
encoded_body = await get_mini_game_cipher(
user_id=user_id,
start_date=start_date,
score=game_score,
mini_game_id=mini_game_id,
)

Expand All @@ -347,9 +345,9 @@ async def run(self, proxy: str | None) -> None:
new_balance = int(profile_data.get('balanceCoins', 0))
balance = new_balance

logger.success(
f"{self.session_name} | Successfully claimed Mini Game <lm>{mini_game_id}</lm> | "
f"Balance <le>{balance:,}</le> (<lg>+{bonus:,}</lg>)")
logger.success(f"{self.session_name} | "
f"Successfully claimed Mini Game <lm>{mini_game_id}</lm> | "
f"Balance <le>{balance:,}</le> (<lg>+{bonus:,}</lg>)")
else:
if is_claimed:
logger.info(f"{self.session_name} | Daily Mini Game already claimed today")
Expand Down
13 changes: 9 additions & 4 deletions bot/utils/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,19 @@ async def get_game_cipher(start_number: str):

async def get_mini_game_cipher(user_id: int,
start_date: str,
score: int,
mini_game_id: str):
mini_game_id: str,
sleep: int = 40):
secret1 = "R1cHard_AnA1"
secret2 = "G1ve_Me_y0u7_Pa55w0rD"

start_dt = datetime.datetime.strptime(start_date, "%Y-%m-%dT%H:%M:%S.%fZ")

start_number = int(start_dt.replace(tzinfo=datetime.timezone.utc).timestamp())
cipher_score = (start_number + sleep) * 2

cipher_score = start_number * 2 + score
combined_string = f'{secret1}{cipher_score}{secret2}'

sig = hashlib.sha256(f'415t1ng{cipher_score}0ra1cum5h0t'.encode()).digest()
sig = hashlib.sha256(combined_string.encode()).digest()
sig = base64.b64encode(sig).decode()

game_cipher = await get_game_cipher(start_number=start_number)
Expand Down

0 comments on commit 0464d82

Please sign in to comment.