# 消息类型说明
# 消息链类型
# 好友消息
{
"type": "FriendMessage",
"sender": {
"id": 123,
"nickname": "",
"remark": ""
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 群消息
{
"type": "GroupMessage",
"sender": {
"id": 123,
"memberName": "",
"specialTitle": "",
"permission": "OWNER",
"joinTimestamp": 0,
"lastSpeakTimestamp": 0,
"muteTimeRemaining": 0,
"group": {
"id": 321,
"name": "",
"permission": "MEMBER",
},
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 群临时消息
{
"type": "TempMessage",
"sender": {
"id": 123,
"memberName": "",
"specialTitle": "",
"permission": "OWNER",
"joinTimestamp": 0,
"lastSpeakTimestamp": 0,
"muteTimeRemaining": 0,
"group": {
"id": 321,
"name": "",
"permission": "MEMBER",
},
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 陌生人消息
{
"type": "StrangerMessage",
"sender": {
"id": 123,
"nickname": "",
"remark": ""
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# 其他客户端消息
{
"type": "OtherClientMessage",
"sender": {
"id": 123,
"platform": "MOBILE"
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 同步消息链类型
同步消息和普通消息一样, 但是由 Bot 账号的其他客户端发送的消息, 同步到 mirai 时产生的事件. 此类事发送人永远是 Bot 本身, 故省略
# 同步好友消息
{
"type": "FriendSyncMessage",
"subject": {
"id": 123,
"nickname": "",
"remark": ""
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
subject
为发送的目标好友
# 同步群消息
{
"type": "GroupSyncMessage",
"subject": {
"id": 321,
"name": "",
"permission": "MEMBER",
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
subject
为发送的目标群
# 同步群临时消息
{
"type": "TempSyncMessage",
"subject": {
"id": 123,
"memberName": "",
"specialTitle": "",
"permission": "OWNER",
"joinTimestamp": 0,
"lastSpeakTimestamp": 0,
"muteTimeRemaining": 0,
"group": {
"id": 321,
"name": "",
"permission": "MEMBER",
},
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
subject
为发送的目标群成员,对应群信息在群成员的group
字段
# 同步陌生人消息
{
"type": "StrangerSyncMessage",
"subject": {
"id": 123,
"nickname": "",
"remark": ""
},
"messageChain": [] // 数组,内容为下文消息类型
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
subject
为发送的目前陌生人账号
# 消息类型
# Source
{
"type": "Source",
"id": 123456,
"time": 123456
}
1
2
3
4
5
2
3
4
5
名字 | 类型 | 说明 |
---|---|---|
id | Int | 消息的识别号,用于引用回复(Source类型永远为chain的第一个元素) |
time | Int | 时间戳 |
# Quote
{
"type": "Quote",
"id": 123456,
"groupId": 123456789,
"senderId": 987654321,
"targetId": 9876543210,
"origin": [
{ "type": "Plain", text: "text" }
]
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
名字 | 类型 | 说明 |
---|---|---|
id | Int | 被引用回复的原消息的messageId |
groupId | Long | 被引用回复的原消息所接收的群号,当为好友消息时为0 |
senderId | Long | 被引用回复的原消息的发送者的QQ号 |
targetId | Long | 被引用回复的原消息的接收者者的QQ号(或群号) |
origin | Object | 被引用回复的原消息的消息链对象 |
# At
{
"type": "At",
"target": 123456,
"display": "@Mirai"
}
1
2
3
4
5
2
3
4
5
名字 | 类型 | 说明 |
---|---|---|
target | Long | 群员QQ号 |
dispaly | String | At时显示的文字,发送消息时无效,自动使用群名片 |
# AtAll
{
"type": "AtAll"
}
1
2
3
2
3
名字 | 类型 | 说明 |
---|---|---|
- | - | - |
# Face
{
"type": "Face",
"faceId": 123,
"name": "bu"
}
1
2
3
4
5
2
3
4
5
名字 | 类型 | 说明 |
---|---|---|
faceId | Int | QQ表情编号,可选,优先高于name |
name | String | QQ表情拼音,可选 |
# Plain
{
"type": "Plain",
"text": "Mirai牛逼"
}
1
2
3
4
2
3
4
名字 | 类型 | 说明 |
---|---|---|
text | String | 文字消息 |
# Image
{
"type": "Image",
"imageId": "{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai", //群图片格式
//"imageId": "/f8f1ab55-bf8e-4236-b55e-955848d7069f" //好友图片格式
"url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"path": null,
"base64": null
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
名字 | 类型 | 说明 |
---|---|---|
imageId | String | 图片的imageId,群图片与好友图片格式不同。不为空时将忽略url属性 |
url | String | 图片的URL,发送时可作网络图片的链接;接收时为腾讯图片服务器的链接,可用于图片下载 |
path | String | 图片的路径,发送本地图片,路径相对于 JVM 工作路径(默认是当前路径,可通过 -Duser.dir=... 指定),也可传入绝对路径。 |
base64 | String | 图片的 Base64 编码 |
# FlashImage
{
"type": "FlashImage",
"imageId": "{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai", //群图片格式
//"imageId": "/f8f1ab55-bf8e-4236-b55e-955848d7069f" //好友图片格式
"url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"path": null,
"base64": null
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
同 Image
三个参数任选其一,出现多个参数时,按照imageId > url > path > base64的优先级
# Voice
{
"type": "Voice",
"voiceId": "23C477720A37FEB6A9EE4BCCF654014F.amr",
"url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"path": null,
"base64": null,
"length": 1024,
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
名字 | 类型 | 说明 |
---|---|---|
voiceId | String | 语音的voiceId,不为空时将忽略url属性 |
url | String | 语音的URL,发送时可作网络语音的链接;接收时为腾讯语音服务器的链接,可用于语音下载 |
path | String | 语音的路径,发送本地语音,路径相对于 JVM 工作路径(默认是当前路径,可通过 -Duser.dir=... 指定),也可传入绝对路径。 |
base64 | String | 语音的 Base64 编码 |
length | Long | 返回的语音长度, 发送消息时可以不传 |
三个参数任选其一,出现多个参数时,按照voiceId > url > path > base64的优先级
# Xml
{
"type": "Xml",
"xml": "XML"
}
1
2
3
4
2
3
4
名字 | 类型 | 说明 |
---|---|---|
xml | String | XML文本 |
# Json
{
"type": "Json",
"json": "{}"
}
1
2
3
4
2
3
4
名字 | 类型 | 说明 |
---|---|---|
json | String | Json文本 |
# App
{
"type": "App",
"content": "<>"
}
1
2
3
4
2
3
4
名字 | 类型 | 说明 |
---|---|---|
content | String | 内容 |
# Poke
{
"type": "Poke",
"name": "SixSixSix"
}
1
2
3
4
2
3
4
名字 | 类型 | 说明 |
---|---|---|
name | String | 戳一戳的类型 |
- "Poke": 戳一戳
- "ShowLove": 比心
- "Like": 点赞
- "Heartbroken": 心碎
- "SixSixSix": 666
- "FangDaZhao": 放大招
# Dice
{
"type": "Dice",
"value": 1
}
1
2
3
4
2
3
4
名字 | 类型 | 说明 |
---|---|---|
value | Int | 点数 |
# MarketFace
{
"type": "MarketFace",
"id": 123,
"name": "商城表情"
}
1
2
3
4
5
2
3
4
5
名字 | 类型 | 说明 |
---|---|---|
id | Int | 商城表情唯一标识 |
name | String | 表情显示名称 |
目前商城表情仅支持接收和转发,不支持构造发送
# MusicShare
{
"type": "MusicShare",
"kind": "String",
"title": "String",
"summary": "String",
"jumpUrl": "String",
"pictureUrl": "String",
"musicUrl": "String",
"brief": "String"
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
名字 | 类型 | 说明 |
---|---|---|
kind | String | 类型 |
title | String | 标题 |
summary | String | 概括 |
jumpUrl | String | 跳转路径 |
pictureUrl | String | 封面路径 |
musicUrl | String | 音源路径 |
brief | String | 简介 |
# ForwardMessage
{
"type": "Forward",
"nodeList": [
{
"senderId": 123,
"time": 0,
"senderName": "sender name",
"messageChain": [],
"messageId": 123
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
名字 | 类型 | 说明 |
---|---|---|
nodeList | object | 消息节点 |
senderId | Long | 发送人QQ号 |
time | Int | 发送时间 |
senderName | String | 显示名称 |
messageChain | Array | 消息数组 |
messageId | Int | 可以只使用消息messageId,从缓存中读取一条消息作为节点 |
# File
{
"type": "File",
"id": "",
"name": "",
"size": 0
}
1
2
3
4
5
6
2
3
4
5
6
名字 | 类型 | 说明 |
---|---|---|
id | String | 文件识别id |
name | String | 文件名 |
size | Long | 文件大小 |
# MiraiCode
{
"type": "MiraiCode",
"code": "hello[mirai:at:1234567]"
}
1
2
3
4
2
3
4
名字 | 类型 | 说明 |
---|---|---|
code | String | MiraiCode |