Files
telegram-customer-bot/QUICK_FIX.sh
2025-11-01 21:58:31 +08:00

92 lines
2.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#\!/bin/bash
# 镜像功能快速修复脚本
clear
echo "============================================"
echo " Telegram Bot 镜像功能修复工具"
echo "============================================"
echo ""
echo "问题AUTH_KEY_UNREGISTERED"
echo "原因Pyrogram Session 已过期"
echo ""
echo "============================================"
echo ""
# 检查是否已有 session
if [ -f "user_session.session" ]; then
echo "⚠️ 检测到现有 session 文件"
echo " 文件:$(ls -lh user_session.session | awk '{print $9, $5}')"
echo ""
read -p "是否删除并重新创建?(y/N): " confirm
if [ "$confirm" \!= "y" ] && [ "$confirm" \!= "Y" ]; then
echo "操作已取消"
exit 0
fi
echo ""
echo "备份现有文件..."
cp user_session.session user_session.session.old_$(date +%Y%m%d_%H%M%S)
rm -f user_session.session user_session.session-journal
fi
echo "============================================"
echo " 准备创建新的 Session"
echo "============================================"
echo ""
echo "配置信息:"
echo " - API ID: 24660516"
echo " - 电话号码: +66621394851"
echo " - 代理: SOCKS5://127.0.0.1:1080"
echo ""
echo "请确保:"
echo " ✓ Telegram 应用已打开"
echo " ✓ 手机在身边(接收验证码)"
echo ""
read -p "按 Enter 开始创建 session..." dummy
echo ""
echo "正在启动 Pyrogram 客户端..."
echo "============================================"
echo ""
# 运行创建脚本
python3 create_session_correct.py
# 检查结果
echo ""
echo "============================================"
if [ -f "user_session.session" ]; then
echo "✅ Session 创建成功!"
echo ""
echo "文件信息:"
ls -lh user_session.session*
echo ""
echo "下一步:重启机器人"
echo ""
read -p "是否现在重启机器人?(y/N): " restart
if [ "$restart" = "y" ] || [ "$restart" = "Y" ]; then
echo ""
echo "正在重启机器人..."
./manage_bot.sh restart
echo ""
echo "请使用以下命令查看日志:"
echo " tail -f logs/integrated_bot_errors.log"
else
echo ""
echo "手动重启命令:"
echo " screen -r agent_bot # 然后按 Ctrl+C"
echo " # 或"
echo " ./manage_bot.sh restart"
fi
else
echo "❌ Session 创建失败"
echo ""
echo "请检查:"
echo " 1. 代理是否正常"
echo " 2. 验证码是否正确"
echo " 3. 网络连接"
echo ""
echo "查看详细说明:"
echo " cat README_SESSION.md"
fi
echo "============================================"