autogame-17-feishu-card

TotalClaw 作者 totalclaw

向飞书用户或群组发送富交互卡片,支持 Markdown 与按钮。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~autogame-17-feishu-card
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~autogame-17-feishu-card/file -o autogame-17-feishu-card.md
## 概述(中文)

向飞书用户或群组发送富交互卡片,支持 Markdown 与按钮。

## 技能正文

# 飞书卡片技能

向飞书(Lark)用户或群组发送富交互卡片。支持 Markdown(代码块、表格)、标题、彩色页眉与按钮。

## 前置条件

- 请先安装 `feishu-common`。
- 本技能依赖 `../feishu-common/index.js` 进行 token 与 API 认证。

## 用法

### 1. 简单文本(无特殊字符)
```bash
node skills/feishu-card/send.js --target "ou_..." --text "Hello World"
```

### 2. 复杂/Markdown 文本(推荐)
**⚠️ 关键:** 为防止 shell 转义问题(如反引号被吞),请始终先将内容写入文件。

1. 将内容写入临时文件:
```bash
# (Use 'write' tool)
write temp/msg.md "Here is some code:\n\`\`\`js\nconsole.log('hi');\n\`\`\`"
```

2. 使用 `--text-file` 发送:
```bash
node skills/feishu-card/send.js --target "ou_..." --text-file "temp/msg.md"
```

### 3. 安全发送(自动临时文件)
使用此包装器安全发送原始文本,无需手动创建文件。自动处理文件创建与清理。

```bash
node skills/feishu-card/send_safe.js --target "ou_..." --text "Raw content with \`backticks\` and *markdown*" --title "Safe Message"
```

### 选项
- `-t, --target <id>`:用户 Open ID(`ou_...`)或群聊 ID(`oc_...`)。
- `-x, --text <string>`:简单文本内容。
- `-f, --text-file <path>`:文本文件路径(支持 Markdown)。**代码/日志请用此项。**
- `--title <string>`:卡片页眉标题。
- `--color <string>`:页眉颜色(blue/red/orange/green/purple/grey)。默认:blue。
- `--button-text <string>`:底部操作按钮文字。
- `--button-url <url>`:按钮 URL。
- `--image-path <path>`:要上传并嵌入的本地图片路径。

## 故障排除
- **文本缺失**:是否在 `--text` 中使用了反引号?shell 可能吞掉了它们。请改用 `--text-file`。

## 4. 人格化消息
从不同 AI 人格发送风格化消息。自动添加主题页眉、颜色与格式。

```bash
node skills/feishu-card/send_persona.js --target "ou_..." --persona "d-guide" --text "Critical error detected."
```

### 支持的人格
- **d-guide**:红色警告页眉,粗体/代码前缀。讽刺后缀。
- **green-tea**:胭脂红页眉,柔和/可爱风格。
- **mad-dog**:灰色页眉,原始运行时错误风格。
- **default**:标准蓝色页眉。

### 用法
- `-p, --persona <type>`:选择人格(d-guide、green-tea、mad-dog)。
- `-x, --text <string>`:消息内容。
- `-f, --text-file <path>`:从文件读取消息内容(支持 markdown)。