JairoDanielMT commited on
Commit
3643ab8
·
verified ·
1 Parent(s): 072f8e5

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +17 -14
main.py CHANGED
@@ -1,14 +1,17 @@
1
- from core.integrations.telegram_bot import start_bot
2
-
3
-
4
- def run_telegram_bot():
5
- start_bot()
6
-
7
-
8
- if __name__ == "__main__":
9
- try:
10
- # Iniciar solo el bot de Telegram
11
- run_telegram_bot()
12
- print("✅ Bot de Telegram está en ejecución...")
13
- except KeyboardInterrupt:
14
- print("¡Hasta pronto!")
 
 
 
 
1
+ import threading
2
+ from fastapi import FastAPI
3
+ from core.integrations.telegram_bot import start_bot
4
+
5
+ app = FastAPI()
6
+
7
+ def run_telegram_bot():
8
+ start_bot()
9
+
10
+ # Lanzar bot Telegram en hilo aparte para no bloquear FastAPI
11
+ bot_thread = threading.Thread(target=run_telegram_bot, daemon=True)
12
+ bot_thread.start()
13
+
14
+ @app.get("/")
15
+ async def root():
16
+ return {"status": "Bot de Telegram activo"}
17
+