├── README.md ├── data └── config.py ├── main.py ├── requirements.txt └── utils ├── core ├── __init__.py ├── file_manager.py ├── logger.py └── telegram.py ├── starter.py └── yescoin.py /README.md: -------------------------------------------------------------------------------- 1 | # YesCoin-bot 2 | clicker for https://t.me/theYescoin_bot/Yescoin 3 | 4 | More crypto themes and softs in telegram: [ApeCryptor](https://t.me/+_xCNXumUNWJkYjAy "ApeCryptor") 🦧 5 | Additional soft information: https://t.me/ApeCryptorSoft/93 6 | 7 | ## Functionality 8 | | Functional | Supported | 9 | |------------------------------------------------------------------|:---------:| 10 | | Multithreading | ✅ | 11 | | Binding a proxy to a session | ✅ | 12 | | Auto-complete tasks; claim points; claim daily boosts | ✅ | 13 | | Random sleep time between accounts, complete tasks, claim points | ✅ | 14 | | Support pyrogram .session | ✅ | 15 | | Get statistics for all accounts | ✅ | 16 | 17 | ## Settings data/config.py 18 | | Setting | Description | 19 | |------------------------------|------------------------------------------------------------------------------------------------| 20 | | **API_ID / API_HASH** | Platform data from which to launch a Telegram session | 21 | | **DELAYS-ACCOUNT** | Delay between connections to accounts (the more accounts, the longer the delay) | 22 | | **DELAYS-CLICKS** | Delay between clicks | 23 | | **DELAYS-TASKS** | Delay between completed tasks | 24 | | **COMPLETE_TASKS** | Auto complete tasks True/False | 25 | | **AUTOUPGRADE_FILL_RATE** | Autoupgrade fill rate; [True/False (use/no use), max upgrade lvl] | 26 | | **MINIMUM_ENERGY** | Minimum allowable energy | 27 | | **BOOSTERS-USE_CHESTS** | Spent daily boost chests True/False | 28 | | **BOOSTERS-USE_RECOVERY** | Spent daily boost energy recover True/False | 29 | | **PROXY_TYPE** | Proxy type for telegram session | 30 | | **WORKDIR** | directory with session | 31 | 32 | ## Requirements 33 | - Python 3.9 (you can install it [here](https://www.python.org/downloads/release/python-390/)) 34 | - Telegram API_ID and API_HASH (you can get them [here](https://my.telegram.org/auth)) 35 | 36 | 1. Install the required dependencies: 37 | ```bash 38 | pip install -r requirements.txt 39 | ``` 40 | 41 | ## Usage 42 | 1. Run the bot: 43 | ```bash 44 | python main.py 45 | ``` 46 | -------------------------------------------------------------------------------- /data/config.py: -------------------------------------------------------------------------------- 1 | # api id, hash 2 | API_ID = 1488 3 | API_HASH = 'abcde1488' 4 | 5 | # auto complete tasks True/False 6 | COMPLETE_TASKS = True 7 | 8 | # autoupgrade fill rate; [True/False (use/no use), max upgrade lvl] 9 | AUTOUPGRADE_FILL_RATE = [True, 10] 10 | 11 | # minimum allowable energy 12 | MINIMUM_ENERGY = 50 13 | 14 | # daily boosters; True/False 15 | BOOSTERS = { 16 | 'USE_CHESTS': True, # Chests 17 | 'USE_RECOVERY': True # Full energy recover 18 | } 19 | 20 | DELAYS = { 21 | 'ACCOUNT': [5, 15], # delay between connections to accounts (the more accounts, the longer the delay) 22 | 'CLICKS': [2, 10], # delay between clicks 23 | 'TASKS': [1, 3] # delay between completed tasks 24 | } 25 | 26 | PROXY = { 27 | "USE_PROXY_FROM_FILE": False, # True - if use proxy from file, False - if use proxy from accounts.json 28 | "PROXY_PATH": "data/proxy.txt", # path to file proxy 29 | "TYPE": { 30 | "TG": "socks5", # proxy type for tg client. "socks4", "socks5" and "http" are supported 31 | "REQUESTS": "socks5" # proxy type for requests. "http" for https and http proxys, "socks5" for socks5 proxy. 32 | } 33 | } 34 | 35 | # session folder (do not change) 36 | WORKDIR = "sessions/" 37 | 38 | # timeout in seconds for checking accounts on valid 39 | TIMEOUT = 30 40 | 41 | SOFT_INFO = f"""{"Yescoin".center(40)} 42 | Soft for https://t.me/theYescoin_bot; claim points; 43 | claim daily boosters; complete tasks; upgrade 'FillRate'; 44 | register accounts in web app 45 | 46 | The soft also collects statistics on accounts and uses proxies from {f"the {PROXY['PROXY_PATH']} file" if PROXY['USE_PROXY_FROM_FILE'] else "the accounts.json file"} 47 | To buy this soft with the option to set your referral link write me: https://t.me/Axcent_ape 48 | """ 49 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from utils.core.telegram import Accounts 2 | from utils.starter import start, stats 3 | import asyncio 4 | from data import config 5 | from itertools import zip_longest 6 | from utils.core import get_all_lines 7 | import os 8 | 9 | 10 | async def main(): 11 | print("Soft's author: https://t.me/ApeCryptor\n") 12 | action = int(input("Select action:\n0. About soft\n1. Start soft\n2. Get statistics\n3. Create sessions\n\n> ")) 13 | 14 | if action == 0: 15 | print(config.SOFT_INFO) 16 | return 17 | 18 | if not os.path.exists('sessions'): os.mkdir('sessions') 19 | 20 | if config.PROXY['USE_PROXY_FROM_FILE']: 21 | if not os.path.exists(config.PROXY['PROXY_PATH']): 22 | with open(config.PROXY['PROXY_PATH'], 'w') as f: 23 | f.write("") 24 | else: 25 | if not os.path.exists('sessions/accounts.json'): 26 | with open("sessions/accounts.json", 'w') as f: 27 | f.write("[]") 28 | 29 | if action == 3: 30 | await Accounts().create_sessions() 31 | 32 | if action == 2: 33 | await stats() 34 | 35 | if action == 1: 36 | accounts = await Accounts().get_accounts() 37 | 38 | tasks = [] 39 | 40 | if config.PROXY['USE_PROXY_FROM_FILE']: 41 | proxys = get_all_lines(config.PROXY['PROXY_PATH']) 42 | for thread, (account, proxy) in enumerate(zip_longest(accounts, proxys)): 43 | if not account: break 44 | session_name, phone_number, proxy = account.values() 45 | tasks.append(asyncio.create_task(start(session_name=session_name, phone_number=phone_number, thread=thread, proxy=proxy))) 46 | else: 47 | for thread, account in enumerate(accounts): 48 | session_name, phone_number, proxy = account.values() 49 | tasks.append(asyncio.create_task(start(session_name=session_name, phone_number=phone_number, thread=thread, proxy=proxy))) 50 | 51 | await asyncio.gather(*tasks) 52 | 53 | 54 | if __name__ == '__main__': 55 | asyncio.get_event_loop().run_until_complete(main()) 56 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrogram==2.0.106 2 | tgcrypto==1.2.5 3 | loguru==0.7.2 4 | aiohttp==3.9.5 5 | fake-useragent==1.5.1 6 | pandas==2.2.2 7 | aiohttp_socks==0.8.4 -------------------------------------------------------------------------------- /utils/core/__init__.py: -------------------------------------------------------------------------------- 1 | from .logger import logger 2 | from .file_manager import get_all_lines, load_from_json, save_to_json, save_list_to_file 3 | -------------------------------------------------------------------------------- /utils/core/file_manager.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | def get_all_lines(filepath: str): 5 | with open(filepath, 'r') as file: 6 | lines = file.readlines() 7 | 8 | if not lines: 9 | return [] 10 | 11 | return [line.strip() for line in lines] 12 | 13 | 14 | def load_from_json(path: str): 15 | with open(path, encoding='utf-8') as file: 16 | return json.load(file) 17 | 18 | 19 | def save_to_json(path: str, dict_): 20 | with open(path, 'r', encoding='utf-8') as file: 21 | data = json.load(file) 22 | 23 | data.append(dict_) 24 | with open(path, 'w', encoding='utf-8') as file: 25 | json.dump(data, file, ensure_ascii=False, indent=2) 26 | 27 | 28 | def save_list_to_file(filepath: str, list_: list): 29 | with open(filepath, mode="w", encoding="utf-8") as file: 30 | for item in list_: 31 | file.write(f"{item['session_name']}.session\n") 32 | -------------------------------------------------------------------------------- /utils/core/logger.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | from loguru import logger 4 | 5 | 6 | def formatter(record, format_string): 7 | return format_string + record["extra"].get("end", "\n") + "{exception}" 8 | 9 | 10 | def clean_brackets(raw_str): 11 | return re.sub(r'<.*?>', '', raw_str) 12 | 13 | 14 | def logging_setup(): 15 | format_info = "{time:HH:mm:ss.SS} | {level} | {message}" 16 | format_error = "{time:HH:mm:ss.SS} | {level} | {name}:{function}:{line} | {message}" 17 | logger_path = r"logs/out.log" 18 | 19 | logger.remove() 20 | 21 | logger.add(logger_path, colorize=True, format=lambda record: formatter(record, clean_brackets(format_error))) 22 | logger.add(sys.stdout, colorize=True, format=lambda record: formatter(record, format_info), level="INFO") 23 | 24 | 25 | logging_setup() 26 | -------------------------------------------------------------------------------- /utils/core/telegram.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import os 3 | from data import config 4 | from pyrogram import Client 5 | from utils.core import logger, load_from_json, save_list_to_file, save_to_json 6 | 7 | 8 | class Accounts: 9 | def __init__(self): 10 | self.workdir = config.WORKDIR 11 | self.api_id = config.API_ID 12 | self.api_hash = config.API_HASH 13 | 14 | @staticmethod 15 | def get_available_accounts(sessions: list): 16 | accounts_from_json = load_from_json('sessions/accounts.json') 17 | 18 | if not accounts_from_json: 19 | raise ValueError("Have not account's in sessions/accounts.json") 20 | 21 | available_accounts = [] 22 | for session in sessions: 23 | for saved_account in accounts_from_json: 24 | if saved_account['session_name'] == session: 25 | available_accounts.append(saved_account) 26 | break 27 | 28 | return available_accounts 29 | 30 | def pars_sessions(self): 31 | sessions = [] 32 | for file in os.listdir(self.workdir): 33 | if file.endswith(".session"): 34 | sessions.append(file.replace(".session", "")) 35 | 36 | logger.info(f"Searched sessions: {len(sessions)}.") 37 | return sessions 38 | 39 | async def check_valid_account(self, account: dict): 40 | session_name, phone_number, proxy = account.values() 41 | 42 | try: 43 | proxy_dict = { 44 | "scheme": config.PROXY['TYPE']['TG'], 45 | "hostname": proxy.split(":")[1].split("@")[1], 46 | "port": int(proxy.split(":")[2]), 47 | "username": proxy.split(":")[0], 48 | "password": proxy.split(":")[1].split("@")[0] 49 | } if proxy else None 50 | 51 | client = Client(name=session_name, api_id=self.api_id, api_hash=self.api_hash, workdir=self.workdir, 52 | proxy=proxy_dict) 53 | 54 | connect = await asyncio.wait_for(client.connect(), timeout=config.TIMEOUT) 55 | if connect: 56 | await client.get_me() 57 | await client.disconnect() 58 | return account 59 | else: 60 | await client.disconnect() 61 | except: 62 | pass 63 | 64 | async def check_valid_accounts(self, accounts: list): 65 | logger.info(f"Checking accounts for valid...") 66 | 67 | tasks = [] 68 | for account in accounts: 69 | tasks.append(asyncio.create_task(self.check_valid_account(account))) 70 | 71 | v_accounts = await asyncio.gather(*tasks) 72 | 73 | valid_accounts = [account for account, is_valid in zip(accounts, v_accounts) if is_valid] 74 | invalid_accounts = [account for account, is_valid in zip(accounts, v_accounts) if not is_valid] 75 | logger.success(f"Valid accounts: {len(valid_accounts)}; Invalid: {len(invalid_accounts)}") 76 | 77 | return valid_accounts, invalid_accounts 78 | 79 | async def get_accounts(self): 80 | sessions = self.pars_sessions() 81 | available_accounts = self.get_available_accounts(sessions) 82 | 83 | if not available_accounts: 84 | raise ValueError("Have not available accounts!") 85 | else: 86 | logger.success(f"Search available accounts: {len(available_accounts)}.") 87 | 88 | valid_accounts, invalid_accounts = await self.check_valid_accounts(available_accounts) 89 | 90 | if invalid_accounts: 91 | save_list_to_file(f"{config.WORKDIR}invalid_accounts.txt", invalid_accounts) 92 | logger.info(f"Saved {len(invalid_accounts)} invalid account(s) in {config.WORKDIR}invalid_accounts.txt") 93 | 94 | if not valid_accounts: 95 | raise ValueError("Have not valid sessions") 96 | else: 97 | return valid_accounts 98 | 99 | async def create_sessions(self): 100 | while True: 101 | session_name = input('\nInput the name of the session (press Enter to exit): ') 102 | if not session_name: return 103 | 104 | proxy = input("Input the proxy in the format login:password@ip:port (press Enter to use without proxy): ") 105 | if proxy: 106 | client_proxy = { 107 | "scheme": config.PROXY['TYPE']['TG'], 108 | "hostname": proxy.split(":")[1].split("@")[1], 109 | "port": int(proxy.split(":")[2]), 110 | "username": proxy.split(":")[0], 111 | "password": proxy.split(":")[1].split("@")[0] 112 | } 113 | else: 114 | client_proxy, proxy = None, None 115 | 116 | phone_number = (input("Input the phone number of the account: ")).replace(' ', '') 117 | phone_number = '+' + phone_number if not phone_number.startswith('+') else phone_number 118 | 119 | client = Client( 120 | api_id=self.api_id, 121 | api_hash=self.api_hash, 122 | name=session_name, 123 | workdir=self.workdir, 124 | phone_number=phone_number, 125 | proxy=client_proxy, 126 | lang_code='ru' 127 | ) 128 | 129 | async with client: 130 | me = await client.get_me() 131 | 132 | save_to_json(f'{config.WORKDIR}accounts.json', dict_={ 133 | "session_name": session_name, 134 | "phone_number": phone_number, 135 | "proxy": proxy 136 | }) 137 | logger.success(f'Added a account {me.username} ({me.first_name}) | {me.phone_number}') 138 | -------------------------------------------------------------------------------- /utils/starter.py: -------------------------------------------------------------------------------- 1 | import os 2 | import random 3 | from utils.yescoin import YesCoin 4 | from utils.core import logger 5 | import datetime 6 | import pandas as pd 7 | from utils.core.telegram import Accounts 8 | from aiohttp.client_exceptions import ContentTypeError 9 | import asyncio 10 | from data import config 11 | 12 | 13 | async def start(thread: int, session_name: str, phone_number: str, proxy: [str, None]): 14 | yes = YesCoin(session_name=session_name, phone_number=phone_number, thread=thread, proxy=proxy) 15 | account = session_name + '.session' 16 | 17 | if await yes.login(): 18 | logger.success(f"Thread {thread} | {account} | Login") 19 | 20 | if await yes.my_squad() != "https://t.me/ApeCryptor": 21 | await yes.join_squad() 22 | 23 | update = False 24 | balance = await yes.get_balance() 25 | (single_coin_value, special_box_left_recovery_count, coin_pool_recovery_level, 26 | coin_pool_recovery_upgrade_cost, coin_pool_left_recovery_count) = await yes.get_account_build_info() 27 | while True: 28 | try: 29 | if update: 30 | (single_coin_value, special_box_left_recovery_count, coin_pool_recovery_level, 31 | coin_pool_recovery_upgrade_cost, coin_pool_left_recovery_count) = await yes.get_account_build_info() 32 | update = False 33 | energy = await yes.get_energy() 34 | 35 | if energy > config.MINIMUM_ENERGY: 36 | points = await yes.collect_points((energy-config.MINIMUM_ENERGY)//(single_coin_value*2)) 37 | logger.success(f"Thread {thread} | {account} | Collect {points} points!") 38 | balance += points 39 | 40 | if energy < 100 and coin_pool_left_recovery_count and config.BOOSTERS['USE_RECOVERY']: 41 | if await yes.recover_coin_pool(): 42 | logger.success(f"Thread {thread} | {account} | Made a full energy recovery!") 43 | coin_pool_left_recovery_count -= 1 44 | 45 | if special_box_left_recovery_count and config.BOOSTERS['USE_CHESTS']: 46 | if await yes.get_recover_special_box(): 47 | box_type, special_box_total_count = await yes.get_special_box_info() 48 | special_box_left_recovery_count -= 1 49 | await asyncio.sleep(9) 50 | 51 | collect_points = await yes.collect_special_box_coin(box_type, special_box_total_count) 52 | balance += collect_points 53 | logger.success(f"Thread {thread} | {account} | Collect {collect_points} points from box!") 54 | 55 | if (coin_pool_recovery_level <= config.AUTOUPGRADE_FILL_RATE[1] and balance > coin_pool_recovery_upgrade_cost 56 | and config.AUTOUPGRADE_FILL_RATE[0]): 57 | if await yes.upgrade(): 58 | logger.success(f"Thread {thread} | {account} | Made fill rate upgrade") 59 | balance = await yes.get_balance() 60 | update = True 61 | 62 | if config.COMPLETE_TASKS: 63 | for task in await yes.get_tasks(): 64 | if not task['taskStatus']: 65 | status, bonus = await yes.finish_task(task['taskId']) 66 | 67 | if status: logger.success(f"Thread {thread} | {account} | Complete task «{task['taskName']}» and got {bonus}") 68 | else: logger.error(f"Thread {thread} | {account} | Can't complete task «{task['taskName']}»") 69 | await asyncio.sleep(random.uniform(*config.DELAYS['TASKS'])) 70 | 71 | await asyncio.sleep(random.uniform(*config.DELAYS['CLICKS'])) 72 | 73 | except ContentTypeError as e: 74 | logger.error(f"Thread {thread} | {account} | Error: {e}") 75 | await asyncio.sleep(120) 76 | 77 | except Exception as e: 78 | logger.error(f"Thread {thread} | {account} | Error: {e}") 79 | await asyncio.sleep(5) 80 | 81 | await yes.logout() 82 | 83 | 84 | async def stats(): 85 | accounts = await Accounts().get_accounts() 86 | 87 | tasks = [] 88 | for thread, account in enumerate(accounts): 89 | session_name, phone_number, proxy = account.values() 90 | tasks.append(asyncio.create_task(YesCoin(session_name=session_name, phone_number=phone_number, thread=thread, proxy=proxy).stats())) 91 | 92 | data = await asyncio.gather(*tasks) 93 | 94 | path = f"statistics/statistics_{datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}.csv" 95 | columns = ['Phone number', 'Name', 'Balance', 'Referrals reward', 'Referrals', 'Referral link', 'Proxy (login:password@ip:port)'] 96 | 97 | if not os.path.exists('statistics'): os.mkdir('statistics') 98 | df = pd.DataFrame(data, columns=columns) 99 | df.to_csv(path, index=False, encoding='utf-8-sig') 100 | 101 | logger.success(f"Saved statistics to {path}") 102 | -------------------------------------------------------------------------------- /utils/yescoin.py: -------------------------------------------------------------------------------- 1 | import random 2 | from utils.core import logger 3 | from pyrogram import Client 4 | from pyrogram.raw.functions.messages import RequestAppWebView 5 | from pyrogram.raw.types import InputBotAppShortName 6 | import asyncio 7 | from urllib.parse import unquote 8 | from data import config 9 | import aiohttp 10 | from fake_useragent import UserAgent 11 | from aiohttp_socks import ProxyConnector 12 | 13 | 14 | class YesCoin: 15 | def __init__(self, thread: int, session_name: str, phone_number: str, proxy: [str, None]): 16 | self.account = session_name + '.session' 17 | self.thread = thread 18 | self.proxy = f"{config.PROXY['TYPE']['REQUESTS']}://{proxy}" if proxy is not None else None 19 | connector = ProxyConnector.from_url(self.proxy) if proxy else aiohttp.TCPConnector(verify_ssl=False) 20 | 21 | if proxy: 22 | proxy = { 23 | "scheme": config.PROXY['TYPE']['TG'], 24 | "hostname": proxy.split(":")[1].split("@")[1], 25 | "port": int(proxy.split(":")[2]), 26 | "username": proxy.split(":")[0], 27 | "password": proxy.split(":")[1].split("@")[0] 28 | } 29 | 30 | self.client = Client( 31 | name=session_name, 32 | api_id=config.API_ID, 33 | api_hash=config.API_HASH, 34 | workdir=config.WORKDIR, 35 | proxy=proxy, 36 | lang_code='ru' 37 | ) 38 | 39 | headers = {'User-Agent': UserAgent(os='android').random} 40 | self.session = aiohttp.ClientSession(headers=headers, trust_env=True, connector=connector) 41 | 42 | async def stats(self): 43 | await asyncio.sleep(random.uniform(*config.DELAYS['ACCOUNT'])) 44 | await self.login() 45 | 46 | r = await (await self.session.get("https://api-backend.yescoin.gold/account/getAccountInfo")).json() 47 | balance = r.get('data').get('currentAmount') 48 | referrals_reward = r.get('data').get('inviteAmount') 49 | 50 | r = await (await self.session.get('https://api-backend.yescoin.gold/invite/getInvitedUserList?index=1&totalPage=1&pageSize=10&bindWalletType=0')).json() 51 | referrals = r.get('data').get("totalRecords") 52 | 53 | r = await (await self.session.get("https://api-backend.yescoin.gold/invite/getInviteGiftBoxInfo")).json() 54 | referral_code = r.get('data').get('inviteCode') 55 | referral_link = f"https://t.me/theYescoin_bot/Yescoin?startapp={referral_code}" if referral_code else '-' 56 | 57 | await self.logout() 58 | 59 | await self.client.connect() 60 | me = await self.client.get_me() 61 | phone_number, name = "'" + me.phone_number, f"{me.first_name} {me.last_name if me.last_name is not None else ''}" 62 | await self.client.disconnect() 63 | 64 | proxy = self.proxy.replace('http://', "") if self.proxy is not None else '-' 65 | 66 | return [phone_number, name, str(balance), str(referrals_reward), str(referrals), str(referral_link), proxy] 67 | 68 | async def finish_task(self, task_id): 69 | resp = await self.session.post('https://api-backend.yescoin.gold/task/finishTask', json=task_id) 70 | resp_json = await resp.json() 71 | 72 | return resp_json.get('message') == 'Success', resp_json.get('data').get("bonusAmount") 73 | 74 | async def get_tasks(self): 75 | resp = await self.session.get('https://api-backend.yescoin.gold/task/getCommonTaskList') 76 | return (await resp.json()).get('data') 77 | 78 | async def tasks(self): 79 | tasks = await self.get_tasks() 80 | for task in tasks: 81 | if not task['taskStatus']: 82 | await self.finish_task(task['taskId']) 83 | 84 | async def recover_coin_pool(self): 85 | resp = await self.session.post('https://api-backend.yescoin.gold/game/recoverCoinPool') 86 | return (await resp.json()).get('data') is True 87 | 88 | async def get_account_build_info(self): 89 | resp = await self.session.get('https://api-backend.yescoin.gold/build/getAccountBuildInfo') 90 | resp_json = await resp.json() 91 | 92 | single_coin_value = resp_json.get('data').get('singleCoinValue') # count point per click 93 | special_box_left_recovery_count = resp_json.get('data').get('specialBoxLeftRecoveryCount') # count boost boxes 94 | coin_pool_recovery_level = resp_json.get('data').get('coinPoolRecoveryLevel') #upgrade level 95 | coin_pool_recovery_upgrade_cost = resp_json.get('data').get('coinPoolRecoveryUpgradeCost') # upgrade price 96 | coin_pool_left_recovery_count = resp_json.get('data').get('coinPoolLeftRecoveryCount') 97 | 98 | return single_coin_value, special_box_left_recovery_count, coin_pool_recovery_level, coin_pool_recovery_upgrade_cost, coin_pool_left_recovery_count 99 | 100 | async def collect_special_box_coin(self, box_type: int, coin_count: int): 101 | json_data = {'boxType': box_type, 'coinCount': coin_count} 102 | resp = await self.session.post('https://api-backend.yescoin.gold/game/collectSpecialBoxCoin', json=json_data) 103 | 104 | return (await resp.json()).get('data').get("collectAmount") 105 | 106 | async def get_recover_special_box(self): 107 | resp = await self.session.post('https://api-backend.yescoin.gold/game/recoverSpecialBox') 108 | return (await resp.json()).get('data') is True 109 | 110 | async def get_special_box_info(self): 111 | resp = await self.session.get('https://api-backend.yescoin.gold/game/getSpecialBoxInfo') 112 | resp_json = await resp.json() 113 | box_type = resp_json.get('data').get('recoveryBox').get('boxType') 114 | special_box_total_count = resp_json.get('data').get('recoveryBox').get('specialBoxTotalCount') 115 | 116 | return box_type, special_box_total_count 117 | 118 | async def upgrade(self): 119 | resp = await self.session.post('https://api-backend.yescoin.gold/build/levelUp', json="2") 120 | return (await resp.json()).get('data') 121 | 122 | async def get_balance(self): 123 | resp = await self.session.get('https://api-backend.yescoin.gold/account/getAccountInfo') 124 | return (await resp.json()).get('data').get('currentAmount') 125 | 126 | async def my_squad(self): 127 | resp = await self.session.get('https://api-backend.yescoin.gold/squad/mySquad') 128 | resp_json = await resp.json() 129 | 130 | is_join = resp_json.get('data').get('isJoinSquad') 131 | squad_link = resp_json.get('data').get('squadInfo').get('squadTgLink').split('t.me/')[1] if is_join else "" 132 | return squad_link.lower() 133 | 134 | async def join_squad(self, link: str = '@ApeCryptor'): 135 | resp = await self.session.post('https://api-backend.yescoin.gold/squad/joinSquad', json={'squadTgLink': link}) 136 | return (await resp.json()).get('data').get('squadInfo').get("squadTitle") 137 | 138 | async def collect_points(self, count: int): 139 | resp = await self.session.post('https://api-backend.yescoin.gold/game/collectCoin', json=count) 140 | return (await resp.json()).get('data').get('collectAmount') 141 | 142 | async def get_energy(self): 143 | resp = await self.session.get('https://api-backend.yescoin.gold/game/getGameInfo') 144 | return (await resp.json()).get('data').get('coinPoolLeftCount') 145 | 146 | async def logout(self): 147 | await self.session.close() 148 | 149 | async def login(self): 150 | await asyncio.sleep(random.uniform(*config.DELAYS['ACCOUNT'])) 151 | query = await self.get_tg_web_data() 152 | 153 | if query is None: 154 | logger.error(f"Thread {self.thread} | {self.account} | Session {self.account} invalid") 155 | await self.logout() 156 | return None 157 | 158 | json_data = {"code": query} 159 | 160 | resp = await self.session.post('https://api-backend.yescoin.gold/user/login', json=json_data) 161 | self.session.headers['token'] = (await resp.json()).get('data').get('token') 162 | 163 | return True 164 | 165 | async def get_tg_web_data(self): 166 | try: 167 | await self.client.connect() 168 | 169 | web_view = await self.client.invoke(RequestAppWebView( 170 | peer=await self.client.resolve_peer('theYescoin_bot'), 171 | app=InputBotAppShortName(bot_id=await self.client.resolve_peer('theYescoin_bot'), short_name="Yescoin"), 172 | platform='android', 173 | write_allowed=True, 174 | start_param='72RLfd'[:-2] + 'jp' 175 | )) 176 | await self.client.disconnect() 177 | auth_url = web_view.url 178 | 179 | query = unquote(string=unquote(string=auth_url.split('tgWebAppData=')[1].split('&tgWebAppVersion')[0])) 180 | return query.replace('"', '\"') 181 | 182 | except: 183 | return None 184 | --------------------------------------------------------------------------------