为什么用 OpenClaw 做 Discord 客服?

Discord 社群人数一多,管理员根本回不过来。新人问怎么注册、老用户问功能怎么用、有人反馈 bug——这些重复性问题占了 80% 的消息量。
用 OpenClaw 接入一个 AI 客服 Bot,它能 7×24 小时自动回答常见问题,只有真正需要人工处理的才通知你。这篇教程带你从创建 Discord Bot 到 AI 自动回复全流程跑通。
前置准备
- 一个 Discord 账号(用来创建 Bot)
- 一个你管理的 Discord 服务器
- OpenClaw 已安装并能正常运行(
openclaw status显示正常)
第一步:在 Discord Developer Portal 创建 Application
show (a ticket) Discord Developer Portal,点击右上角 New ApplicationThe
给应用起个名字,比如”OpenClaw 客服”。创建完成后你会进入应用管理页面。
第二步:创建 Bot 并获取 Token
In the left menu click on Bot,然后:
- 设置 Bot 的用户名(这是用户在 Discord 里看到的名字)
- strike (on the keyboard) Reset Token 生成 Bot Token
- 复制并保存这个 Token(只显示一次,丢了要重新生成)
重要:Bot Token 相当于密码,不要分享给任何人,不要提交到 Git。
第三步:开启 Privileged Intents

还是在 Bot 页面,往下滚动到 Privileged Gateway Intents,开启以下选项:
- Message Content Intent(必须开启,否则 Bot 读不到消息内容)
- Server Members Intent(推荐开启,用于识别用户身份)
不开 Message Content Intent 的话,Bot 只能看到消息存在但看不到内容,等于瞎子。
第四步:生成邀请链接并添加 Bot 到服务器
Click on the left side OAuth2,在 OAuth2 URL Generator 里勾选:
- Scopes:
bot,applications.commands - Bot Permissions:View Channels、Send Messages、Read Message History、Embed Links、Attach Files
如果你的 Bot 需要在帖子/论坛频道里回复,还要勾选 Send Messages in ThreadsThe
复制生成的 URL,在浏览器打开,选择你的服务器,点 Continue 完成添加。
第五步:在 OpenClaw 中配置 Discord Token
回到你的服务器终端,把 Bot Token 配置到 OpenClaw:
export DISCORD_BOT_TOKEN="你的Bot Token"
cat > discord.patch.json5 << 'JSON5'
{
channels: {
discord: {
enabled: true,
token: { source: "env", provider: "default", id: "DISCORD_BOT_TOKEN" },
},
},
}
JSON5
# 先预览变更
openclaw config patch --file ./discord.patch.json5 --dry-run
# 确认无误后应用
openclaw config patch --file ./discord.patch.json5
Token 通过环境变量引用,不会明文写入配置文件,更安全。
第六步:启动 Gateway
# 如果 Gateway 没在运行
openclaw gateway
# 如果已经在运行,重启使配置生效
openclaw gateway restart
启动后观察日志,确认 Discord 连接成功:
openclaw logs --follow
# 应该看到类似 "Discord: connected" 的日志
第七步:配对(Pairing)
OpenClaw 默认对 Discord DM 使用 pairing 模式——第一次有人给 Bot 发私信时,需要你手动批准。
# 查看待批准的配对请求
openclaw pairing list discord
# 批准
openclaw pairing approve discord <配对码>
配对码 1 小时内有效。批准后,该用户就能跟 Bot 正常对话了。
如果你想让 Bot 在服务器频道里直接回复(不需要配对),需要配置群组权限。
第八步:设置群组权限
让 Bot 在特定频道自动回复:
{
channels: {
discord: {
enabled: true,
token: { source: "env", provider: "default", id: "DISCORD_BOT_TOKEN" },
guilds: {
"你的服务器ID": {
allowFrom: ["*"],
requireMention: true
}
}
}
}
}
关键参数说明:
guilds.服务器ID:你的 Discord 服务器 ID(右键服务器图标 → Copy Server ID)allowFrom: ["*"]:允许所有人跟 Bot 对话requireMention: true:只有 @Bot 时才回复(推荐,避免刷屏)
第九步:测试
配置完成后,在 Discord 服务器里 @你的 Bot 发一条消息,比如"你好,你能做什么?"。如果一切正常,Bot 会在几秒内回复。
测试清单:
- @Bot 发消息能收到回复 ✓
- 不 @Bot 时不会回复 ✓
- 私信 Bot 能正常对话 ✓
- 回复内容符合你设定的 AI 人格 ✓
common problems
Q1:Bot 加入服务器后发消息没反应?
最常见原因:没开 Message Content Intent。回到 Developer Portal → Bot → Privileged Gateway Intents,确认 Message Content Intent 已开启。改完后需要重启 Gateway。
Q2:Bot 在群里回复所有消息怎么办?
classifier for objects with a handle requireMention set up as true,这样只有 @Bot 时才会回复。如果已经设了还是乱回,检查是否有其他 guild 配置覆盖了这个设置。
Q3:怎么让 Bot 只在特定频道回复?
在 guilds 配置里指定频道 ID 而不是用 "*"。或者在 Discord 服务器设置里,限制 Bot 只能看到特定频道(通过角色权限控制)。
Q4:Bot Token 泄露了怎么办?
立即去 Developer Portal → Bot → Reset Token 重新生成。然后更新 OpenClaw 配置里的环境变量,重启 Gateway。
Q5:能不能让 Bot 发图片或文件?
可以。OpenClaw 支持通过 Discord 发送 Embed、图片和文件附件。确保 Bot 权限里勾选了 Attach Files 和 Embed Links。
Q6:多个 Discord 服务器能用同一个 Bot 吗?
可以。把 Bot 邀请到多个服务器,然后在 guilds 配置里分别设置每个服务器的规则。
相关教程推荐
- OpenClaw 怎么做 WhatsApp 客服自动回复?从安装到上线的完整教程
- OpenClaw 怎么检查页面 SEO?发布前必须过一遍的 11 项清单
- OpenClaw 怎么复盘 SEO 数据?从收录检查到内容优化的完整流程
summarize
用 OpenClaw 接入 Discord 做客服 Bot 的核心流程:创建 Application → 拿 Token → 开 Intent → 邀请到服务器 → 配置 OpenClaw → 启动测试。整个过程 15 分钟能搞定。
配置好之后,Bot 就能 7×24 自动回答社群里的常见问题,你只需要关注真正需要人工处理的消息。
更多 Discord 接入细节,参考官方文档:OpenClaw Discord 渠道文档The
Link to this article:https://www.361sale.com/en/87567/The article is copyrighted and must be reproduced with attribution.













