Discord Doctor:自动修复和健康检查 Discord 机器人 - Openclaw Skills

作者:互联网

2026-03-23

AI教程

什么是 Discord Doctor?

Discord Doctor 是 Openclaw Skills 生态系统中的专用工具,旨在维护 Discord 集成的健康和连接。它能识别常见的故障点,如过期的 Anthropic OAuth 令牌、网关进程停滞以及端口 18789 的可用性,确保您的 AI 代理保持响应并连接到服务器。

除了简单的诊断外,该技能还为从旧版 Clawdis 配置迁移到现代 Clawdbot 架构的用户提供了桥梁。通过自动移除冲突的 launchd 服务并备份旧配置目录,Discord Doctor 减少了技术债务并简化了 Openclaw Skills 环境的维护。

下载入口:https://github.com/openclaw/skills/tree/main/skills/kn71gxkg16twyqz5wzkvt61sh17yjnpd/discord-doctor

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install discord-doctor

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 discord-doctor。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Discord Doctor 应用场景

  • 排查网关进程停滞时 Discord 机器人的离线状态。
  • 解决 Anthropic OAuth 身份验证期间的 Access token EXPIRED 错误。
  • 系统升级后自动清理旧版 Clawdis 残留文件。
  • 验证是否正确安装并更新了所需的 npm 包(如 discord.js 和 strip-ansi)。
  • 监控最近的 Discord 会话活动,确保 Openclaw Skills 用户的高可用性。
Discord Doctor 工作原理
  1. 该工具扫描本地环境中的 Discord 桌面应用程序和活动的网关进程。
  2. 它测试端口 18789 的 HTTP 响应,并使用 clawdbot health 命令验证机器人的健康状况。
  3. 它评估 Anthropic OAuth 令牌的有效性,以预测潜在的身份验证失败。
  4. 它识别可能与当前操作冲突的旧版系统产物,例如 com.clawdis.gateway.plist。
  5. 在用户确认(通过 --fix 标志)后,它会执行补救步骤,包括重启服务和安装缺失的依赖项。

Discord Doctor 配置指南

请确保您的系统中安装了 Node.js 和 curl。此技能与 macOS (Darwin) 和 Linux 系统兼容。

要检查机器人的当前状态,请运行:

discord-doctor

要自动解决识别的问题并迁移旧版配置,请使用 fix 标志:

discord-doctor --fix

如果 OAuth 令牌已过期,请导航到安装目录重新进行身份验证:

cd ~/Clawdis && npx clawdbot configure

Discord Doctor 数据架构与分类体系

Discord Doctor 与系统级进程管理器和本地配置文件交互,以确保 Openclaw Skills 正常运行。

数据类型 位置 / 来源 用途
网关配置 ~/.clawdis 旧版配置存储(修复期间移至备份)
服务 Plist ~/Library/LaunchAgents/com.clawdis.gateway.plist 旧版 macOS 启动服务产物
端口数据 18789 Clawdbot 网关的默认通信端口
健康元数据 clawdbot health 实时连接状态和机器人身份验证
name: discord-doctor
description: Quick diagnosis and repair for Discord bot, Gateway, OAuth token, and legacy config issues. Checks connectivity, token expiration, and cleans up old Clawdis artifacts.
metadata: {"clawdbot":{"emoji":"??","os":["darwin","linux"],"requires":{"bins":["node","curl"]}}}

Discord Doctor

Quick diagnosis and repair for Discord/Gateway availability issues, OAuth token problems, and legacy Clawdis configuration conflicts.

Usage

# Check status (diagnostic only)
discord-doctor

# Check and auto-fix issues
discord-doctor --fix

What It Checks

  1. Discord App - Is the Discord desktop app running (optional, for monitoring)
  2. Gateway Process - Is the Clawdbot gateway daemon running
  3. Gateway HTTP - Is the gateway responding on port 18789
  4. Discord Connection - Is the bot actually connected to Discord (via clawdbot health)
  5. Anthropic OAuth - Is your OAuth token valid or expired
  6. Legacy Clawdis - Detects old launchd services and config directories that cause conflicts
  7. 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: ~/Library/LaunchAgents/com.clawdis.gateway.plist
  • Old config directory: ~/.clawdis/

Run discord-doctor --fix to clean these up automatically.

Example Output

Discord Doctor
Checking Discord and Gateway health...

1. Discord App
   Running (6 processes)

2. Gateway Process
   Running (PID: 66156, uptime: 07:45)

3. Gateway HTTP
   Responding on port 18789

4. Discord Connection
   Discord: ok (@Clawdis) (321ms)

5. Anthropic OAuth
   Valid (expires in 0h 45m)

6. Legacy Clawdis
   No legacy launchd service
   No legacy config directory

7. Recent Discord Activity
   - discord:group:123456789012345678 (21h ago)

Summary
All checks passed! Discord is healthy.