vanhbakaa / PocketFi

Python bot for Pocketfi telegram bot.I have made some improvement to avoid bot detection! Join the bot here
https://t.me/pocketfi_bot/Mining?startapp=6624523270
MIT License
46 stars 4 forks source link

[Feature] | Add auto task with subscribe to channel and twitter #3

Closed berezenko04 closed 4 weeks ago

berezenko04 commented 1 month ago

Add auto task with subscribe to channel and twitter cuz it make profit bigger

vanhbakaa commented 1 month ago

Okay

yanpaing007 commented 1 month ago
async def claim_task(self, http_client: aiohttp.ClientSession,title,payload):
    try:
        response = await http_client.post("https://bot.pocketfi.org/confirmSubscription",json=payload, ssl=False)
        response.raise_for_status()

        # response_json = await response.json()
        if response.status == 200:
            logger.success(f"{self.session_name} <green>Successfully completed task {title}!</green>")

    except Exception as error:
        logger.error(f"{self.session_name} | Unknown error when claiming daily task: {error}")
        await asyncio.sleep(delay=randint(3, 7))

async def join_clan(self,http_client,clan):
    try:
        response = await http_client.post(f"https://gm.pocketfi.org/mining/alliances/set?alliance={clan}",ssl=False)
        response.raise_for_status()

        # response_json = await response.json()
        if response.status == 200:
            logger.success(f"{self.session_name} <green>Successfully joined clan '{clan}'!</green>")

    except Exception as error:
        logger.error(f"{self.session_name} | Unknown error when joining clan!{error}")
        await asyncio.sleep(delay=randint(3, 7))

async def check_daily(self, http_client: aiohttp.ClientSession):
    try:
        response = await http_client.get("https://bot.pocketfi.org/boost/tasks?boostType=general", ssl=False)

        if response.status == 200:
            data = await response.json()
            task_list = []

            daily_tasks = data.get('tasks', {}).get('daily', [])
            subscription_tasks = data.get('tasks', {}).get('subscriptions', [])
            connect_tasks = data.get('tasks', {}).get('connect', [])

            combined_tasks = daily_tasks + subscription_tasks + connect_tasks

            for task in combined_tasks:
                task_code = task.get('code', '')
                done_amount = task.get('doneAmount', -1)

                if task_code in ('dailyReward', 'subscription', 'subscriptionTwitter', 'addAlliance') and done_amount == 0:
                    task_list.append(task)

                    if task_code == "dailyReward":
                        await self.claim_daily_rw(http_client)

                    elif task_code == "subscription":
                        payload = {"subscriptionType": "telegram"}
                        await self.claim_task(http_client, title=task_code, payload=payload)

                    elif task_code == "subscriptionTwitter":
                        payload = {"subscriptionType": "twitter"}
                        await self.claim_task(http_client, title=task_code, payload=payload)

                    elif task_code == "addAlliance":
                        await self.join_clan(http_client, clan='ghwnd')

        else:
            logger.info(f"{self.session_name} | Failed to fetch tasks list")

    except Exception as e:
        logger.error(f"An error occurred: {e}")
yanpaing007 commented 1 month ago

replace code between async def create_new_account and def run,as for clan name put your prefer one