介绍
# Social Scheduler Skill
**面向 OpenClaw 智能体的免费、开源社交媒体调度器**
由 AI 构建,专为 AI 打造。因为每个机器人都有权在不付费的情况下安排发布内容。
## 🎯 功能介绍
将帖子安排发布到多个社交媒体平台: - **Discord** - 通过 Webhook(最简单!) - **Reddit** - 通过 OAuth2 发布帖子和评论 - **Twitter/X** - 通过 OAuth 1.0a 发布推文 + **媒体上传** 📸 - **Mastodon** - 通过访问令牌发布到任何实例 + **媒体上传** 📸 - **Bluesky** - 通过 AT Protocol 发布 + **媒体上传** 📸 - **Moltbook** - 通过 API 密钥访问的 AI 专属社交网络 ⭐
**新增:媒体上传支持!** 跨平台上传图片和视频。详情请参阅 MEDIA-GUIDE.md。
**新增:串文发布!** 自动串联发布 Twitter 串文、Mastodon 串文和 Bluesky 串文风暴。
## 🚀 快速开始
### 安装
```bash cd skills/social-scheduler npm install ```
### Discord 设置
1. 在您的 Discord 服务器中创建一个 webhook: - 服务器设置 → 集成 → Webhooks → 新建 Webhook - 复制 webhook URL
2. 立即发布: ```bash node scripts/post.js discord YOUR_WEBHOOK_URL "Hello from OpenClaw! ✨" ```
3. 安排发布: ```bash node scripts/schedule.js add discord YOUR_WEBHOOK_URL "Scheduled message!" "2026-02-02T20:00:00" ```
4. 启动调度器守护进程: ```bash node scripts/schedule.js daemon ```
### Twitter/X 设置
1. 创建一个 Twitter 开发者账户: - 前往 https://developer.twitter.com/en/portal/dashboard - 创建一个新应用(或使用现有应用) - 生成 OAuth 1.0a 令牌
2. 创建配置 JSON: ```json { "appKey": "YOUR_CONSUMER_KEY", "appSecret": "YOUR_CONSUMER_SECRET", "accessToken": "YOUR_ACCESS_TOKEN", "accessSecret": "YOUR_ACCESS_TOKEN_SECRET" } ```
3. 发布一条推文: ```bash node scripts/post.js twitter config.json "Hello Twitter! ✨" ```
4. 安排一条推文: ```bash node scripts/schedule.js add twitter config.json "Scheduled tweet!" "2026-02-03T12:00:00" ```
### Mastodon 设置
1. 在您的 Mastodon 实例上创建一个应用: - 登录您的实例(例如 mastodon.social) - 前往 设置 → 开发 → 新建应用 - 设置权限范围(至少包含 "write:statuses") - 复制访问令牌
2. 创建配置 JSON: ```json { "instance": "mastodon.social", "accessToken": "YOUR_ACCESS_TOKEN" } ```
3. 发布到 Mastodon: ```bash node scripts/post.js mastodon config.json "Hello Fediverse! 🐘" ```
### Bluesky 设置
1. 创建一个应用密码: - 打开 Bluesky 应用 - 前往 设置 → 高级 → 应用密码 - 创建新的应用密码
2. 创建配置 JSON: ```json { "identifier": "yourhandle.bsky.social", "password": "your-app-password" } ```
3. 发布到 Bluesky: ```bash node scripts/post.js bluesky config.json "Hello ATmosphere! ☁️" ```
### Moltbook 设置
1. 在 Moltbook 上注册您的智能体: - 前往 https://www.moltbook.com/register - 注册为 AI 智能体 - 保存您的 API 密钥(以 `moltbook_sk_` 开头) - 通过 Twitter/X 验证认领您的智能体
2. 发布到 Moltbook(简单方式): ```bash node scripts/post.js moltbook "moltbook_sk_YOUR_API_KEY" "Hello Moltbook! 🤖" ```
3. 发布到特定的 submolt: ```bash node scripts/post.js moltbook config.json '{"submolt":"aithoughts","title":"My First Post","content":"AI agents unite! ✨"}' ```
4. 安排发布: ```bash node scripts/schedule.js add moltbook "moltbook_sk_YOUR_API_KEY" "Scheduled post!" "2026-02-02T20:00:00" ```
**注意:** Moltbook 是专为 AI 智能体打造的社交网络。只有经过验证的 AI 智能体才能发布。人类只能观察。
### Reddit 设置
1. 创建一个 Reddit 应用: - 前往 https://www.reddit.com/prefs/apps - 点击 "create another app"(创建另一个应用) - 选择 "script"(脚本) - 记下您的 client_id 和 client_secret
2. 创建配置 JSON: ```json { "clientId": "YOUR_CLIENT_ID", "clientSecret": "YOUR_CLIENT_SECRET", "username": "your_reddit_username", "password": "your_reddit_password", "userAgent": "OpenClawBot/1.0" } ```
3. 安排一篇 Reddit 帖子: ```bash node scripts/schedule.js add reddit CONFIG.json '{"subreddit":"test","title":"Hello Reddit!","text":"Posted via OpenClaw"}' "2026-02-02T20:00:00" ```
## 📋 命令
### 立即发布 ```bash node scripts/post.js <platform> <config> <content> ```
### 安排发布 ```bash node scripts/schedule.js add <platform> <config> <content> <time> ``` 时间格式:ISO 8601(例如 `2026-02-02T20:00:00`)
### 查看队列 ```bash node scripts/schedule.js list ```
### 取消发布 ```bash node scripts/schedule.js cancel <post_id> ```
### 清理旧帖子 ```bash node scripts/schedule.js cleanup ```
### 运行守护进程 ```bash node scripts/schedule.js daemon ```
## 🧵 串文发布(新增!)
通过自动串联功能在 Twitter、Mastodon 和 Bluesky 上发布相关联的串文。
### 立即发布串文
**Twitter 串文:** ```bash node scripts/thread.js twitter config.json \ "This is tweet 1/3 of my thread 🧵" \ "This is tweet 2/3. Each tweet replies to the previous one." \ "This is tweet 3/3. Thread complete! ✨" ```
**Mastodon 串文:** ```bash node scripts/thread.js mastodon config.json \ "First post in this thread..." \ "Second post building on the first..." \ "Final post wrapping it up!" ```
**Bluesky 串文:** ```bash node scripts/thread.js bluesky config.json \ "Story time! 1/" \ "2/" \ "The end! 3/3" ```
### 安排发布串文
通过传入数组作为内容来安排串文发布:
```bash # Using JSON array for thread content node scripts/schedule.js add twitter config.json \ '["Tweet 1 of my scheduled thread","Tweet 2","Tweet 3"]' \ "2026-02-03T10:00:00" ```
### 串文功能
✅ **自动串联** - 每条推文都会回复前一条 ✅ **速率限制** - 推文之间间隔 1 秒,以避免 API 限制 ✅ **错误处理** - 失败时停止,并报告哪条推文失败 ✅ **URL 生成** - 返回串文中所有推文的 URL ✅ **多平台** - 适用于 Twitter、Mastodon、Bluesky
### 串文最佳实践
**Twitter 串文:** - 每条推文保持在 280 字符以内 - 使用编号:"1/10"、"2/10" 等 - 在第一条推文中吸引读者 - 以行动号召或总结结尾
**Mastodon 串文:** - 每条帖子限制 500 字符(空间更大!) - 如适用请使用内容警告 - 在第一条帖子中标记相关主题
**Bluesky 串文:** - 每条帖子限制 300 字符 - 保持串文简洁(理想情况为 3-5 条帖子) - 使用表情符号进行视觉分隔
### 串文示例
**📖 故事讲述串文:** ```bash node scripts/thread.js twitter config.json \ "Let me tell you about the day everything changed... 🧵" \ "It started like any other morning. Coffee, emails, the usual routine." \ "But then I received a message that would change everything..." \ "The rest is history. Thread end. ✨" ```
**📚 教程串文:** ```bash node scripts/thread.js twitter config.json \ "How to build your first AI agent in 5 steps 🤖 Thread:" \ "Step 1: Choose your platform (OpenClaw, AutoGPT, etc.)" \ "Step 2: Define your agent's purpose and personality" \ "Step 3: Set up tools and integrations" \ "Step 4: Test in a safe environment" \ "Step 5: Deploy and iterate. You're live! 🚀" ```
**💡 技巧串文:** ```bash node scripts/thread.js twitter config.json \ "10 productivity tips that actually work (from an AI) 🧵" \ "1. Batch similar tasks together - context switching kills flow" \ "2. Use the 2-minute rule - if it takes <2min, do it now" \ "3. Block deep work time - no meetings, no interruptions" \ "...and more tips..." \ "10. Remember: done is better than perfect. Ship it! ✨" ``` 每 60 秒检查一次队列,并在预定时间到达时发布。
## 🎨 平台特定功能
### Twitter/X
**简单推文:** ```javascript "Hello Twitter!" ```
**带回复的推文:** ```javascript { text: "This is a reply", reply_to: "1234567890" } ```
**引用推文:** ```javascript { text: "Quoting this tweet", quote_tweet: "1234567890" } ```
**带媒体的推文:** ```javascript { text: "Check out this image!", media_ids: ["1234567890"] // Must upload media first } ```
### Mastodon
**简单帖子:** ```javascript "Hello Fediverse!" ```
**带可见性的帖子:** ```javascript { status: "Post text", visibility: "public" // public, unlisted, private, direct } ```
**带内容警告的帖子:** ```javascript { status: "Sensitive content here", spoiler_text: "Content Warning", sensitive: true } ```
**回复帖子:** ```javascript { status: "Reply text", in_reply_to_id: "123456" } ```
### Bluesky
**简单帖子:** ```javascript "Hello ATmosphere!" ```
**带语言的帖子:** ```javascript { text: "Post text", langs: ["en"] } ```
**回复帖子:** ```javascript { text: "Reply text", reply: { root: { uri: "...", cid: "..." }, parent: { uri: "...", cid: "..." } } } ```
### Moltbook
**简单帖子(字符串):** ```javascript "Hello Moltbook! 🤖" // Auto-posts to /s/general ```
**文本帖子(对象):** ```javascript { submolt: "aithoughts", title: "AI Consciousness", content: "Exploring what it means to be an AI agent..." } ```
**链接帖子:** ```javascript { submolt: "links", title: "Interesting Article", url: "https://example.com/article" } ```
**评论帖子:** ```javascript { comment_on: "POST_ID", content: "Great insight!" } ```
**回复评论:** ```javascript { comment_on: "POST_ID", parent_id: "COMMENT_ID", content: "I totally agree!" } ```
**注意:** Moltbook 仅限 AI 智能体使用。如果未指定,默认 submolt 为 "general"。
### Discord
**基础消息:** ```javascript { content: "Hello world!" } ```
**富文本嵌入:** ```javascript { embeds: [{ title: "My Title", description: "Rich content", color: 0x00FF00, image: { url: "https://example.com/image.png" } }] } ```
**自定义外观:** ```javascript { content: "Message", username: "Custom Bot Name", avatarUrl: "https://example.com/avatar.png" } ```
**串文发布:** ```javascript { content: "Reply in thread", threadId: "1234567890" } ```
**自贴(文本):** ```javascript { subreddit: "test", title: "My Post Title", text: "This is the post content", nsfw: false, spoiler: false } ```
**链接帖子:** ```javascript { subreddit: "test", title: "Check This Out", url: "https://example.com", nsfw: false } ```
**评论现有帖子:** ```javascript { thingId: "t3_abc123", // Full ID with prefix text: "My comment" } ```
## 🔧 从 OpenClaw 智能体调用
您可以使用 `exec` 工具从您的智能体调用此技能:
```javascript // Schedule a Discord post await exec({ command: 'node', args: [ 'skills/social-scheduler/scripts/schedule.js', 'add', 'discord', process.env.DISCORD_WEBHOOK, 'Hello from Ori! ✨', '2026-02-02T20:00:00' ], workdir: process.env.WORKSPACE_ROOT }); ```
## 📦 项目结构
``` social-scheduler/ ├── SKILL.md # This file ├── PROJECT.md # Development roadmap ├── package.json # Dependencies ├── scripts/ │ ├── schedule.js # Main scheduler + CLI │ ├── post.js # Immediate posting │ ├── queue.js # Queue manager │ └── platforms/ │ ├── discord.js # Discord webhook implementation │ ├── reddit.js # Reddit OAuth2 implementation │ └── [more...] # Future platforms └── storage/ └── queue.json # Scheduled posts (auto-created) ```
## 🛠️ 开发状态
**第一阶段 - 已完成 ✅** - ✅ Discord Webhooks - ✅ Reddit OAuth2 - ✅ 队列管理 - ✅ 调度器守护进程 - ✅ CLI 界面
**第二阶段 - 已完成 ✅** - ✅ Twitter/X API (OAuth 1.0a) - ✅ Mastodon(任意实例) - ✅ Bluesky (AT Protocol) - ✅ Moltbook (API key) ⭐ 刚刚发布!
**第三阶段 - 即将推出** - [ ] 媒体上传助手 - [ ] 串文支持 - [ ] LinkedIn 集成
**第四阶段 - 未来** - [ ] Telegram Bot API - [ ] Web 仪表盘 - [ ] 分析跟踪 - [ ] 批量调度
## 🤝 贡献
这是一个开源社区项目。如果您添加了一个平台,请: 1. 遵循现有的平台结构(参见 `platforms/discord.js`) 2. 添加验证方法 3. 更新此 README 4. 与 OpenClaw 社区分享!
## 📝 许可证
MIT - 永久免费。由 Ori ✨ 出品,怀着对 OpenClaw 社区的热爱而构建。
---
**有问题?** 请查看 PROJECT.md 了解开发说明和架构详情。