Update bot.py
Browse files
bot.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
import time
|
6 |
import threading
|
7 |
import asyncio
|
|
|
8 |
|
9 |
# Replace with your actual Hugging Face Space backend URL
|
10 |
BACKEND_URL = "https://dragxd-host.hf.space"
|
@@ -93,6 +94,12 @@ async def deploy(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|
93 |
if status != "deploying":
|
94 |
finished = True
|
95 |
await update.message.reply_text(f"Deployment finished with status: {status}")
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
break
|
97 |
await asyncio.sleep(2)
|
98 |
except Exception as e:
|
|
|
5 |
import time
|
6 |
import threading
|
7 |
import asyncio
|
8 |
+
import io
|
9 |
|
10 |
# Replace with your actual Hugging Face Space backend URL
|
11 |
BACKEND_URL = "https://dragxd-host.hf.space"
|
|
|
94 |
if status != "deploying":
|
95 |
finished = True
|
96 |
await update.message.reply_text(f"Deployment finished with status: {status}")
|
97 |
+
# Download logs.txt and send as file
|
98 |
+
logs_file_resp = requests.get(f"{BACKEND_URL}/logs/{deploy_id}/download")
|
99 |
+
if logs_file_resp.status_code == 200:
|
100 |
+
log_bytes = io.BytesIO(logs_file_resp.content)
|
101 |
+
log_bytes.name = "logs.txt"
|
102 |
+
await update.message.reply_document(document=InputFile(log_bytes))
|
103 |
break
|
104 |
await asyncio.sleep(2)
|
105 |
except Exception as e:
|