Members
(constant) WebSocket
Methods
getBotList() → {Array.<number>}
Returns:
- Type
- Array.<number>
auth() → {Promise.<httpApiResponse>}
Bot 认证, 获取 sessionKey
Returns:
- Type
- Promise.<httpApiResponse>
verify() → {Promise.<httpApiResponse>}
校验 sessionKey, 必须在 authed 事件后进行
Returns:
- Type
- Promise.<httpApiResponse>
release() → {Promise.<httpApiResponse>}
释放 sessionKey
Returns:
- Type
- Promise.<httpApiResponse>
fetchMessage(count) → {Promise.<Array.<message>>}
Parameters:
| Name | Type | Description |
|---|---|---|
count |
number |
Returns:
- Type
- Promise.<Array.<message>>
getRoamingMessages(timeStart, timeEnd, target) → {Array.<message>}
获取漫游消息
Parameters:
| Name | Type | Description |
|---|---|---|
timeStart |
number | 起始时间, UTC+8 时间戳, 单位为秒. 可以为 0, 即表示从可以获取的最早的消息起. 负数将会被看是 0 |
timeEnd |
number | 结束时间, 低于 `timeStart` 的值将会被看作是 `timeStart` 的值. 最大支持 `Number.MAX_SAFE_INTEGER` |
target |
number | 好友 qq, 目前仅支持好友消息漫游 |
Returns:
- Type
- Array.<message>
Type Definitions
RecallableMessage
Properties:
| Name | Type | Description |
|---|---|---|
code |
number | |
msg |
string | |
messageId |
number | |
|
Type:
- Promise.<MessageResponse>
BotConfig
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
host |
string | http-api 服务的地址 | |
verifyKey |
string | http-api 服务的verifyKey | |
qq |
number | bot 的 qq 号 | |
enableWebsocket |
boolean |
<optional> |
使用 ws 来获取消息和事件推送 |
wsOnly |
boolean |
<optional> |
完全使用 ws 来收发消息,为 true 时覆盖 enableWebsocket 且无需调用 verify |
syncId |
number |
<optional> |
wsOnly 模式下用于标记 server 主动推送的消息 |
interval |
number |
<optional> |
拉取消息的周期(ms), 默认为200 |
authKey |
string |
<optional> |
(Deprecated) http-api 1.x 版本的authKey |
Type:
- Object