Discord Doctor
Quick diagnosis and repair for Discord/Gateway availability issues, OAuth token problems, and legacy Clawdis configuration conflicts.
Usage
CODEBLOCK0
What It Checks
- 1. Discord App - Is the Discord desktop app running (optional, for monitoring)
- Gateway Process - Is the Clawdbot gateway daemon running
- Gateway HTTP - Is the gateway responding on port 18789
- Discord Connection - Is the bot actually connected to Discord (via
clawdbot health) - Anthropic OAuth - Is your OAuth token valid or expired
- Legacy Clawdis - Detects old launchd services and config directories that cause conflicts
- Recent Activity - Shows recent Discord sessions
Auto-Fix Capabilities
When run with --fix, it can:
- - Start gateway if not running
- Install missing npm packages (like discord.js, strip-ansi)
- Restart gateway after fixing dependencies
- Remove legacy launchd service (
com.clawdis.gateway.plist) - Backup legacy config (moves
~/.clawdis to ~/.clawdis-backup)
Common Issues & Fixes
| Issue | Auto-Fix Action |
|---|
| Gateway not running | Starts gateway on port 18789 |
| Missing npm packages |
Runs
npm install + installs specific package |
| Discord disconnected | Restarts gateway to reconnect |
| OAuth token expired | Shows instructions to re-authenticate |
| Legacy launchd service | Removes old
com.clawdis.gateway.plist |
| Legacy ~/.clawdis config | Moves to
~/.clawdis-backup |
OAuth Token Issues
If you see "Access token EXPIRED", run:
cd ~/Clawdis && npx clawdbot configure
Then select "Anthropic OAuth (Claude Pro/Max)" to re-authenticate.
Legacy Clawdis Migration
If you upgraded from Clawdis to Clawdbot, you may have legacy artifacts causing OAuth token conflicts:
- - Old launchd service: INLINECODE8
- Old config directory: INLINECODE9
Run discord-doctor --fix to clean these up automatically.
Example Output
CODEBLOCK2
Discord Doctor
快速诊断和修复Discord/Gateway可用性问题、OAuth令牌问题以及遗留的Clawdis配置冲突。
使用方法
bash
检查状态(仅诊断)
discord-doctor
检查并自动修复问题
discord-doctor --fix
检查项目
- 1. Discord应用 - Discord桌面应用是否在运行(可选,用于监控)
- Gateway进程 - Clawdbot网关守护进程是否在运行
- Gateway HTTP - 网关是否在端口18789上响应
- Discord连接 - 机器人是否实际连接到Discord(通过clawdbot health)
- Anthropic OAuth - 您的OAuth令牌是否有效或已过期
- 遗留Clawdis - 检测导致冲突的旧版launchd服务和配置目录
- 近期活动 - 显示最近的Discord会话
自动修复功能
使用--fix运行时,可以:
- - 启动网关(如果未运行)
- 安装缺失的npm包(如discord.js、strip-ansi)
- 修复依赖后重启网关
- 移除遗留的launchd服务(com.clawdis.gateway.plist)
- 备份遗留配置(将~/.clawdis移动到~/.clawdis-backup)
常见问题及修复
| 问题 | 自动修复操作 |
|---|
| 网关未运行 | 在端口18789上启动网关 |
| 缺少npm包 |
运行npm install + 安装特定包 |
| Discord断开连接 | 重启网关以重新连接 |
| OAuth令牌过期 | 显示重新认证的说明 |
| 遗留的launchd服务 | 移除旧的com.clawdis.gateway.plist |
| 遗留的~/.clawdis配置 | 移动到~/.clawdis-backup |
OAuth令牌问题
如果看到访问令牌已过期,请运行:
bash
cd ~/Clawdis && npx clawdbot configure
然后选择Anthropic OAuth (Claude Pro/Max)重新认证。
遗留Clawdis迁移
如果您从Clawdis升级到Clawdbot,可能存在导致OAuth令牌冲突的遗留工件:
- - 旧版launchd服务:~/Library/LaunchAgents/com.clawdis.gateway.plist
- 旧版配置目录:~/.clawdis/
运行discord-doctor --fix自动清理这些内容。
示例输出
Discord Doctor
正在检查Discord和Gateway健康状态...
- 1. Discord应用
运行中(6个进程)
- 2. Gateway进程
运行中(PID: 66156,运行时间: 07:45)
- 3. Gateway HTTP
在端口18789上响应
- 4. Discord连接
Discord: 正常 (@Clawdis) (321ms)
- 5. Anthropic OAuth
有效(45分钟后过期)
- 6. 遗留Clawdis
无遗留的launchd服务
无遗留的配置目录
- 7. 近期Discord活动
- discord:group:123456789012345678(21小时前)
总结
所有检查通过!Discord运行正常。