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..3b00735 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} | Sent 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'),