Spaces:
Paused
Paused
Update core/integrations/telegram_bot.py
Browse files
core/integrations/telegram_bot.py
CHANGED
|
@@ -229,10 +229,14 @@ async def button_handler(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|
| 229 |
# ==== INICIAR BOT ====
|
| 230 |
async def start_bot():
|
| 231 |
app = ApplicationBuilder().token(TELEGRAM_TOKEN).build()
|
|
|
|
| 232 |
app.add_handler(CommandHandler("start", start))
|
| 233 |
app.add_handler(MessageHandler(filters.ALL, handle_message))
|
| 234 |
app.add_handler(CallbackQueryHandler(button_handler))
|
| 235 |
|
| 236 |
print("🤖 EduLLM Bot en ejecución...")
|
| 237 |
-
await app.run_polling()
|
| 238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|