From d3474c487d6137419d6c2aa2b14f2615c766648c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=90=D0=B4=D0=B0?= =?UTF-8?q?=D0=B5=D0=B2?= Date: Thu, 12 Sep 2024 14:49:25 +0300 Subject: [PATCH 1/2] add ref support --- .env-example | 3 +++ bot/config/config.py | 3 ++- bot/core/claimer.py | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.env-example b/.env-example index d6f0761..6181475 100644 --- a/.env-example +++ b/.env-example @@ -1,6 +1,9 @@ API_ID= API_HASH= +REF_MODE= +REF_ID= + SLEEP_BETWEEN_START= ERRORS_BEFORE_STOP= USE_PROXY_FROM_FILE= diff --git a/bot/config/config.py b/bot/config/config.py index 8df9a7d..191ffeb 100644 --- a/bot/config/config.py +++ b/bot/config/config.py @@ -7,7 +7,8 @@ class Settings(BaseSettings): API_ID: int API_HASH: str - + REF_MODE: bool = False + REF_ID: str SLEEP_BETWEEN_START: list[int] = [20, 360] ERRORS_BEFORE_STOP: int = 3 USE_PROXY_FROM_FILE: bool = False diff --git a/bot/core/claimer.py b/bot/core/claimer.py index cd67fe7..5490814 100644 --- a/bot/core/claimer.py +++ b/bot/core/claimer.py @@ -47,6 +47,14 @@ async def get_tg_web_data(self, proxy: str | None) -> str: headers["user_auth"] = str(self.user_id) except (Unauthorized, UserDeactivated, AuthKeyUnregistered): raise InvalidSession(self.session_name) + if settings.REF_MODE: + gen_ref = settings.REF_ID + logger.info(f'{self.session_name} | Sending message with ref {gen_ref}') + await asyncio.sleep(5) + await self.tg_client.send_message("MMproBump_bot", f'/start {gen_ref}') + await asyncio.sleep(5) + logger.success(f'{self.session_name} | Send message with ref! {gen_ref}') + web_view = await self.tg_client.invoke(RequestWebView( peer=await self.tg_client.resolve_peer('MMproBump_bot'), bot=await self.tg_client.resolve_peer('MMproBump_bot'), From 11bdb0a2e3ead715722970e06c94bf2b546c1b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=90=D0=B4=D0=B0?= =?UTF-8?q?=D0=B5=D0=B2?= Date: Thu, 12 Sep 2024 14:55:19 +0300 Subject: [PATCH 2/2] fix my stupid eng xD --- bot/core/claimer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/core/claimer.py b/bot/core/claimer.py index 5490814..3b00735 100644 --- a/bot/core/claimer.py +++ b/bot/core/claimer.py @@ -53,7 +53,7 @@ async def get_tg_web_data(self, proxy: str | None) -> str: await asyncio.sleep(5) await self.tg_client.send_message("MMproBump_bot", f'/start {gen_ref}') await asyncio.sleep(5) - logger.success(f'{self.session_name} | Send message with ref! {gen_ref}') + logger.success(f'{self.session_name} | Sent message with ref! {gen_ref}') web_view = await self.tg_client.invoke(RequestWebView( peer=await self.tg_client.resolve_peer('MMproBump_bot'),