Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
67 lines (54 loc) · 1.88 KB
/
Copy pathmain.py
File metadata and controls
67 lines (54 loc) · 1.88 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import os
import asyncio
from telethon import TelegramClient
from dotenv import load_dotenv
from utils.logger import logger
from database.manager import DatabaseManager
from handlers.message_handler import register_message_handlers
from handlers.admin_handler import register_admin_handlers
# Load environment variables
load_dotenv()
API_ID = os.getenv("API_ID")
API_HASH = os.getenv("API_HASH")
OWNER_ID = int(os.getenv("OWNER_ID", 0))
if not API_ID or not API_HASH:
logger.error("API_ID or API_HASH not found in .env file!")
exit(1)
# Ensure sessions directory exists
if not os.path.exists('sessions'):
os.makedirs('sessions')
# Initialize Telethon Client
client = TelegramClient(f'sessions/exploitinject_support', API_ID, API_HASH)
async def main():
# Initialize Database
db = DatabaseManager()
await db.init_db()
# Register Handlers
register_message_handlers(client, db, OWNER_ID)
register_admin_handlers(client, db, OWNER_ID)
logger.info("Starting Telegram Userbot...")
# Connect and Start
await client.start()
# Get Me info
me = await client.get_me()
logger.info(f"Logged in as: {me.first_name} (@{me.username})")
# Log Startup Stats
stats = await db.get_stats()
print("\n" + "="*40)
print("🚀 EXPLOITINJECT SUPPORT SYSTEM ACTIVE")
print("="*40)
print(f"👤 Account: {me.first_name} (@{me.username})")
print(f"👑 Owner UID: {OWNER_ID}")
print(f"👥 Total Users: {stats['total_users']}")
print(f"🔥 Active Leads: {stats['total_leads']}")
print("="*40)
print("Listening for messages...\n")
# Run until disconnected
await client.run_until_disconnected()
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
logger.info("System stopped by user.")
except Exception as e:
logger.error(f"Critical error: {e}")