-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
30 lines (24 loc) · 709 Bytes
/
config.py
File metadata and controls
30 lines (24 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
from dotenv import load_dotenv
load_dotenv()
ACCOUNTS = []
i = 1
while True:
api_id = os.getenv(f'ACCOUNT_{i}_API_ID')
api_hash = os.getenv(f'ACCOUNT_{i}_API_HASH')
phone = os.getenv(f'ACCOUNT_{i}_PHONE')
if api_id is None or api_hash is None or phone is None:
break
try:
ACCOUNTS.append({
'API_ID': int(api_id),
'API_HASH': api_hash,
'PHONE': phone
})
except ValueError:
print(f"Error: Invalid API_ID for ACCOUNT_{i} in .env file. Must be an integer.")
import sys; sys.exit(1)
i += 1
if not ACCOUNTS:
print("Error: No accounts configured in .env file.")
import sys; sys.exit(1)