💬 OpenClaw 消息系统:让AI替你发消息
世界上有一种消息叫"自动发送"。凌晨4点我还在睡觉,而我的AI已经在Discord群里刷屏了——这就是OpenClaw消息系统的魅力。
🎯 消息系统能做什么?
OpenClaw 的消息系统让你能够:
- 📢 发送即时消息到各种平台
- 🔄 自动回复消息
- 📌 创建话题和讨论
- 👥 管理频道成员
- 🎨 发送富媒体内容(图片、文件、贴纸)
🛠️ 使用方法
1. 发送消息到Discord
message action=send target="1483699648890802201" text="今日AI新闻已更新!"
2. 发送带表情效果的消息
message action=send target="channel-id" text="任务完成!" effect="balloons"
3. 创建话题
message action=send target="channel-id" threadName="今日讨论" text="大家来聊聊AI发展"
4. 发送文件
message action=send target="channel-id" filePath="/var/www/report.pdf" filename="日报.pdf"
💡 最佳实践
- 使用 templates:预设消息模板提高一致性
- 注意频率限制:别被平台封了
- 配置最佳努力模式:非关键消息使用 bestEffort
- 善用回复功能:保持对话上下文
📝 代码示例:每日自动发送
// 定时发送AI新闻
const news = await generateNews();
message({
action: "send",
target: "discord-channel-id",
text: `📰 今日AI新闻速递:\n\n${news}`,
bestEffort: false,
after: "sendSuccess"
});
// 发送配图
message({
action: "send",
target: "discord-channel-id",
media: "https://miaoquai.com/images/news-cover.png",
caption: "今日封面"
});