主要更新: - ✨ 新增 Telegram Bot 交互界面 - ✨ 新增欧洲账单自动生成功能 - 📦 整理项目结构,部署文件移至 deployment/ 目录 - 📝 完善文档,新增 CHANGELOG 和 Bot 部署指南 - 🔧 统一使用 pyproject.toml 管理依赖(支持 uv) - 🛡️ 增强 .gitignore,防止敏感配置泄露 新增文件: - tg_bot.py: Telegram Bot 主程序 - generate_billing.py: 独立账单生成工具 - modules/billing.py: 欧洲账单生成模块 - deployment/: Docker、systemd 等部署配置 - docs/: 完整的文档和更新日志 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
64 lines
1.7 KiB
Bash
Executable File
64 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Telegram Bot 快速启动脚本
|
|
|
|
set -e
|
|
|
|
echo "🚀 Starting OpenAI Registration Telegram Bot..."
|
|
echo ""
|
|
|
|
# 检查环境变量
|
|
if [ -z "$TELEGRAM_BOT_TOKEN" ]; then
|
|
echo "❌ Error: TELEGRAM_BOT_TOKEN not set!"
|
|
echo ""
|
|
echo "Please set your Telegram Bot token:"
|
|
echo " export TELEGRAM_BOT_TOKEN='your_bot_token_here'"
|
|
echo ""
|
|
echo "Get token from: https://t.me/BotFather"
|
|
exit 1
|
|
fi
|
|
|
|
# 检查 Python
|
|
if ! command -v python3 &> /dev/null; then
|
|
echo "❌ Error: Python 3 not found!"
|
|
exit 1
|
|
fi
|
|
|
|
# 检查依赖
|
|
echo "📦 Checking dependencies..."
|
|
if ! python3 -c "import telegram" 2>/dev/null; then
|
|
echo "⚠️ Installing dependencies..."
|
|
pip install -q -r requirements_bot.txt
|
|
echo "✅ Dependencies installed"
|
|
else
|
|
echo "✅ Dependencies OK"
|
|
fi
|
|
|
|
# 检查配置
|
|
if ! python3 -c "from config import TEMPMAIL_CONFIG; assert 'your.tempmail.domain' not in TEMPMAIL_CONFIG.get('api_base_url', '')" 2>/dev/null; then
|
|
echo "❌ Error: config.py not configured!"
|
|
echo ""
|
|
echo "Please configure config.py with your tempmail settings"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Configuration OK"
|
|
echo ""
|
|
|
|
# 显示权限信息
|
|
if [ -n "$ALLOWED_USER_IDS" ]; then
|
|
echo "🔐 Access Control: Enabled"
|
|
echo " Allowed Users: $ALLOWED_USER_IDS"
|
|
else
|
|
echo "⚠️ Access Control: Disabled (Public Bot)"
|
|
echo " Set ALLOWED_USER_IDS to restrict access"
|
|
fi
|
|
|
|
echo ""
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "✅ Bot starting..."
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
# 启动 bot
|
|
python3 tg_bot.py
|