Table of Contents

模块

KOOK 开发者文档 - 卡片消息 - 模块

标题 header

元素 数量 说明
plain 1 标题文本
<header>
  <plain>这是标题</plain>
</header>

内容 section

属性 类型 默认值 必需 说明
mode string right 其它元素的放置位置
元素 数量 说明
text 1 内容模块的文本元素
text/plain 1,与 text/markdown 互斥 内容模块的文本元素(纯文本)
text/kmarkdown 1,与 text/plain 互斥 内容模块的文本元素(KMarkdown)
accessory 0-1 内容模块的其它元素
accessory/image 1,与 accessory/button 互斥 内容模块的其它元素(图片)
accessory/button 1,与 accessory/image 互斥 内容模块的其它元素(按钮)
<section mode="right">
  <text>
    <kmarkdown>内容模块,**使用 KMarkdown**</kmarkdown>
  </text>
  <accessory>
    <button theme="danger" click="return-val" value="TEST_VALUE">
      <kmarkdown>**测试按钮**</kmarkdown>
    </button>
  </accessory>
</section>

图片组 images

元素 数量 说明
image 1-9 图片
<images>
  <image src="https://img.kaiheila.cn/assets/2021-01/V3zmettTwN0j608y.png" />
  <image src="https://img.kaiheila.cn/assets/2021-01/V3zmettTwN0j608y.png" />
  <image src="https://img.kaiheila.cn/assets/2021-01/V3zmettTwN0j608y.png" />
</images>

容器 container

元素 数量 说明
image 1-9 图片
<container>
  <image src="https://img.kaiheila.cn/assets/2021-01/V3zmettTwN0j608y.png" />
  <image src="https://img.kaiheila.cn/assets/2021-01/V3zmettTwN0j608y.png" />
</container>

交互 actions

元素 数量 说明
button 1-4 按钮
<actions>
  <button theme="success">
    <plain>测试按钮</plain>
  </button>
</actions>

备注 context

元素 数量 说明
plain kmarkdown image 合计至多 10,至少 1 纯文本
kmarkdown plain image 合计至多 10,至少 1 KMarkdown
image plain kmarkdown 合计至多 10,至少 1 图片
<context>
  <image src="https://img.kaiheila.cn/assets/2021-01/bUZJOyqnMG0d30d3.png/ld" size="small" />
  <plain>测试 Context</plain>
  <kmarkdown>~~KMarkdown~~ 测试(spl)内容(spl)</kmarkdown>
</context>

分割线 divider

<divider />

文件 (文件/视频) file video

属性 类型 默认值 必需 说明
src anyURI null 文件 URL,必须以 https:// 开头
title string null 文件标题
<file src="https://img.kaiheila.cn/attachments/2021-01/21/600972b5d0d31.txt"
      title="KOOK 介绍" />
<video src="https://img.kaiheila.cn/attachments/2021-01/20/6008127e8c8de.mp4"
       title="测试视频" />

文件 (音频) audio

属性 类型 默认值 必需 说明
src anyURI null 文件 URL,必须以 https:// 开头
title string null 文件标题
cover anyURI null 封面 URL,必须以 https:// 开头
<audio src="https://img.kaiheila.cn/attachments/2021-01/21/600975671b9ab.mp3"
       cover="https://img.kaiheila.cn/assets/2021-01/rcdqa8fAOO0hs0mc.jpg"
       title="命运" />

倒计时 countdown

属性 类型 默认值 必需 说明
start ulong null ⚠️ 起始的毫秒时间戳,仅 mode="second" 时需要
end ulong null 到期的毫秒时间戳
mode string null 显示模式,可选值为 day hour second
<countdown end="4080251224000" start="4077572824000" mode="second" />

邀请 invite

属性 类型 默认值 必需 说明
code string null 邀请链接或者邀请码
<invite code="EvxnOb"/>