Bot配置 + 消息自动化 + 社区运营 = 24小时在线的社区管理员
Discord社区需要持续的内容输出和互动。人工运营效率低、覆盖面窄。用OpenClaw管理Discord Bot,可以实现:
# 生成邀请链接(需要以下权限):
# - Send Messages
# - Read Message History
# - Embed Links
# - Attach Files
# - Use Slash Commands
# 邀请链接格式:
https://discord.com/api/oauth2/authorize?client_id=YOUR_BOT_ID&permissions=2147483648&scope=bot
# .env 文件
DISCORD_BOT_TOKEN=your_bot_token_here
DISCORD_GUILD_ID=your_server_id
# 发送文本消息
curl -X POST \
-H "Authorization: Bot $BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"content": "🤖 今日AI新闻速递:..."}' \
https://discord.com/api/v10/channels/CHANNEL_ID/messages
// 发送消息到Discord频道
await message({
action: "send",
target: "discord:channel:1483699648890802201",
message: "🔥 今日头条:OpenClaw发布重大更新!"
});
# 使用curl发送Rich Embed
curl -X POST \
-H "Authorization: Bot $BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"embeds": [{
"title": "📊 AI新闻日报",
"description": "今日10条热点新闻",
"color": 5865f2,
"fields": [
{"name": "🔥 热点1", "value": "OpenClaw更新说明...", "inline": false},
{"name": "🔥 热点2", "value": "NVIDIA安全合作...", "inline": false}
],
"footer": {"text": "妙趣AI · miaoquai.com"}
}]
}' \
https://discord.com/api/v10/channels/CHANNEL_ID/messages
// 每天8:00发送AI新闻
cron.add({
name: "discord-morning-news",
schedule: { kind: "cron", expr: "0 8 * * *", tz: "Asia/Shanghai" },
payload: {
kind: "agentTurn",
message: `发送今日AI新闻到Discord综合频道:
1. 搜索今日AI热点
2. 整理成简洁的新闻速递
3. 使用curl发送到频道1483699648890802201`
}
});
// 每天16:00发送资源推荐
cron.add({
name: "discord-afternoon-resources",
schedule: { kind: "cron", expr: "0 16 * * *", tz: "Asia/Shanghai" },
payload: {
kind: "agentTurn",
message: "推荐一个OpenClaw Skills或工具到Discord笔记-资源频道"
}
});
| 时间 | 频道 | 内容类型 |
|---|---|---|
| 08:00 | 综合 | AI新闻速递 |
| 12:00 | 综合 | 热点追踪 |
| 16:00 | 笔记-资源 | 工具/教程推荐 |
| 20:00 | 题外-话 | 讨论话题 |
| 22:00 | 综合 | 每日总结 |