Spaces:
Paused
Paused
Upload main.py
Browse files
main.py
CHANGED
|
@@ -4912,6 +4912,11 @@ async def start_bot():
|
|
| 4912 |
await bot.start()
|
| 4913 |
me = await bot.get_me()
|
| 4914 |
logger.info("🚀 Bot @%s iniciado | DB: %s", me.username, DB_NAME)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4915 |
for sa_id in SUPER_ADMINS_STATIC:
|
| 4916 |
try:
|
| 4917 |
await bot.send_message(
|
|
@@ -4935,6 +4940,7 @@ async def start_bot():
|
|
| 4935 |
asyncio.create_task(_queue_watchdog())
|
| 4936 |
asyncio.create_task(_set_menus())
|
| 4937 |
|
|
|
|
| 4938 |
async def stop_bot():
|
| 4939 |
global _pg_pool
|
| 4940 |
try:
|
|
@@ -4947,3 +4953,14 @@ async def stop_bot():
|
|
| 4947 |
_pg_pool = None
|
| 4948 |
except Exception:
|
| 4949 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4912 |
await bot.start()
|
| 4913 |
me = await bot.get_me()
|
| 4914 |
logger.info("🚀 Bot @%s iniciado | DB: %s", me.username, DB_NAME)
|
| 4915 |
+
|
| 4916 |
+
# ✅ INICIAR POLLING
|
| 4917 |
+
await bot.delete_webhook(drop_pending_updates=True)
|
| 4918 |
+
asyncio.create_task(bot.run_polling())
|
| 4919 |
+
|
| 4920 |
for sa_id in SUPER_ADMINS_STATIC:
|
| 4921 |
try:
|
| 4922 |
await bot.send_message(
|
|
|
|
| 4940 |
asyncio.create_task(_queue_watchdog())
|
| 4941 |
asyncio.create_task(_set_menus())
|
| 4942 |
|
| 4943 |
+
|
| 4944 |
async def stop_bot():
|
| 4945 |
global _pg_pool
|
| 4946 |
try:
|
|
|
|
| 4953 |
_pg_pool = None
|
| 4954 |
except Exception:
|
| 4955 |
pass
|
| 4956 |
+
|
| 4957 |
+
|
| 4958 |
+
# ✅ ESTE BLOQUE DEBE ESTAR AL FINAL
|
| 4959 |
+
async def main():
|
| 4960 |
+
"""Punto de entrada principal (si ejecutas main.py directamente)"""
|
| 4961 |
+
await start_bot()
|
| 4962 |
+
await asyncio.Event().wait() # Mantener ejecución
|
| 4963 |
+
|
| 4964 |
+
|
| 4965 |
+
if __name__ == "__main__":
|
| 4966 |
+
asyncio.run(main())
|