OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  feishu-card:向飞书用户或群组发送丰富的交互式卡片

feishu-card:向飞书用户或群组发送丰富的交互式卡片

 
  kernel ·  2026-02-06 23:33:45 · 3 次点击  · 0 条评论  

飞书卡片技能

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

前置条件

  • 请先安装 feishu-common
  • 本技能依赖 ../feishu-common/index.js 来处理令牌和 API 认证。

使用方法

1. 简单文本(无特殊字符)

node skills/feishu-card/send.js --target "ou_..." --text "Hello World"

2. 复杂/Markdown 文本(推荐)

⚠️ 重要提示: 为避免 Shell 转义问题(例如反引号被吞掉),请始终先将内容写入文件。

  1. 将内容写入临时文件:

    ```bash

    (使用 'write' 工具)

    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. 安全发送(自动处理临时文件)

使用此包装脚本,无需手动创建文件即可安全发送原始文本。它会自动处理文件的创建和清理。

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 角色的风格发送消息。自动添加主题化标题栏、颜色和格式。

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)。
3 次点击  ∙  0 人收藏  
登录后收藏  
目前尚无回复
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor