| 495 | warp: async (msg: Api.Message) => { |
| 496 | await this.handleWarp(msg); |
| 497 | }, |
| 498 | }; |
| 499 | |
| 500 | // 子命令帮助 |
| 501 | private async showSubCommandHelp(subCmd: string, msg: Api.Message): Promise<void> { |
| 502 | const cmd = `${mainPrefix}warp`; |
| 503 | const safeCmd = htmlEscape(cmd); |
| 504 | let text = ""; |
| 505 | switch (subCmd) { |
| 506 | case "status": |
| 507 | text = `📖 <b>状态查询</b>\n\n<code>${safeCmd} status</code> - 查看 WARP 综合状态 (WireProxy、账户文件、iptables 方案、WireGuard 模块)`; |
| 508 | break; |
| 509 | case "w": |
| 510 | text = `📖 <b>启动</b>\n\n<code>${safeCmd} w [端口]</code> - 安装/更新 wireproxy 并启动`; |
| 511 | break; |
| 512 | case "stop": |
| 513 | text = `📖 <b>停止</b>\n\n<code>${safeCmd} stop</code> - 停止并禁用 wireproxy`; |
| 514 | break; |
| 515 | case "ip": |
| 516 | text = `📖 <b>重启/换IP</b>\n\n<code>${safeCmd} ip</code> - 重启 wireproxy 以更换 IP`; |
| 517 | break; |
| 518 | case "port": |
| 519 | text = `📖 <b>端口</b>\n\n<code>${safeCmd} port <端口></code> - 修改监听端口并重启`; |
| 520 | break; |
| 521 | case "uninstall": |
| 522 | case "uninstall_all": |
| 523 | text = `📖 <b>卸载</b>\n\n<code>${safeCmd} uninstall</code> - 仅卸载 WireProxy 方案\n<code>${safeCmd} uninstall_all</code> - 彻底卸载所有 WARP 相关组件`; |
| 524 | break; |
| 525 | case "y": |
| 526 | text = `📖 <b>WireProxy 开关</b>\n\n<code>${safeCmd} y</code> - 连接或断开 WireProxy socks5`; |
| 527 | break; |
| 528 | case "e": |
| 529 | text = `📖 <b>Iptables 方案</b>\n\n<code>${safeCmd} e</code> - 安装 Iptables 透明代理方案 (与 WireProxy 互斥)`; |
| 530 | break; |
| 531 | case "proxy": |
| 532 | text = `📖 <b>代理设置</b>\n\n<code>${safeCmd} proxy</code> - 配置 Telegram 使用 WireProxy 代理 (默认端口 40000)`; |
| 533 | break; |
| 534 | case "unproxy": |
| 535 | text = `📖 <b>关闭代理</b>\n\n<code>${safeCmd} unproxy</code> - 从 config.json 中移除 Telegram 代理配置`; |
| 536 | break; |
| 537 | case "music": |
| 538 | text = `📖 <b>Music 代理</b>\n\n<code>${safeCmd} music</code> - 配置 Music 插件使用 WireProxy 代理 (需要 WireProxy 运行)`; |
| 539 | break; |
| 540 | case "unmusic": |
| 541 | text = `📖 <b>关闭 Music 代理</b>\n\n<code>${safeCmd} unmusic</code> - 从 Music 配置中移除代理设置`; |
| 542 | break; |
| 543 | default: |
| 544 | text = helpText; |
| 545 | break; |
| 546 | } |
| 547 | await msg.edit({ text, parseMode: "html" }); |
| 548 | } |
| 549 | |
| 550 | // 配置代理设置 |
| 551 | private async configureProxy(): Promise<string> { |
| 552 | try { |
| 553 | // 检查 WireProxy 是否运行 |
| 554 | const svcCheck = await SystemExecutor.run("systemctl is-active wireproxy"); |
nothing calls this directly
no test coverage detected