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

101 lines
1.8 KiB
Markdown
Raw Permalink 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.

# Pyrogram Session 修复指南
## 问题描述
镜像搜索功能报错:`AUTH_KEY_UNREGISTERED` - Session 文件已过期
## 解决方案
### 方法 1使用自动化脚本推荐
运行以下命令:
```bash
cd ~/telegram-bot
./auto_create_session.exp
```
脚本会自动:
1. 输入电话号码 (+66621394851)
2. 等待您输入 Telegram 验证码
3. 创建新的 session 文件
### 方法 2手动创建
```bash
cd ~/telegram-bot
python3 create_session_correct.py
```
按提示操作:
1. 输入电话号码: `+66621394851`
2. 确认: `y`
3. 输入收到的验证码
4. 确认: `y`
### 方法 3一键修复命令
```bash
sshpass -p 'wengewudi666808' ssh -tt atai@172.16.74.159 'cd telegram-bot && ./auto_create_session.exp'
```
## 完成后
检查 session 文件是否创建成功:
```bash
ls -lh ~/telegram-bot/user_session.session*
```
重启机器人:
```bash
screen -r agent_bot
# 按 Ctrl+C 停止
# 等待几秒
# 机器人会自动重启run_bot_loop.sh
```
或使用管理脚本:
```bash
~/telegram-bot/manage_bot.sh restart
```
## 验证
重启后检查日志:
```bash
tail -f ~/telegram-bot/logs/integrated_bot_errors.log
```
确认没有 `AUTH_KEY_UNREGISTERED` 错误。
## 文件说明
- `create_session_correct.py` - Session 创建脚本Python
- `auto_create_session.exp` - 自动化脚本Expect
- `user_session.session` - Session 文件(创建后)
## 故障排除
### 代理问题
如果连接失败,检查代理:
```bash
curl --socks5 127.0.0.1:1080 https://api.telegram.org
```
### 验证码问题
- 确保 Telegram 应用已打开
- 验证码可能在"Telegram" 或"Saved Messages"
- 如果收不到验证码,等待几分钟后重试
### 文件权限
```bash
chmod 600 ~/telegram-bot/user_session.session*
```
---
创建时间: 2025-10-26