feat: Implement Telegram bot with Claude authentication, mail service, and identity spoofing, refactoring core logic into new modules.

This commit is contained in:
2026-02-12 22:16:17 +08:00
parent 02d70ac3cd
commit ad7b6196dc
14 changed files with 1577 additions and 470 deletions

33
config.py Normal file
View File

@@ -0,0 +1,33 @@
"""
配置加载器:从 config.toml 读取配置,对外暴露与原 config.py 相同的变量名。
"""
import sys
import tomllib
from pathlib import Path
# --- 加载 TOML ---
_config_path = Path(__file__).parent / "config.toml"
if not _config_path.exists():
print("❌ 找不到 config.toml")
print(" 请复制 config.toml.example 为 config.toml 并填入实际值:")
print(" copy config.toml.example config.toml")
sys.exit(1)
with open(_config_path, "rb") as f:
_cfg = tomllib.load(f)
# --- Claude ---
CLAUDE_URL: str = _cfg["claude"]["url"]
# --- Stripe ---
STRIPE_PK: str = _cfg["stripe"]["pk"]
PRODUCT_ID: str = _cfg["stripe"]["product_id"]
# --- Telegram Bot ---
TG_BOT_TOKEN: str = _cfg["telegram"]["bot_token"]
TG_ALLOWED_USERS: list[int] = _cfg["telegram"].get("allowed_users", [])
# --- 邮箱系统 ---
MAIL_SYSTEMS: list[dict] = _cfg.get("mail", [])