Spaces:
Runtime error
Runtime error
Update bot/config.py
Browse files- bot/config.py +13 -0
bot/config.py
CHANGED
|
@@ -33,6 +33,7 @@ def _as_https_base(v: str) -> str:
|
|
| 33 |
return v.rstrip("/")
|
| 34 |
return "https://" + v
|
| 35 |
|
|
|
|
| 36 |
class Telegram:
|
| 37 |
API_ID: int = _get_int("API_ID", 0)
|
| 38 |
API_HASH: str = _get_str("API_HASH", "")
|
|
@@ -49,17 +50,29 @@ class Telegram:
|
|
| 49 |
BOT_USERNAME: str = _get_str("TELEGRAM_BOT_USERNAME", "BotFather")
|
| 50 |
ADMIN_IDS: list[int] = _get_int_list("ADMIN_IDS")
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
class Workers:
|
| 53 |
WORKER1_URL: str = _as_https_base(_get_str("WORKER1_URL", ""))
|
| 54 |
WORKER2_URL: str = _as_https_base(_get_str("WORKER2_URL", ""))
|
| 55 |
BOT_BACKEND_KEY: str = _get_str("BOT_BACKEND_KEY", "")
|
| 56 |
HF_API_KEY: str = _get_str("HF_API_KEY", "")
|
| 57 |
|
|
|
|
| 58 |
class Server:
|
| 59 |
BIND_ADDRESS: str = _get_str("BIND_ADDRESS", "0.0.0.0")
|
| 60 |
PORT: int = _get_int("PORT", 7860)
|
| 61 |
BASE_URL: str = _get_str("BASE_URL", "http://127.0.0.1:7860")
|
| 62 |
|
|
|
|
| 63 |
LOGGER_CONFIG_JSON = {
|
| 64 |
"version": 1,
|
| 65 |
"disable_existing_loggers": False,
|
|
|
|
| 33 |
return v.rstrip("/")
|
| 34 |
return "https://" + v
|
| 35 |
|
| 36 |
+
|
| 37 |
class Telegram:
|
| 38 |
API_ID: int = _get_int("API_ID", 0)
|
| 39 |
API_HASH: str = _get_str("API_HASH", "")
|
|
|
|
| 50 |
BOT_USERNAME: str = _get_str("TELEGRAM_BOT_USERNAME", "BotFather")
|
| 51 |
ADMIN_IDS: list[int] = _get_int_list("ADMIN_IDS")
|
| 52 |
|
| 53 |
+
|
| 54 |
+
# ✅ Added: compatibility shim for handlers.py (Auth.OWNERS/Auth.ADMINS)
|
| 55 |
+
class Auth:
|
| 56 |
+
# Optional multi-owner: OWNER_IDS="123,456" (comma/;/| supported)
|
| 57 |
+
OWNERS: list[int] = _get_int_list("OWNER_IDS") or (
|
| 58 |
+
[Telegram.OWNER_ID] if Telegram.OWNER_ID else []
|
| 59 |
+
)
|
| 60 |
+
ADMINS: list[int] = Telegram.ADMIN_IDS or []
|
| 61 |
+
|
| 62 |
+
|
| 63 |
class Workers:
|
| 64 |
WORKER1_URL: str = _as_https_base(_get_str("WORKER1_URL", ""))
|
| 65 |
WORKER2_URL: str = _as_https_base(_get_str("WORKER2_URL", ""))
|
| 66 |
BOT_BACKEND_KEY: str = _get_str("BOT_BACKEND_KEY", "")
|
| 67 |
HF_API_KEY: str = _get_str("HF_API_KEY", "")
|
| 68 |
|
| 69 |
+
|
| 70 |
class Server:
|
| 71 |
BIND_ADDRESS: str = _get_str("BIND_ADDRESS", "0.0.0.0")
|
| 72 |
PORT: int = _get_int("PORT", 7860)
|
| 73 |
BASE_URL: str = _get_str("BASE_URL", "http://127.0.0.1:7860")
|
| 74 |
|
| 75 |
+
|
| 76 |
LOGGER_CONFIG_JSON = {
|
| 77 |
"version": 1,
|
| 78 |
"disable_existing_loggers": False,
|