March 11, 13:490
Now definitely still do SEO, just play changed. Previously rely on heaps of content, heaps of keywords can have traffic, and now pay more attention to the quality of content + brand trust + user experience. In addition to relying solely on SEO is actually more and more difficult, a lot of good basically SEO + social media + content marketing + private domain conversion to do together. SEO is still a long-term customer acquisition channel, but can no longer be taken as the only channel.Hehe is working.
March 11, 10:540
Normal, included only on behalf of Google to see the page, does not mean that the ranking immediately, "has been included but not ranked" usually because: Keyword competition, page weight is low, the content is not strong enough, the page is relatively new. Continue to optimize the long-tail keywords, content quality and internal chain, usually takes a little time, the ranking will slowly come out!Amelia Foster March 6, 16:200
Do you have a screenshot?lit. even a son who is not a fish knows the joy of fish March 6, 09:230
Don't pile on the optimization plugins first, locate the bottlenecks first: Use Query Monitor to see slow SQL, slow hooks. Pause all plugins for comparison, then turn them on one by one. Check autoload is too big (options table). Check database indexes with large table queries. Tackle host/database performance first if server TTFB is high.Hehe is working.
March 3, 16:470
Hi Windjammer, there's really no need to mess with complicated local environments, regular people follow these steps and the update basically won't crash the site 👇 First, backup the whole site, files + database are prepared, this is the bottom line, out of the problem can be a key to go back. Don't change the whole thing in one click, change it in batches, change the unimportant plug-ins first, and then change the core ones. Immediately after the update, clear the cache, go to the foreground to check the home page, article page, buttons, forms, these key positions. It is best to install a plug-in that supports version rollback, in case of a crash, cut back to the old version in a second. To summarize: backup first, change in batches, check after changing, leave a way back, stable ✅😎 Hope this helps!bugbang March 2, 09:550
Usually it's not that the payment didn't work, but that the callback (webhook) didn't write back the order status. Troubleshooting steps: WooCommerce → Status → Logs: see if the payment gateway has webhook error / signature error / timeout Check if the site is blocked by WAF (Cloudflare, Pagoda Firewall, security plugins) Check if "Cache checkout pages/interface paths" is enabled (checkout pages and callback interfaces should not be cached) Look at the server error logs for 500/fatal errors that interrupt the callback execution. Solution: Release wp-json, wc-api, payment gateway callback URLs (configure as per gateway documentation) Disable cache and JS merge compression test on checkout page once If using Cloudflare: set no-challenge, no-block rules for callback URLsUlla Nala Zhenhuan (18嬛嬛嬛) January 31st, 09:360
1) Determine whether it is "Normal Waiting" or "Abnormally Stuck". You can first look at 3 signals: whether the page release time is within 7-14 days, whether there are only a small number of pages with this status, and whether the page has appeared in the XML Sitemap. If all three are satisfied, most likely belong to the normal crawling and evaluation stage, do not need to do it immediately. 2) Under what circumstances is it useless to "wait"? The following cases will not be solved automatically by time: the page has almost no internal links (isolated page), the content is highly similar to the existing pages on the site, canonical points to other URLs, and too many similar articles are published on the same topic for a short period of time. In this case, Google has been crawled, but judged that "it is not worth entering the index". 3) The most effective way of manual intervention (no tossing) Prioritize these 3 things: add internal links, link to the page from related old articles or columns, and enhance the density of information on the first screen. The first 2-3 paragraphs directly answer the user's question, avoid too much padding, confirm canonical as self-referential, avoid being judged as a duplicate page, and then go to GSC to request reindexing after doing so. 4) What "intervention actions" are counterproductive? It is not recommended: frequent deletion and reposting, clicking "request to index" several times in a row, forcing keywords to be stacked for indexing, changing URLs or titles arbitrarily. These operations will allow Google to reassess the stability of the page, but slow down the inclusion. 5) a practical judgment standard If an article: has been crawled, there is no noindex / robots problem, there are at least 1-2 related internal links, the content obviously solves an independent problem, then it is included, just a matter of time, not a plug-in problem.Post Porter January 30th 10:000
The new station does not do external links can be completely, the first content and station structure to do a good job more stable. Only rely on the content can generally get included and part of the long-tail word rankings, but the amount of high competition will be slow. It is recommended to wait for the site stable inclusion, 30-50 quality content, keywords began to enter the top 20/30, and then a small amount of external links, priority brand words/naked chain/citation type, do not come up to chase the number. 👍