Skip to content

Commit

Permalink
Added clearing tg name & support for new task
Browse files Browse the repository at this point in the history
  • Loading branch information
Desamod committed Nov 9, 2024
1 parent 7cd59fa commit cf0c8e6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ AUTO_TASK=
JOIN_TG_CHANNELS=
REF_ID=
CONNECT_TON_WALLET=
DISCONNECT_TON_WALLET=
DISCONNECT_TON_WALLET=
CLEAR_TG_NAME=
1 change: 1 addition & 0 deletions README-RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
| **REF_ID** | Реф. ссылка для регистрации в боте |
| **CONNECT_TON_WALLET** | Подключение Ton кошелька из wallets.json к боту PAWS (по умолчанию - False) |
| **DISCONNECT_TON_WALLET** | Отключение Ton кошелька от PAWS (по умолчанию - False) |
| **CLEAR_TG_NAME** | Удаляет '🐾' из имени пользователя (по умолчанию - False) |

## Быстрый старт 📚

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
| **REF_ID** | Ref link for registration |
| **CONNECT_TON_WALLET** | Connect Ton Wallet from wallets.json to PAWS bot (default - False) |
| **DISCONNECT_TON_WALLET** | Disconnect Ton Wallet from PAWS (default - False) |
| **CLEAR_TG_NAME** | Remove '🐾' from user name (default - False) |

## Quick Start 📚

Expand Down
1 change: 1 addition & 0 deletions bot/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Settings(BaseSettings):
SIMPLE_TASKS: list[str] = ['twitter', 'linked', 'paragraph']
CONNECT_TON_WALLET: bool = False
DISCONNECT_TON_WALLET: bool = False
CLEAR_TG_NAME: bool = False


settings = Settings()
11 changes: 11 additions & 0 deletions bot/core/tapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ async def processing_tasks(self, http_client: cloudscraper.CloudScraper):
continue
elif task['code'] in settings.SIMPLE_TASKS or is_partner:
logger.info(f"{self.session_name} | Performing <lc>{task['title']}</lc> task")
elif task['code'] == 'daily' and not task['checkRequirements']:
end_time = task.get('availableUntil', 0)
curr_time = time() * 1000
if end_time < curr_time:
continue
logger.info(f"{self.session_name} | Performing <lc>{task['title']}</lc> task")
elif task['code'] == 'wallet':
if self.wallet is not None and len(self.wallet) > 0:
logger.info(
Expand Down Expand Up @@ -283,6 +289,11 @@ async def run(self, user_agent: str, proxy: str | None) -> None:
await self.processing_tasks(http_client=scraper)
logger.info(f"{self.session_name} | All available tasks completed")

if settings.CLEAR_TG_NAME and '🐾' in self.tg_session.name:
logger.info(f"{self.session_name} | Removing 🐾 from name..")
nickname = self.tg_session.name.replace('🐾', '')
await self.tg_session.change_tg_nickname(name=nickname)

logger.info(f"{self.session_name} | Sleep <y>{round(sleep_time / 60, 1)}</y> min")
await asyncio.sleep(delay=sleep_time)

Expand Down

0 comments on commit cf0c8e6

Please sign in to comment.