()
| 4 | from bot.utils.logger import logger |
| 5 | |
| 6 | async def register_sessions() -> None: |
| 7 | |
| 8 | if not settings.API_ID or not settings.API_HASH: |
| 9 | raise ValueError("API_ID and API_HASH not found in the .env file.") |
| 10 | |
| 11 | session_name = input('\nEnter the session name (press Enter to exit): ') |
| 12 | |
| 13 | if not session_name: |
| 14 | return None |
| 15 | |
| 16 | session = Client( |
| 17 | name=session_name, |
| 18 | api_id=settings.API_ID, |
| 19 | api_hash=settings.API_HASH, |
| 20 | workdir="sessions/" |
| 21 | ) |
| 22 | |
| 23 | async with session: |
| 24 | user_data = await session.get_me() |
| 25 | |
| 26 | logger.success(f'Session added successfully @{user_data.username} | {user_data.first_name} {user_data.last_name}') |
nothing calls this directly
no outgoing calls
no test coverage detected