Skip to content

Commit

Permalink
👀 Interlude
Browse files Browse the repository at this point in the history
  • Loading branch information
shamhi committed Sep 21, 2024
1 parent b7800a8 commit e8b78d4
Show file tree
Hide file tree
Showing 15 changed files with 418 additions and 577 deletions.
13 changes: 1 addition & 12 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
API_ID=
API_HASH=

MIN_AVAILABLE_ENERGY=
SLEEP_BY_MIN_ENERGY=
SLEEP_TIME=

AUTO_UPGRADE=
MAX_LEVEL=
Expand All @@ -12,13 +11,7 @@ MAX_PRICE=
BALANCE_TO_SAVE=
UPGRADES_COUNT=

MAX_COMBO_PRICE=

APPLY_COMBO=
APPLY_PROMO_CODES=
APPLY_DAILY_CIPHER=
APPLY_DAILY_REWARD=
APPLY_DAILY_ENERGY=
APPLY_DAILY_MINI_GAME=

SLEEP_MINI_GAME_TILES=
Expand All @@ -27,10 +20,6 @@ GAMES_COUNT=

AUTO_COMPLETE_TASKS=

USE_TAPS=
RANDOM_TAPS_COUNT=
SLEEP_BETWEEN_TAP=

USE_RANDOM_DELAY_IN_RUN=
RANDOM_DELAY_IN_RUN=

