向飞书(Lark)用户或群组发送丰富的交互式卡片。支持 Markdown(代码块、表格)、标题、彩色标题栏和按钮。
feishu-common。../feishu-common/index.js 来处理令牌和 API 认证。node skills/feishu-card/send.js --target "ou_..." --text "Hello World"
⚠️ 重要提示: 为避免 Shell 转义问题(例如反引号被吞掉),请始终先将内容写入文件。
将内容写入临时文件:
```bash
write temp/msg.md "Here is some code:\n```js\nconsole.log('hi');\n```"
```
使用 --text-file 发送:
bash
node skills/feishu-card/send.js --target "ou_..." --text-file "temp/msg.md"
使用此包装脚本,无需手动创建文件即可安全发送原始文本。它会自动处理文件的创建和清理。
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。以不同 AI 角色的风格发送消息。自动添加主题化标题栏、颜色和格式。
node skills/feishu-card/send_persona.js --target "ou_..." --persona "d-guide" --text "Critical error detected."
-p, --persona <type>: 选择角色(d-guide, green-tea, mad-dog)。-x, --text <string>: 消息内容。-f, --text-file <path>: 从文件读取消息内容(支持 markdown)。