Skip to content

Commit ae9d73c

Browse files
author
王允
committed
readme.md 文档内容优化。修复cli 命令执行报错问题。
1 parent 2fe552f commit ae9d73c

4 files changed

Lines changed: 45 additions & 31 deletions

File tree

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ This configuration tells OpenClaw to trust and allow loading this plugin. After
147147
```
148148
- You should see the message in your Feishu chat.
149149
150-
### 3. Setup Scheduled Tasks or Run Immediately
150+
### Setup Scheduled Tasks or Run Immediately
151151
152-
Use the registered `gen-cron` CLI command to quickly set up scheduled tasks or run immediately. Execute the following commands in the **command line**:
152+
Use the registered `gen-cron` CLI command to quickly set up scheduled tasks or run immediately. Execute the following commands in the **command line** where you can use the `openclaw` command:
153153
154154
```
155155
# Run immediately: Fetch today's trending and push to Feishu and Email
@@ -213,30 +213,30 @@ openclaw cron add --name "GitHub Trending Weekly Feishu+Email" \
213213
Simply describe your needs in natural language in the OpenClaw chat interface:
214214

215215
```
216-
Help me create a scheduled task that pushes GitHub monthly trending to my email every day at 18:45
216+
Use the openclaw-github-trending tool to help me create a scheduled task that pushes GitHub monthly trending to my email every day at 18:45
217217
```
218218

219219
**Supported Natural Language Examples:**
220220

221221
```text
222222
// Daily Push
223-
- "Help me create a task to push GitHub daily trending to my email every morning at 8:00"
224-
- "I want to receive GitHub daily trending in my email every day at 18:45"
225-
- "Create a scheduled task: fetch daily trending every day at 9:00 AM and push to Feishu"
223+
- "Use the openclaw-github-trending tool to help me create a task to push GitHub daily trending to my email every morning at 8:00"
224+
- "I want to use the openclaw-github-trending tool to receive GitHub daily trending in my email every day at 18:45"
225+
- "Use the openclaw-github-trending tool to create a scheduled task: fetch daily trending every day at 9:00 AM and push to Feishu"
226226
227227
// Weekly Push
228-
- "Help me create a task to push GitHub weekly trending to Feishu every Monday at 10:00"
229-
- "I want to receive weekly trending in Feishu and email every Friday at 18:00"
230-
- "Fetch weekly trending every Wednesday morning at 9:00 AM and push to Feishu"
228+
- "Use the openclaw-github-trending tool to help me create a task to push GitHub weekly trending to Feishu every Monday at 10:00"
229+
- "I want to use the openclaw-github-trending tool to receive weekly trending in Feishu and email every Friday at 18:00"
230+
- "Use the openclaw-github-trending tool to fetch weekly trending every Wednesday morning at 9:00 AM and push to Feishu"
231231
232232
// Monthly Push
233-
- "Help me create a task to push GitHub monthly trending to my email on the 1st of every month at 9:00"
234-
- "I want to receive GitHub monthly trending in my email on the 15th of every month at 18:45"
235-
- "Help me use the openclaw-github-trending tool to create a scheduled task that runs every day at 18:45, pushes monthly GitHub trending, and sends the content to my email"
233+
- "Use the openclaw-github-trending tool to help me create a task to push GitHub monthly trending to my email on the 1st of every month at 9:00"
234+
- "I want to use the openclaw-github-trending tool to receive GitHub monthly trending in my email on the 15th of every month at 18:45"
235+
- "Use the openclaw-github-trending tool to help me create a scheduled task that runs every day at 18:45, pushes monthly GitHub trending, and sends the content to my email"
236236
237237
// Multi-Channel Push
238-
- "Help me create a task to push daily trending to both Feishu and email every day at 8:00"
239-
- "I want to receive trending every day at 10:00, sent to both Feishu and my email"
238+
- "Use the openclaw-github-trending tool to help me create a task to push daily trending to both Feishu and email every day at 8:00"
239+
- "I want to use the openclaw-github-trending tool to receive trending every day at 10:00, sent to both Feishu and my email"
240240
```
241241

242242
**Intelligent Parsing Capabilities:**
@@ -248,7 +248,7 @@ Help me create a scheduled task that pushes GitHub monthly trending to my email
248248

249249
**Execution Flow:**
250250

251-
1. User inputs natural language instruction in OpenClaw chat
251+
1. User inputs natural language instruction in OpenClaw chat (must include `openclaw-github-trending` tool name)
252252
2. OpenClaw parses the instruction and identifies the tool (`openclaw-github-trending`)
253253
3. Automatically extracts time, period, push channels, and other parameters
254254
4. Generates the corresponding `cron add` command and creates the task

