Skip to content

Commit

Permalink
fix(docs): 更新机器人文档 (#219)
Browse files Browse the repository at this point in the history
Co-authored-by: kaolinchen <[email protected]>
  • Loading branch information
ORG1997 and kaolinchen authored Jul 22, 2024
1 parent 4d03a03 commit 32bfa60
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ https://api.sgroup.qq.com
| 名称 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| Authorization | string || 格式值:"QQBot ACCESS_TOKEN" |
| X-Union-Appid | string || 格式值:"BOT_APPID", 机器人 AppID |

**示例**
```json
{
"headers": {
"Authorization": "QQBot {ACCESS_TOKEN}",
"X-Union-Appid": "{BOT_APPID}",
"Authorization": "QQBot {ACCESS_TOKEN}"
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"s": 42,
"t": "GATEWAY_EVENT_NAME"
}

op 指的是 opcode,参考连接维护
opcode 列表
s 下行消息都会有一个序列号,标识消息的唯一性,客户端需要再发送心跳的时候,携带客户端收到的最新的s。
t和d 主要是用在op为 0 Dispatch 的时候。
t 代表事件类型。
d 代表事件内容,不同事件类型的事件内容格式都不同,请注意识别。
```
| 字段 | 描述|
| ----- | ----- |
| op |指的是 opcode,参考连接维护 |
| s |下行消息都会有一个序列号,标识消息的唯一性,客户端需要再发送心跳的时候,携带客户端收到的最新的s |
| t |代表事件类型。主要用在op为 0 Dispatch 的时候|
| d |代表事件内容,不同事件类型的事件内容格式都不同,请注意识别。主要用在op为 0 Dispatch 的时候|


### 长连接维护 OpCode

Expand Down
15 changes: 0 additions & 15 deletions docs/develop/api-v2/server-inter/channel/manage/event/channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@

```json
{
"op": 0,
"s": 2,
"t": "CHANNEL_CREATE",
"d": {
"guild_id": "200000000",
"id": "2943679",
"name": "测试",
"op_user_id": "100000000",
"owner_id": "100000000",
"sub_type": 0,
"type": 0
}
}
```

Expand All @@ -39,18 +34,13 @@

```json
{
"op": 0,
"s": 3,
"t": "CHANNEL_UPDATE",
"d": {
"guild_id": "200000000",
"id": "2943679",
"name": "测试2",
"op_user_id": "100000000",
"owner_id": "100000000",
"sub_type": 0,
"type": 0
}
}
```

Expand All @@ -64,17 +54,12 @@

```json
{
"op": 0,
"s": 4,
"t": "CHANNEL_DELETE",
"d": {
"guild_id": "200000000",
"id": "2943679",
"name": "测试2",
"op_user_id": "100000000",
"owner_id": "100000000",
"sub_type": 0,
"type": 0
}
}
```
15 changes: 0 additions & 15 deletions docs/develop/api-v2/server-inter/channel/manage/event/guild.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

```json
{
"op": 0,
"s": 6,
"t": "GUILD_CREATE",
"d": {
"description": "频道介绍",
"icon": "https://pub.idqqimg.com/pc/misc/files/20211208/311cfc87ce394c62b7c9f0508658cf25.png",
"id": "200000000",
Expand All @@ -30,7 +26,6 @@
"name": "频道名称",
"op_user_id": "100000000",
"owner_id": "100000000"
}
}
```

Expand All @@ -45,10 +40,6 @@

```json
{
"op": 0,
"s": 7,
"t": "GUILD_UPDATE",
"d": {
"description": "修改了的频道介绍",
"icon": "https://pub.idqqimg.com/pc/misc/files/20211208/311cfc87ce394c62b7c9f0508658cf25.png",
"id": "200000000",
Expand All @@ -58,7 +49,6 @@
"name": "频道名称",
"op_user_id": "100000000",
"owner_id": "100000000"
}
}
```

Expand All @@ -74,10 +64,6 @@

```json
{
"op": 0,
"s": 5,
"t": "GUILD_DELETE",
"d": {
"description": "频道介绍",
"icon": "https://pub.idqqimg.com/pc/misc/files/20211208/311cfc87ce394c62b7c9f0508658cf25.png",
"id": "200000000",
Expand All @@ -87,6 +73,5 @@
"name": "频道名称",
"op_user_id": "100000000",
"owner_id": "100000000"
}
}
```
15 changes: 0 additions & 15 deletions docs/develop/api-v2/server-inter/channel/role/guild_member.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

```json
{
"op": 0,
"s": 5,
"t": "GUILD_MEMBER_ADD",
"d": {
"guild_id": "200000000",
"joined_at": "2021-10-21T11:20:18+08:00",
"nick": "",
Expand All @@ -33,7 +29,6 @@
"id": "8834102668809967837",
"username": "b站机器人"
}
}
}
```

Expand All @@ -47,10 +42,6 @@

```json
{
"op": 0,
"s": 6,
"t": "GUILD_MEMBER_UPDATE",
"d": {
"guild_id": "200000000",
"joined_at": "2021-10-21T11:20:18+08:00",
"nick": "",
Expand All @@ -62,7 +53,6 @@
"id": "8834102668809967837",
"username": "b站机器人"
}
}
}
```

Expand All @@ -76,10 +66,6 @@

```json
{
"op": 0,
"s": 4,
"t": "GUILD_MEMBER_REMOVE",
"d": {
"guild_id": "200000000",
"joined_at": "2021-10-21T11:20:18+08:00",
"nick": "",
Expand All @@ -93,6 +79,5 @@
"id": "8834102668809967837",
"username": "b站机器人"
}
}
}
```
49 changes: 13 additions & 36 deletions docs/develop/api-v2/server-inter/group/manage/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,9 @@

```json
{
"op": 0,
"s": 2,
"t": "GROUP_ADD_ROBOT",
"id": "GROUP_ADD_ROBOT:39ab91b8-36ee-44d6-80e9-4447a2f2c571",
"d": {
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"op_member_openid": "E4F4AEA33253A2797FB897C50B81D7ED",
"timestamp": 1699240248
}
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"op_member_openid": "E4F4AEA33253A2797FB897C50B81D7ED",
"timestamp": 1699240248
}
```

Expand Down Expand Up @@ -96,15 +90,9 @@

```json
{
"op": 0,
"s": 5,
"t": "GROUP_DEL_ROBOT",
"id": "GROUP_DEL_ROBOT:a94f1712-b316-4731-b1f1-9f39474ef4b6",
"d": {
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"op_member_openid": "E4F4AEA33253A2797FB897C50B81D7ED",
"timestamp": 1699240426
}
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"op_member_openid": "E4F4AEA33253A2797FB897C50B81D7ED",
"timestamp": 1699240426
}
```

Expand Down Expand Up @@ -151,15 +139,9 @@

```json
{
"op": 0,
"s": 7,
"t": "GROUP_MSG_REJECT",
"id": "GROUP_MSG_REJECT:68f2b039-ae03-44f2-a4d1-b88e5de881cb",
"d": {
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"op_member_openid": "E4F4AEA33253A2797FB897C50B81D7ED",
"timestamp": 1699240458
}
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"op_member_openid": "E4F4AEA33253A2797FB897C50B81D7ED",
"timestamp": 1699240458
}
```

Expand Down Expand Up @@ -205,15 +187,10 @@

```json
{
"op": 0,
"s": 8,
"t": "GROUP_MSG_RECEIVE",
"id": "GROUP_MSG_RECEIVE:db4a10f1-0599-4345-bbbb-a2ed194b9c9c",
"d": {
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"op_member_openid": "E4F4AEA33253A2797FB897C50B81D7ED",
"timestamp": 1699240477
}

"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"op_member_openid": "E4F4AEA33253A2797FB897C50B81D7ED",
"timestamp": 1699240477
}
```

64 changes: 35 additions & 29 deletions docs/develop/api-v2/server-inter/message/send-receive/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,35 @@
| **属性** | **类型** | **说明** |
| --- | --- | --- |
| id | string | 平台方消息ID,可以用于被动消息发送 |
| author | object | 发送者 {"user_openid": "xxx"} // 用户 openid |
| author | object | 发送者 |
| content | string | 文本消息内容 |
| timestamp | string | 消息生产时间(RFC3339) |
| attachments | object[] | 富媒体文件附件,文件类型:"图片,语音,视频,文件"<br/>{"content_type": "", "filename": "", "height": "", "width": "", "size": "", "url": ""} |
| attachments | object[] | 富媒体文件附件,文件类型:"图片,语音,视频,文件" |
author对象
| **属性** | **类型** | **说明** |
| --- | --- | --- |
| user_openid | string | 用户 openid |
attachment对象
| **属性** | **类型** | **说明** |
| --- | --- | --- |
| content_type | string | 文件类型,"image/jpeg","image/png","image/gif","file","video/mp4","voice" |
| filename | string | 文件名称 |
| height | int | 图片高度 |
| width | int | 图片宽度 |
| size | int | 文件大小 |
| url | string | 文件链接 |


- **事件示例**

```json
{
"op": 0,
"s": 2,
"t": "C2C_MESSAGE_CREATE",
"id": "C2C_MESSAGE_CREATE:051c863a-05d1-483d-8fd5-15b4e1d7ea1a",
"d": {
"author": {
"user_openid": "E4F4AEA33253A2797FB897C50B81D7ED"
},
"content": "123",
"id": "ROBOT1.0_.b6nx.CVryAO0nR58RXuU6SC.m92gc19j02qKqdm8ek!",
"timestamp": "2023-11-06T13:37:18+08:00"
}
"author": {
"user_openid": "E4F4AEA33253A2797FB897C50B81D7ED"
},
"content": "123",
"id": "ROBOT1.0_.b6nx.CVryAO0nR58RXuU6SC.m92gc19j02qKqdm8ek!",
"timestamp": "2023-11-06T13:37:18+08:00"
}
```

Expand Down Expand Up @@ -111,30 +118,29 @@
| **属性** | **类型** | **说明** |
| --- | --- | --- |
| id | string | 平台方消息 ID,可以用于被动消息发送 |
| author | object | 发送者 {"member_openid": "xxx"} // 用户在本群的 member_openid |
| author | object | 发送者 |
| content | string | 消息内容 |
| timestamp | string | 消息生产时间(RFC3339) |
| group_openid | string | 群聊的 openid |
| attachments | object[] | 富媒体文件附件,文件类型:"图片,语音,视频,文件"<br/>{"content_type": "", "filename": "", "height": "", "width": "", "size": "", "url": ""} |
| attachments | object[] | 富媒体文件附件,文件类型:"图片,语音,视频,文件"|

author对象
| **属性** | **类型** | **说明** |
| --- | --- | --- |
| member_openid | string | 用户在本群的 member_openid |

- **事件示例**

```json
// Websocket
{
"op": 0,
"s": 3,
"t": "GROUP_AT_MESSAGE_CREATE",
"id": "GROUP_AT_MESSAGE_CREATE:87612938-5b4b-441f-b4aa-2c0266092fe0",
"d": {
"author": {
"member_openid": "E4F4AEA33253A2797FB897C50B81D7ED"
},
"content": " 123",
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"id": "ROBOT1.0_eBIyWnxpmSu6uLQ7u7fU0eGloKGYg4eEa737vRyKnMCgyZjKi7JLYkQ9B0VapbiY",
"timestamp": "2023-11-06T13:37:18+08:00"
}
"author": {
"member_openid": "E4F4AEA33253A2797FB897C50B81D7ED"
},
"content": " 123",
"group_openid": "C9F778FE6ADF9D1D1DBE395BF744A33A",
"id": "ROBOT1.0_eBIyWnxpmSu6uLQ7u7fU0eGloKGYg4eEa737vRyKnMCgyZjKi7JLYkQ9B0VapbiY",
"timestamp": "2023-11-06T13:37:18+08:00"
}
```

Expand Down
Loading

0 comments on commit 32bfa60

Please sign in to comment.