telegram-bot-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Telegram Bot Management

Telegram机器人管理

Overview

概述

Multi-workspace Telegram bot workflow orchestration with full supervision (launchd + watchexec). Manages the claude-orchestrator Telegram bot for headless Claude Code interactions.
基于launchd + watchexec的多工作区Telegram机器人工作流编排与全面监控。管理用于无界面Claude Code交互的claude-orchestrator Telegram机器人。

When to Use This Skill

何时使用此技能

  • Check bot status, restart, or troubleshoot issues
  • Monitor bot health and resource usage
  • View bot logs and debug problems
  • Manage bot lifecycle (start/stop/restart)
  • 检查机器人状态、重启或排查问题
  • 监控机器人健康状况和资源使用情况
  • 查看机器人日志并调试问题
  • 管理机器人生命周期(启动/停止/重启)

Production Mode

生产模式

As of v5.8.0, production mode is the only operational mode.
从v5.8.0版本开始,生产模式是唯一的运行模式。

Bot Management Commands

机器人管理命令

Check Status

检查状态

bash
bot-service.sh status
bash
bot-service.sh status

Or use alias

或使用别名

bot status

Shows:

- launchd supervision status
- watchexec process (PID, uptime, memory)
- Bot process (PID, uptime, memory)
- Full process tree
- Recent log activity
bot status

显示内容:

- launchd监控状态
- watchexec进程(PID、运行时间、内存占用)
- 机器人进程(PID、运行时间、内存占用)
- 完整进程树
- 近期日志活动

View Logs

查看日志

bash
bot-service.sh logs
bash
bot-service.sh logs

Or use alias

或使用别名

bot logs

Tails all logs:

- Launchd logs (supervision layer)
- Bot logs (application layer)
bot logs

实时查看所有日志:

- Launchd日志(监控层)
- 机器人日志(应用层)

Restart Bot

重启机器人

bash
bot-service.sh restart
bash
bot-service.sh restart

Or use alias

或使用别名

bot restart

Rarely needed due to automatic code reload via watchexec.
bot restart

由于watchexec会自动重新加载代码,因此很少需要执行此操作。

Stop Bot

停止机器人

bash
bot-service.sh stop
bash
bot-service.sh stop

Or use alias

或使用别名

bot stop

---
bot stop

---

Reference Documentation

参考文档

For detailed information, see:
  • Operational Commands - Status, restart, logs, monitoring commands
  • Troubleshooting - Common issues and diagnostic steps

如需详细信息,请查看:
  • 操作命令 - 状态、重启、日志、监控命令
  • 故障排查 - 常见问题和诊断步骤

Troubleshooting

故障排查

IssueCauseSolution
Bot not respondingProcess crashedRun
bot status
to check, then
bot restart
launchd not startingService not loadedLoad with
launchctl load
command
Logs emptyLog rotation or path issueVerify log path in launchd plist
watchexec not reloadingFile patterns not matchingCheck watchexec filter patterns
High memory usageMemory leak in bot codeRestart bot, investigate Python memory usage
Permission deniedScript not executableRun
chmod +x bot-service.sh
Environment vars missing.env not loadedVerify environment setup in launchd plist
Multiple bot instancesPrevious instance not stoppedKill all bot processes, then restart cleanly
问题原因解决方案
机器人无响应进程崩溃执行
bot status
检查状态,然后执行
bot restart
重启
launchd无法启动服务未加载使用
launchctl load
命令加载服务
日志为空日志轮转或路径问题验证launchd plist文件中的日志路径
watchexec不重新加载代码文件匹配模式不正确检查watchexec的过滤模式
内存占用过高机器人代码存在内存泄漏重启机器人,排查Python内存使用情况
权限被拒绝脚本无执行权限执行
chmod +x bot-service.sh
赋予执行权限
环境变量缺失.env文件未加载验证launchd plist文件中的环境设置
存在多个机器人实例之前的实例未停止终止所有机器人进程,然后干净重启