Refactor bot and integrate services

This commit is contained in:
2026-02-07 22:10:08 +03:00
parent 492e3bd3cf
commit 588127c076
31 changed files with 1061 additions and 849 deletions

24
config.py Normal file
View File

@@ -0,0 +1,24 @@
from typing import Dict
import yaml
CONFIG_FILE = "/opt/tg-bot/config.yaml"
def load_cfg(path: str = CONFIG_FILE) -> dict:
with open(path) as f:
return yaml.safe_load(f)
def load_env(env_file: str) -> Dict[str, str]:
env: Dict[str, str] = {}
with open(env_file) as f:
for line in f:
line = line.strip()
if not line or line.startswith("#"):
continue
if line.startswith("export "):
line = line[len("export "):]
if "=" in line:
k, v = line.split("=", 1)
env[k] = v.strip().strip('"')
return env