BasicHfBot / bot /config.py
understanding's picture
Create bot/config.py
3dcde77 verified
raw
history blame
926 Bytes
from os import environ as env
def _to_int_list(s: str):
if not s:
return []
out = []
for part in s.replace(",", " ").split():
try:
out.append(int(part.strip()))
except:
pass
return out
class Telegram:
API_ID = int(env.get("TELEGRAM_API_ID", "0") or "0")
API_HASH = env.get("TELEGRAM_API_HASH", "")
SESSION_STRING = env.get("SESSION_STRING", "") # ✅ use this (generated by your gen.py)
OWNER_ID = int(env.get("OWNER_ID", "0") or "0")
# Optional: extra allowlist (space-separated ids)
ALLOWED_USER_IDS = set(_to_int_list(env.get("ALLOWED_USER_IDS", "")))
BOT_USERNAME = env.get("TELEGRAM_BOT_USERNAME", "")
CHANNEL_ID = int(env.get("TELEGRAM_CHANNEL_ID", "0") or "0")
class Server:
BASE_URL = env.get("BASE_URL", "")
BIND_ADDRESS = env.get("BIND_ADDRESS", "0.0.0.0")
PORT = int(env.get("PORT", "7860") or "7860")