Spaces:
Sleeping
Sleeping
# main.py | |
import logging | |
import uvicorn | |
from fastapi import FastAPI | |
import asyncio | |
from bot import start_bot | |
logging.basicConfig(level=logging.INFO) | |
logger = logging.getLogger(__name__) | |
app = FastAPI( | |
title="Terabox Downloader Bot API", | |
version="1.0.0" | |
) | |
dp, bot = start_bot() | |
async def startup_event(): | |
logger.info("Starting bot polling in background...") | |
asyncio.create_task(dp.start_polling(bot)) | |
async def read_root(): | |
return { | |
"message": "✅ Terabox Downloader Bot is running!", | |
"workers": "4", # You can even dynamically count your workers | |
"status": "OK" | |
} | |
async def health_check(): | |
return { | |
"status": "ok", | |
"bot_username": (await bot.me()).username, | |
"forward_channel": f"{bot.id}", | |
"version": "1.0.0" | |
} | |
if __name__ == "__main__": | |
uvicorn.run("main:app", host="0.0.0.0", port=7860) |