JairoDanielMT commited on
Commit
0779850
·
verified ·
1 Parent(s): 69feac1

Update core/integrations/telegram_bot.py

Browse files
Files changed (1) hide show
  1. core/integrations/telegram_bot.py +5 -12
core/integrations/telegram_bot.py CHANGED
@@ -226,24 +226,17 @@ async def button_handler(update: Update, context: ContextTypes.DEFAULT_TYPE):
226
  )
227
 
228
 
229
- import httpx
230
-
231
  async def start_bot():
232
- # Cliente HTTP con timeout total y por lectura de 60 segundos
233
- client = httpx.AsyncClient(timeout=httpx.Timeout(60.0, read=60.0))
234
-
235
- app = ApplicationBuilder() \
236
- .token(TELEGRAM_TOKEN) \
237
- .http_client(client) \
238
- .build()
239
-
240
  app.add_handler(CommandHandler("start", start))
241
  app.add_handler(MessageHandler(filters.ALL, handle_message))
242
  app.add_handler(CallbackQueryHandler(button_handler))
243
 
244
  print("🤖 EduLLM Bot en ejecución...")
245
 
 
246
  await app.initialize()
247
  await app.start()
248
- await app.updater.start_polling()
249
-
 
226
  )
227
 
228
 
229
+ # ==== INICIAR BOT ====
 
230
  async def start_bot():
231
+ app = ApplicationBuilder().token(TELEGRAM_TOKEN).build()
232
+
 
 
 
 
 
 
233
  app.add_handler(CommandHandler("start", start))
234
  app.add_handler(MessageHandler(filters.ALL, handle_message))
235
  app.add_handler(CallbackQueryHandler(button_handler))
236
 
237
  print("🤖 EduLLM Bot en ejecución...")
238
 
239
+ # 🔁 Esta secuencia evita que se cierre el event loop
240
  await app.initialize()
241
  await app.start()
242
+ await app.updater.start_polling()