MCPcopy Create free account
hub / github.com/HiddenCodeDevs/BlumTelegramBot / register_sessions

Function register_sessions

bot/core/registrator.py:6–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4from bot.utils.logger import logger
5
6async 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}')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected