-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
65 lines (52 loc) · 1.46 KB
/
Copy pathrun.py
File metadata and controls
65 lines (52 loc) · 1.46 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
"""Run both components simultaneously"""
import sys
import subprocess
import time
import signal
from threading import Thread
processes = []
def run_bot():
"""Run UserBot"""
print("🤖 Starting UserBot...")
proc = subprocess.Popen([sys.executable, 'bot.py'])
processes.append(proc)
proc.wait()
def run_web():
"""Run web server"""
time.sleep(2)
print("🌐 Starting web interface...")
proc = subprocess.Popen([sys.executable, 'web_server.py'])
processes.append(proc)
proc.wait()
def signal_handler(sig, frame):
"""Handle Ctrl+C"""
print("\n\n⚠️ Stopping all processes...")
for proc in processes:
proc.terminate()
time.sleep(1)
for proc in processes:
if proc.poll() is None:
proc.kill()
print("✓ All processes stopped")
sys.exit(0)
if __name__ == '__main__':
print("=" * 60)
print(" Telegram Logger - Full Launch")
print("=" * 60)
print()
print("🤖 UserBot - message tracking")
print("🌐 Web Interface - http://127.0.0.1:5000")
print()
print(" Press Ctrl+C to stop")
print("=" * 60)
print()
signal.signal(signal.SIGINT, signal_handler)
bot_thread = Thread(target=run_bot, daemon=True)
web_thread = Thread(target=run_web, daemon=True)
bot_thread.start()
web_thread.start()
try:
bot_thread.join()
web_thread.join()
except KeyboardInterrupt:
signal_handler(None, None)