README_CN.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ openclaw plugins install openclaw-github-trending
150150
151151
### 3. 设置定时任务或立即执行
152152
153-
使用注册的 `gen-cron` CLI 命令快速设置定时任务或立即执行。**命令行中**执行以下命令
153+
使用注册的 `gen-cron` CLI 命令快速设置定时任务或立即执行。在你能使用 `openclaw` 命令的那个**命令行中**中直接执行以下命令
154154
155155
```
156156
# 立即执行:获取今日热榜并推送到飞书和邮箱
@@ -214,30 +214,30 @@ openclaw cron add --name "GitHub 热榜 每周 飞书+邮箱" \
214214
直接在 OpenClaw 聊天界面中用自然语言描述需求:
215215

216216
```
217-
帮我创建一个每天 18:45 推送 GitHub 月榜到邮箱的定时任务
217+
使用openclaw-github-trending工具,帮我创建一个每天 18:45 推送 GitHub 月榜到邮箱的定时任务
218218
```
219219

220220
**支持的自然语言示例:**
221221

222222
```text
223223
// 每日推送
224-
- "帮我创建每天早上 8:00 推送 GitHub 今日热榜到邮箱的任务"
225-
- "我想每天 18:45 收到 GitHub 今日热榜,发到我的邮箱"
226-
- "创建定时任务:每天 9:00 获取今日热榜并推送到飞书"
224+
- "使用openclaw-github-trending工具,帮我创建每天早上 8:00 推送 GitHub 今日热榜到邮箱的任务"
225+
- "我想使用openclaw-github-trending工具,在每天 18:45 收到 GitHub 今日热榜,并把内容发送到我的邮箱"
226+
- "使用openclaw-github-trending工具创建定时任务:每天 9:00 获取今日热榜并推送到飞书"
227227
228228
// 每周推送
229-
- "帮我创建每周一 10:00 推送 GitHub 本周热榜到飞书的任务"
230-
- "我想每周五 18:00 收到本周热榜,发到飞书和邮箱"
231-
- "每周三早上 9:00 获取本周热榜并推送到飞书"
229+
- "使用openclaw-github-trending工具,帮我创建每周一 10:00 推送 GitHub 本周热榜到飞书的任务"
230+
- "我想使用openclaw-github-trending工具,每周五 18:00 收到本周热榜,发到飞书和邮箱"
231+
- "使用openclaw-github-trending工具,每周三早上 9:00 获取本周热榜并推送到飞书"
232232
233233
// 每月推送
234-
- "帮我创建每月 1 号 9:00 推送 GitHub 月榜到邮箱的任务"
235-
- "我想每月 15 号 18:45 收到 GitHub 月榜,发到我的邮箱"
236-
- "帮我使用 openclaw-github-trending 工具创建一个每天 18:45,推送每月 GitHub 热榜的定时任务,需要将 GitHub 热榜内容发送到我的邮箱中"
234+
- "使用openclaw-github-trending工具,帮我创建每月 1 号 9:00 推送 GitHub 月榜到邮箱的任务"
235+
- "我想使用openclaw-github-trending工具,每月 15 号 18:45 收到 GitHub 月榜,发到我的邮箱"
236+
- "使用openclaw-github-trending工具,帮我创建一个每天 18:45,推送每月 GitHub 热榜的定时任务,需要将 GitHub 热榜内容发送到我的邮箱中"
237237
238238
// 多渠道推送
239-
- "帮我创建每天 8:00 推送今日热榜到飞书和邮箱的任务"
240-
- "我想每天 10:00 收到热榜,同时发到飞书和我的邮箱"
239+
- "使用openclaw-github-trending工具,帮我创建每天 8:00 推送今日热榜到飞书和邮箱的任务"
240+
- "我想使用openclaw-github-trending工具,每天 10:00 收到热榜,同时发到飞书和我的邮箱"
241241
```
242242

243243
**智能解析能力:**
@@ -249,7 +249,7 @@ openclaw cron add --name "GitHub 热榜 每周 飞书+邮箱" \
249249

250250
**执行流程:**
251251

252-
1. 用户在 OpenClaw 聊天中输入自然语言指令
252+
1. 用户在 OpenClaw 聊天中输入自然语言指令,需要携带 `openclaw-github-trending` 工具名称
253253
2. OpenClaw 解析指令并识别工具(`openclaw-github-trending`
254254
3. 自动提取时间、周期、推送渠道等参数
255255
4. 生成对应的 `cron add` 命令并创建任务

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openclaw-github-trending",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "OpenClaw plugin for fetching GitHub trending repositories and pushing to Feishu or Email with AI summaries",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,21 @@ Cron 表达式格式:
351351
};
352352

353353
// Parse channels (use params.channels, not context)
354-
const targetChannels = channels || [];
354+
// Handle both array format (from zod validation) and string format (from CLI cron job)
355+
let targetChannels: ('feishu' | 'email')[] = [];
356+
357+
// Support both array format from zod validation and string format from CLI cron jobs
358+
if (channels) {
359+
if (Array.isArray(channels)) {
360+
// Array format from zod validation
361+
targetChannels = channels;
362+
} else {
363+
// String format - this shouldn't happen with zod validation, but handle it just in case
364+
const stringChannels = String(channels).split(',').map(c => c.trim());
365+
targetChannels = stringChannels.filter(c => c === 'feishu' || c === 'email') as ('feishu' | 'email')[];
366+
}
367+
}
368+
355369
if (targetChannels.length === 0) {
356370
// Fallback to configured channels if not specified in params
357371
if (pluginConfig?.channels?.feishu?.webhook_url) targetChannels.push('feishu');

0 commit comments

Comments
 (0)