Spaces:
Paused
Paused
File size: 812 Bytes
574a3cf 27761fb 45ef928 27761fb 574a3cf 27761fb 45ef928 27761fb 45ef928 574a3cf 27761fb 574a3cf 27761fb 574a3cf 27761fb | 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 | import asyncio
import os
from dummy_server import run_server
from bot import app
from worker import manage_workers
from pyrogram import idle
async def main():
# 1. Start the dummy web server so Hugging Face keeps the Space awake on port 7860
print("🌐 Starting Dummy Server...")
asyncio.create_task(run_server())
# 2. Start the Pyrogram Bot
print("🤖 Starting Pyrogram Bot...")
await app.start()
# 3. Start the Sniper Worker Manager (Redis-Free version)
print("🚀 Firing up Sniper Workers...")
asyncio.create_task(manage_workers())
# 4. Keep the process alive forever
await idle()
# Cleanup on shutdown
await app.stop()
if __name__ == "__main__":
# Pyrogram's app.run() handles the async event loop perfectly
app.run(main()) |