Spaces:
Running on Zero
Running on Zero
Upload 40 files
Browse files
app.py
CHANGED
|
@@ -7,16 +7,6 @@ from main import app, start_web_server
|
|
| 7 |
logging.basicConfig(level=logging.INFO)
|
| 8 |
logger = logging.getLogger(__name__)
|
| 9 |
|
| 10 |
-
# Compatibilidad con Hugging Face ZeroGPU / Spaces
|
| 11 |
-
try:
|
| 12 |
-
import spaces
|
| 13 |
-
@spaces.GPU
|
| 14 |
-
def check_status(user_input):
|
| 15 |
-
return f"🟢 Bot 'Twisted Audio' activo 24/7 en Telegram. Procesado: {user_input}"
|
| 16 |
-
except Exception:
|
| 17 |
-
def check_status(user_input):
|
| 18 |
-
return f"🟢 Bot 'Twisted Audio' activo 24/7 en Telegram. Procesado: {user_input}"
|
| 19 |
-
|
| 20 |
async def run_bot_async():
|
| 21 |
try:
|
| 22 |
logger.info("Iniciando servidor interno y cliente Pyrogram...")
|
|
@@ -33,8 +23,8 @@ async def run_bot_async():
|
|
| 33 |
except Exception as e:
|
| 34 |
logger.warning(f"No se pudieron configurar los comandos del bot: {e}")
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
except Exception as e:
|
| 39 |
logger.error(f"Error en el bot de Telegram: {e}")
|
| 40 |
|
|
@@ -46,7 +36,9 @@ def start_bot_thread():
|
|
| 46 |
# Iniciar el bot de Telegram en segundo plano
|
| 47 |
threading.Thread(target=start_bot_thread, daemon=True).start()
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
demo = gr.Interface(
|
| 51 |
fn=check_status,
|
| 52 |
inputs=gr.Textbox(label="Estado del Servidor", placeholder="Escribe algo para verificar..."),
|
|
|
|
| 7 |
logging.basicConfig(level=logging.INFO)
|
| 8 |
logger = logging.getLogger(__name__)
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
async def run_bot_async():
|
| 11 |
try:
|
| 12 |
logger.info("Iniciando servidor interno y cliente Pyrogram...")
|
|
|
|
| 23 |
except Exception as e:
|
| 24 |
logger.warning(f"No se pudieron configurar los comandos del bot: {e}")
|
| 25 |
|
| 26 |
+
from pyrogram import idle
|
| 27 |
+
await idle()
|
| 28 |
except Exception as e:
|
| 29 |
logger.error(f"Error en el bot de Telegram: {e}")
|
| 30 |
|
|
|
|
| 36 |
# Iniciar el bot de Telegram en segundo plano
|
| 37 |
threading.Thread(target=start_bot_thread, daemon=True).start()
|
| 38 |
|
| 39 |
+
def check_status(user_input):
|
| 40 |
+
return f"🟢 Bot 'Twisted Audio' activo 24/7 en Telegram. Recibido: {user_input}"
|
| 41 |
+
|
| 42 |
demo = gr.Interface(
|
| 43 |
fn=check_status,
|
| 44 |
inputs=gr.Textbox(label="Estado del Servidor", placeholder="Escribe algo para verificar..."),
|
main.py
CHANGED
|
@@ -65,10 +65,7 @@ async def start_web_server():
|
|
| 65 |
# --- PYROGRAM CLIENT ---
|
| 66 |
WORKDIR = "sessions"
|
| 67 |
if not os.path.exists(WORKDIR): os.makedirs(WORKDIR)
|
| 68 |
-
|
| 69 |
-
for f in glob.glob(os.path.join(WORKDIR, "*.session*")):
|
| 70 |
-
try: os.remove(f)
|
| 71 |
-
except: pass
|
| 72 |
|
| 73 |
app = Client("brody_base_bot_v2", api_id=int(API_ID), api_hash=API_HASH, bot_token=BOT_TOKEN, workers=100, workdir=WORKDIR)
|
| 74 |
|
|
|
|
| 65 |
# --- PYROGRAM CLIENT ---
|
| 66 |
WORKDIR = "sessions"
|
| 67 |
if not os.path.exists(WORKDIR): os.makedirs(WORKDIR)
|
| 68 |
+
# WORKDIR = "sessions"
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
app = Client("brody_base_bot_v2", api_id=int(API_ID), api_hash=API_HASH, bot_token=BOT_TOKEN, workers=100, workdir=WORKDIR)
|
| 71 |
|