1.0.0 • Published 6 months ago

@aplus-frontend/notification-cli v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Aplus Notification Cli

NPM Version NPM Downloads NPM License

aplus飞书消息通知工具,用于向飞书群组发送多种类型的消息,支持文本、卡片和富文本格式。

提示: 该工具可在开发流程中用于自动化通知,如部署完成、更新提醒等。

建议使用方式

npx @aplus-frontend/notification-cli [命令] [选项]

全局安装

npm install @aplus-frontend/notification-cli -g

使用

# 显示帮助信息
notification-cli --help

# 发送简单文本消息
notification-cli send -r "oc_123456" -c "Hello World"

# 发送到多个群组
notification-cli send -r "oc_123456,oc_789012" -c "发送到多个群组"

# 发送交互式卡片消息
notification-cli send -m interactive -r "oc_123456" -c "发送交互式卡片消息"

# 发送富文本消息
notification-cli send -m post -r "oc_123456" -c "{\"zh_cn\":{\"title\":\"aplus-ui 6.0.0发版,更新内容如下:\",\"content\":[[{\"emoji_type\":\"APPLAUSE\",\"tag\":\"emotion\"}],[{\"tag\":\"at\",\"user_id\":\"all\"}],[{\"tag\":\"text\",\"text\":\"1. ApProductInfo 样式调整\",\"style\":[\"\"]}],[{\"tag\":\"text\",\"text\":\"2. ApGrid 修复虚拟滚动问题\",\"style\":[\"\"]}]]}}"

# 从文件读取复杂消息内容
notification-cli send -r "oc_123456" -f message.json

# 使用命令简写
nti send -r "oc_123456" -c "使用简写命令"

可用命令

命令描述
send发送消息到飞书群组

send 命令选项

选项描述
-m, --msg-type <type>消息类型,默认为text,可选值: text, interactive, post
-r, --receive-ids <ids>接收群组ID,多个ID用逗号分隔
-c, --content <message>消息内容
-f, --file <path>从JSON文件读取消息内容(适用于复杂交互式消息)

消息类型说明

text (文本消息)

最简单的消息类型,直接发送纯文本内容。

notification-cli send -r "oc_123456" -c "这是一条文本消息"

interactive (卡片消息)

支持Markdown格式的消息,可以包含标题、文本格式、链接、图片等富文本内容。

notification-cli send -m interactive -r "oc_123456" -c "卡片消息"

post (富文本消息)

最复杂的消息类型,支持完全自定义的富文本结构,可以包含多种元素如文本、超链接、图片、分割线、代码块等。

notification-cli send -m post -r "oc_123456" -f message.json

复杂消息示例

创建一个message.json文件,包含以下内容:

{
  "zh_cn": {
    "title": "aplus-ui 6.0.0发版,更新内容如下:",
    "content": [
      [
        {
          "emoji_type": "APPLAUSE",
          "tag": "emotion"
        }
      ],
      [
        {
          "tag": "at",
          "user_id": "all"
        }
      ],
      [
        {
          "tag": "text",
          "text": "1. ApProductInfo 样式调整",
          "style": [""]
        }
      ],
      [
        {
          "tag": "text",
          "text": "2. ApGrid 修复虚拟滚动问题",
          "style": [""]
        }
      ]
    ]
  }
}

许可证

MIT

1.0.0

6 months ago

0.0.1

6 months ago