#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Simple FastAPI server for Hugging Face Spaces
This keeps the space alive and provides a basic web interface
"""
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
import uvicorn
import os
app = FastAPI()
@app.get("/", response_class=HTMLResponse)
async def root():
"""Root endpoint that returns a simple HTML page"""
return """
Telegram Server Manager Bot
🤖 Telegram Server Manager Bot
✅ Bot is running!
About this bot:
This bot allows you to remotely manage your server using Telegram.
- Run commands via Telegram
- Monitor server status
- Check system resources
Start a chat with your bot on Telegram to use it!
"""
@app.get("/health")
async def health():
"""Health check endpoint"""
return {"status": "healthy", "bot": "running"}
@app.get("/api/status")
async def status():
"""Status endpoint"""
return {
"status": "online",
"service": "Telegram Server Manager Bot",
"port": 7860
}
if __name__ == "__main__":
# Run on port 7860 for Hugging Face Spaces
port = int(os.environ.get("PORT", 7860))
uvicorn.run(app, host="0.0.0.0", port=port)