Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -471,14 +471,14 @@ import requests, os, io
|
|
| 471 |
|
| 472 |
app = FastAPI()
|
| 473 |
|
| 474 |
-
|
| 475 |
-
BOT_USERNAME = os.getenv("BOT_USERNAME", "
|
| 476 |
FALLBACK_IMG = "https://telegram.org/img/t_logo.png"
|
| 477 |
|
| 478 |
-
if not
|
| 479 |
-
raise RuntimeError("
|
| 480 |
|
| 481 |
-
TELEGRAM_API = f"https://api.telegram.org/bot{
|
| 482 |
|
| 483 |
|
| 484 |
def get_description() -> str:
|
|
@@ -521,7 +521,7 @@ def fetch_avatar_bytes() -> bytes | None:
|
|
| 521 |
).json()
|
| 522 |
|
| 523 |
file_path = file_obj["result"]["file_path"]
|
| 524 |
-
file_url = f"https://api.telegram.org/file/bot{
|
| 525 |
response = requests.get(file_url, timeout=10)
|
| 526 |
return response.content if response.status_code == 200 else None
|
| 527 |
|
|
|
|
| 471 |
|
| 472 |
app = FastAPI()
|
| 473 |
|
| 474 |
+
# TOKEN = os.getenv("BOT_TOKEN")
|
| 475 |
+
BOT_USERNAME = os.getenv("BOT_USERNAME", "live_logger_bot")
|
| 476 |
FALLBACK_IMG = "https://telegram.org/img/t_logo.png"
|
| 477 |
|
| 478 |
+
if not TOKEN:
|
| 479 |
+
raise RuntimeError("TOKEN environment variable not set")
|
| 480 |
|
| 481 |
+
TELEGRAM_API = f"https://api.telegram.org/bot{TOKEN}"
|
| 482 |
|
| 483 |
|
| 484 |
def get_description() -> str:
|
|
|
|
| 521 |
).json()
|
| 522 |
|
| 523 |
file_path = file_obj["result"]["file_path"]
|
| 524 |
+
file_url = f"https://api.telegram.org/file/bot{TOKEN}/{file_path}"
|
| 525 |
response = requests.get(file_url, timeout=10)
|
| 526 |
return response.content if response.status_code == 200 else None
|
| 527 |
|