Skip to content

Commit

Permalink
fix: 文档修缮
Browse files Browse the repository at this point in the history
  • Loading branch information
zoswing committed Dec 25, 2021
1 parent c923591 commit a97b59b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
24 changes: 11 additions & 13 deletions docs/develop/nodesdk/README.md
Expand Up @@ -2,13 +2,12 @@

## 介绍

`NodeSDK`主要基于基础 API 上进行封装,提供给用户一种简单、高效的使用方式。
`NodeSDK`主要基于[基础 API ](../api/README.md)封装,提供给用户一种简单、高效的使用方式。

整体而言 SDK 包含了以下功能:

- 具有完备的消息通信模块,与服务端保持**⻓连接**
- 能发送 **http** 请求,也能作为中转回包给开发者。
- 能调用基础 **API**
- 发送 **http** 请求进行频道操作,包括频道增删改、用户增删改和消息发送等。
- 通过 websocket 与服务端建立 **⻓连接**,监听频道事件。

### SDK 底层架构设计

Expand All @@ -18,12 +17,11 @@

整个 SDK 设计与实现基于**两条主线**

1. NodeSDK 与基础侧的通信模块,属于机器人**被动接受消息**。比如有用户@机器人、新
用户加入频道触发的事件等等。
<img :src="$withBotBase('/images/node-sdk/api-client.png')" alt="SDK 底层架构设计">
2. 机器人通过 NodeSDK 调用基础能力,属于机器人**主动触发消息**。比如欢迎语提醒、
定时打卡任务触发、查询当前频道成员列表等等。
<img :src="$withBotBase('/images/node-sdk/ws-client.png')" alt="SDK 底层架构设计">
- 主动的事件触发
- 频道操作能力:子频道增删改、身份组增删改、成员增删改等。
- 主动消息推送能力。
- 被动的事件监听
- 通过 websocket 监听事件。

## 安装

Expand Down Expand Up @@ -55,10 +53,10 @@ yarn add @tencent-connect/bot-node-sdk

```js
// ESModule | TypeScript
// import { creatOpenAPI, createWebsocket } from '@tencent-connect/bot-node-sdk';
// import { createOpenAPI, createWebsocket } from '@tencent-connect/bot-node-sdk';

// CommonJs
const { creatOpenAPI, createWebsocket } = require('@tencent-connect/bot-node-sdk');
const { createOpenAPI, createWebsocket } = require('@tencent-connect/bot-node-sdk');

const testConfig = {
appID: 'APPID', // 申请机器人时获取到的机器人 BotAppID
Expand All @@ -67,7 +65,7 @@ const testConfig = {
};

// 创建 client
const client = creatOpenAPI(testConfig);
const client = createOpenAPI(testConfig);

// 创建 websocket 连接
const ws = createWebsocket(testConfig);
Expand Down
Expand Up @@ -53,4 +53,12 @@ async function demo() {

## 返回说明

返回结果为空,HTTP 状态码 `204`
返回结果为空。

## 返回示例

`data`

```js
'';
```
6 changes: 3 additions & 3 deletions docs/develop/nodesdk/guild/delete_guild_role.md
Expand Up @@ -28,18 +28,18 @@ async function demo() {
| 4 | 群主/创建者 |
| 5 | 子频道管理员 |

### 参数说明
## 参数说明

| 参数 | 必填 | 类型 | 说明 |
| ------- | ---- | ------ | --------- |
| guildId || string | 频道 ID |
| roleId || string | 身份组 ID |

### 返回说明
## 返回说明

返回结果为空。

### 返回示例
## 返回示例

`data`

Expand Down

0 comments on commit a97b59b

Please sign in to comment.