init: Telegram sub bot
This commit is contained in:
65
README.md
Normal file
65
README.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# Sub Bot — Telegram 群订阅管理机器人
|
||||
|
||||
群成员共享的代理订阅管理 Bot,支持上传、获取、检测、自动清理。
|
||||
|
||||
## 功能
|
||||
|
||||
- `/vps` 打开交互菜单(添加/列表/获取/删除/检测)
|
||||
- 直接发订阅链接自动识别入库(支持多条)
|
||||
- 支持 ss/vmess/vless/trojan/hy2/tuic 协议 + Surge 格式
|
||||
- 获取订阅:原始链接 / Base64 / Clash Meta 订阅 URL
|
||||
- 节点存活检测(TCP 连通性)
|
||||
- 每 6 小时自动清理不可用节点并通知群
|
||||
- 所有 Bot 消息 60 秒后自动删除
|
||||
- 内置 HTTP 订阅端点,客户端可直接导入
|
||||
|
||||
## 部署
|
||||
|
||||
```bash
|
||||
pip install python-telegram-bot
|
||||
```
|
||||
|
||||
配置环境变量:
|
||||
|
||||
```bash
|
||||
export BOT_TOKEN="your_bot_token"
|
||||
export ADMIN_ID="your_telegram_id"
|
||||
export SUB_SECRET="random_secret_string"
|
||||
export SUB_HOST="your_server_ip:18888"
|
||||
```
|
||||
|
||||
运行:
|
||||
|
||||
```bash
|
||||
python3 bot.py
|
||||
```
|
||||
|
||||
## systemd
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Sub Bot
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/sub-bot
|
||||
Environment=BOT_TOKEN=your_token
|
||||
Environment=ADMIN_ID=your_id
|
||||
Environment=SUB_SECRET=your_secret
|
||||
Environment=SUB_HOST=your_ip:18888
|
||||
ExecStart=/usr/bin/python3 /opt/sub-bot/bot.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
## 订阅端点
|
||||
|
||||
```
|
||||
http://your_ip:18888/{SUB_SECRET}/download?target=ClashMeta
|
||||
http://your_ip:18888/{SUB_SECRET}/download?target=raw
|
||||
http://your_ip:18888/{SUB_SECRET}/download?target=ClashMeta&type=ss
|
||||
```
|
||||
Reference in New Issue
Block a user