refactor(config, telegram_bot): Simplify GPTMail API key configuration and remove redundant Telegram enabled flag

- Simplify GPTMail API key initialization logic by removing separate api_key and api_keys variables and consolidating into single line with fallback to ["gpt-test"]
- Update config.toml.example to use api_keys list format instead of deprecated api_key single value
- Remove TELEGRAM_ENABLED configuration variable and related check from telegram_bot.py
- Simplify Telegram Bot startup validation to only check for bot_token and admin_chat_ids
- Update default auth_provider from "cpa" to "s2a" in config.toml.example
- Improve documentation comments in config.toml.example for GPTMail domains and CRS service
- Localize error messages in telegram_bot.py to Chinese for consistency
- Streamline configuration by removing unnecessary intermediate variables and checks
This commit is contained in:
2026-01-18 02:14:08 +08:00
parent c39a01c4c0
commit 0d19a9a96d
3 changed files with 12 additions and 30 deletions

View File

@@ -12,8 +12,8 @@ email_provider = "gptmail"
# 选择使用的授权服务: "crs" / "cpa" / "s2a"
# - crs: 原有 CRS 系统,需手动添加账号到 CRS
# - cpa: CPA (Codex/Copilot Authorization) 系统,后台自动处理账号
# - s2a: Sub2API 系统,支持 OAuth 授权和账号入库
auth_provider = "cpa"
# - s2a: Sub2API 系统,支持 OAuth 授权和账号入库 (推荐)
auth_provider = "s2a"
# 是否将 team.json 中的 Team Owner 也添加到授权服务
# 开启后,运行时会自动将 team.json 中的 Owner 账号也进行授权入库
@@ -67,20 +67,14 @@ web_url = "https://your-email-service.com"
# API 接口地址
api_base = "https://mail.chatgpt.org.uk"
# API 密钥配置 (支持两种方式)
# 方式1: 单个 Key (兼容旧配置)
api_key = "gpt-test"
# 方式2: 多个 Key 轮询 (推荐,可分散请求限制)
# api_keys = ["key1", "key2", "key3"]
# 注意: 也可以通过 Telegram Bot 的 /gptmail_add 命令动态添加 Key
# API 密钥列表 (支持多个 Key 轮询,可分散请求限制)
# 也可以通过 Telegram Bot 的 /gptmail_add 命令动态添加 Key
api_keys = ["gpt-test"]
# 邮箱前缀 (留空则自动生成 {8位随机字符}-oaiteam 格式)
prefix = ""
# 可用域名列表,生成邮箱时随机选择
# 这些域名已配置 MX 记录指向 GPTMail 服务器
# 下面域名是可用的
domains = [
"29thnewport.org.uk", "2ndwhartonscoutgroup.org.uk",
"abrahampath.org.uk", "aiccministry.com",
@@ -120,6 +114,7 @@ domains = [
# ==================== CRS 服务配置 ====================
# CRS (Central Registration Service) 用于管理注册账号的中心服务
# 仅当 auth_provider = "crs" 时生效
[crs]
# CRS API 接口地址
api_base = "https://your-crs-service.com"
@@ -213,8 +208,6 @@ tracker_file = "team_tracker.json"
# ==================== Telegram Bot 配置 ====================
# 通过 Telegram Bot 远程控制和监控任务
[telegram]
# 是否启用 Telegram Bot
enabled = false
# Bot Token (通过 @BotFather 创建获取)
bot_token = "your-bot-token"
# 授权管理员的 Chat ID 列表 (通过 @userinfobot 获取)