Expand Down
4 changes: 2 additions & 2 deletions bot/api/boosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def get_boosts(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/boosts-for-buy',
'https://api.hamsterkombatgame.io/interlude/boosts-for-buy',
{},
'getting Boosts',
)
Expand All @@ -28,7 +28,7 @@ async def apply_boost(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/buy-boost',
'https://api.hamsterkombatgame.io/interlude/buy-boost',
{'timestamp': int(time()), 'boostId': boost_id},
'Apply Boost',
)
Expand Down
2 changes: 1 addition & 1 deletion bot/api/cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async def claim_daily_cipher(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/claim-daily-cipher',
'https://api.hamsterkombatgame.io/interlude/claim-daily-cipher',
{'cipher': cipher},
'Claim Daily Cipher',
)
Expand Down
14 changes: 7 additions & 7 deletions bot/api/clicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def get_version_config(
response_json = await make_request(
http_client,
'GET',
f'https://api.hamsterkombatgame.io/clicker/config/{config_version}',
f'https://api.hamsterkombatgame.io/interlude/config/{config_version}',
{},
'getting Version Config',
)
Expand All @@ -27,7 +27,7 @@ async def get_game_config(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/config',
'https://api.hamsterkombatgame.io/interlude/config',
{},
'getting Game Config',
)
Expand All @@ -41,13 +41,13 @@ async def get_profile_data(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/sync',
'https://api.hamsterkombatgame.io/interlude/sync',
{},
'getting Profile Data',
ignore_status=422,
)

profile_data = response_json.get('clickerUser') or response_json.get('found', {}).get('clickerUser', {})
profile_data = response_json.get('interludeUser') or response_json.get('found', {}).get('interludeUser', {})

return profile_data

Expand Down Expand Up @@ -84,7 +84,7 @@ async def get_skins(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/get-skin',
'https://api.hamsterkombatgame.io/interlude/get-skin',
{},
'getting Skins',
)
Expand All @@ -97,7 +97,7 @@ async def send_taps(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/tap',
'https://api.hamsterkombatgame.io/interlude/tap',
{
'availableTaps': available_energy,
'count': taps,
Expand All @@ -107,6 +107,6 @@ async def send_taps(
ignore_status=422,
)

profile_data = response_json.get('clickerUser') or response_json.get('found', {}).get('clickerUser', {})
profile_data = response_json.get('interludeUser') or response_json.get('found', {}).get('interludeUser', {})

return profile_data
2 changes: 1 addition & 1 deletion bot/api/combo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def claim_daily_combo(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/claim-daily-combo',
'https://api.hamsterkombatgame.io/interlude/claim-daily-combo',
{},
'Claim Daily Combo',
)
Expand Down
2 changes: 1 addition & 1 deletion bot/api/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async def select_exchange(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/select-exchange',
'https://api.hamsterkombatgame.io/interlude/select-exchange',
{'exchangeId': exchange_id},
'Select Exchange',
)
Expand Down
10 changes: 5 additions & 5 deletions bot/api/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ async def make_request(
try:
response = await http_client.request(method=method, url=url, json=json_data, ssl=False)

config_version = response.headers.get('Config-Version')
if config_version and not http_client.headers.get('Config-Version'):
http_client.headers['Config-Version'] = config_version
config_version = response.headers.get('Interlude-Config-Version')
if config_version and not http_client.headers.get('Interlude-Config-Version'):
http_client.headers['Interlude-Config-Version'] = config_version

response_text = await response.text()
if ignore_status is None or response.status != ignore_status:
Expand All @@ -36,7 +36,7 @@ async def make_request(

async def handle_error(error: Exception, response_text: str, context: str):
logger.error(
f'Unknown error while {context}: {error} | '
f'Response text: {escape_html(response_text)[:256]}...'
f"Unknown error while {context}: <lr>{error}</lr> | "
f"Response text: {escape_html(response_text)[:256]}..."
)
await asyncio.sleep(delay=3)
11 changes: 5 additions & 6 deletions bot/api/minigame.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def start_daily_mini_game(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/start-keys-minigame',
'https://api.hamsterkombatgame.io/interlude/start-keys-minigame',
{'miniGameId': mini_game_id},
'Start Mini Game',
ignore_status=422
Expand All @@ -27,15 +27,14 @@ async def claim_daily_mini_game(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/claim-daily-keys-minigame',
'https://api.hamsterkombatgame.io/interlude/claim-daily-keys-minigame',
{'cipher': cipher, 'miniGameId': mini_game_id},
'Claim Mini Game',
ignore_status=422
)

profile_data = response_json.get('clickerUser') or response_json.get('found', {}).get('clickerUser', {})
daily_mini_game = response_json.get('dailyKeysMiniGames') or response_json.get('found', {}).get(
'dailyKeysMiniGames', {})
bonus = int(response_json.get('bonus') or response_json.get('found', {}).get('bonus', 0))
profile_data = response_json.get('interludeUser') or response_json.get('found', {}).get('interludeUser', {})
daily_mini_game = response_json.get('dailyKeysMiniGames') or response_json.get('found', {}).get('dailyKeysMiniGames', {})
bonus = float(response_json.get('bonus') or response_json.get('found', {}).get('bonus', 0))

return profile_data, daily_mini_game, bonus
3 changes: 1 addition & 2 deletions bot/api/nuxt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from typing import Any, Union, Dict, List, Optional, Tuple

import aiohttp
Expand All @@ -14,7 +13,7 @@ async def get_nuxt_builds(
response_json = await make_request(
http_client,
'GET',
'https://hamsterkombatgame.io/_nuxt/builds/meta/9091d68b-4157-4eaf-a9f5-e3f3def26c8e.json',
'https://hamsterkombatgame.io/_nuxt/builds/meta/fe021024-d4a8-4ad9-ab6f-3ce2a6e9db47.json',
None,
'getting Nuxt Builds'
)
Expand Down
6 changes: 3 additions & 3 deletions bot/api/promo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def get_promos(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/get-promos',
'https://api.hamsterkombatgame.io/interlude/get-promos',
{},
'getting Promos'
)
Expand All @@ -40,13 +40,13 @@ async def apply_promo(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/apply-promo',
'https://api.hamsterkombatgame.io/interlude/apply-promo',
{'promoCode': promo_code},
'Apply Promo',
ignore_status=422
)

profile_data = response_json.get('clickerUser', {}) or response_json.get('found', {}).get('clickerUser', {})
profile_data = response_json.get('interludeUser', {}) or response_json.get('found', {}).get('interludeUser', {})
promo_state = response_json.get('promoState', {}) or response_json.get('found', {}).get('promoState', {})
reward_promo = response_json.get('reward', {}) or response_json.get('found', {}).get('reward', {})

Expand Down
8 changes: 4 additions & 4 deletions bot/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def get_tasks(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/list-tasks',
'https://api.hamsterkombatgame.io/interlude/list-tasks',
{},
'getting Tasks',
)
Expand All @@ -27,7 +27,7 @@ async def get_airdrop_tasks(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/list-airdrop-tasks',
'https://api.hamsterkombatgame.io/interlude/list-airdrop-tasks',
{},
'getting Airdrop Tasks',
)
Expand All @@ -41,13 +41,13 @@ async def check_task(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/check-task',
'https://api.hamsterkombatgame.io/interlude/check-task',
{'taskId': task_id},
'Check Task',
ignore_status=422
)

task = response_json.get('task', {}) or response_json.get('found', {}).get('task')
profile_data = response_json.get('clickerUser') or response_json.get('found', {}).get('clickerUser', {})
profile_data = response_json.get('interludeUser') or response_json.get('found', {}).get('interludeUser', {})

return task, profile_data
4 changes: 2 additions & 2 deletions bot/api/upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def get_upgrades(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/upgrades-for-buy',
'https://api.hamsterkombatgame.io/interlude/upgrades-for-buy',
{},
'getting Upgrades',
)
Expand All @@ -26,7 +26,7 @@ async def buy_upgrade(
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/buy-upgrade',
'https://api.hamsterkombatgame.io/interlude/buy-upgrade',
{'timestamp': int(time()), 'upgradeId': upgrade_id},
'buying Upgrade',
ignore_status=422,
Expand Down
20 changes: 18 additions & 2 deletions bot/api/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,29 @@
from bot.api.http import make_request


async def get_withdraw_list(
http_client: aiohttp.ClientSession
) -> Dict[str, Any]:
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/interlude/withdraw/list',
{},
'getting Withdraw List'
)

withdraw_list = response_json

return withdraw_list


async def set_ton_wallet(
http_client: aiohttp.ClientSession, address: str
) -> Dict[str, Any]:
response_json = await make_request(
http_client,
'POST',
'https://api.hamsterkombatgame.io/clicker/withdraw/set-wallet-as-default',
'https://api.hamsterkombatgame.io/interlude/withdraw/set-wallet-as-default',
{
"id": "TonWallet",
"walletAddress": address
Expand All @@ -20,6 +36,6 @@ async def set_ton_wallet(
422
)

profile_data = response_json.get('clickerUser') or response_json.get('found', {}).get('clickerUser', {})
profile_data = response_json.get('interludeUser') or response_json.get('found', {}).get('interludeUser', {})

return profile_data
21 changes: 5 additions & 16 deletions bot/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,20 @@
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", env_ignore_empty=True)

API_ID: int = 0
API_ID: float = 0
API_HASH: str = ''

MIN_AVAILABLE_ENERGY: int = 200
SLEEP_BY_MIN_ENERGY: List[int] = [1800, 3600]
SLEEP_TIME: Union[List[int], int] = [2700, 8100]

AUTO_UPGRADE: bool = False
MAX_LEVEL: int = 20
MIN_PROFIT: int = 1000
MAX_PRICE: int = 50000000
MIN_PROFIT: float = 0.000001
MAX_PRICE: float = 500.0

BALANCE_TO_SAVE: int = 1000000
BALANCE_TO_SAVE: float = 0.000001
UPGRADES_COUNT: int = 10

MAX_COMBO_PRICE: int = 10000000

APPLY_COMBO: bool = True
APPLY_PROMO_CODES: bool = True
APPLY_DAILY_CIPHER: bool = True
APPLY_DAILY_REWARD: bool = True
APPLY_DAILY_ENERGY: bool = True
APPLY_DAILY_MINI_GAME: bool = True

SLEEP_MINI_GAME_TILES: List[int] = [600, 900]
Expand All @@ -34,10 +27,6 @@ class Settings(BaseSettings):

AUTO_COMPLETE_TASKS: bool = True

USE_TAPS: bool = True
RANDOM_TAPS_COUNT: List[int] = [10, 50]
SLEEP_BETWEEN_TAP: List[int] = [10, 25]

USE_RANDOM_DELAY_IN_RUN: bool = False
RANDOM_DELAY_IN_RUN: List[int] = [0, 15]

Expand Down
Loading

0 comments on commit e8b78d4

Please sign in to comment.