2019-12-17 11:02:45 +08:00
|
|
|
|
# mirai-api-http
|
|
|
|
|
|
|
|
|
|
<b>
|
2019-12-17 11:45:08 +08:00
|
|
|
|
Mirai-API-http 提供HTTP API供所有语言使用mirai<br>
|
2019-12-17 11:02:45 +08:00
|
|
|
|
</b>
|
2020-02-03 03:12:44 +08:00
|
|
|
|
|
2019-12-17 11:45:08 +08:00
|
|
|
|
### 开始会话-认证(Authorize)
|
|
|
|
|
|
2020-02-03 03:12:44 +08:00
|
|
|
|
```
|
|
|
|
|
[POST] /auth
|
2019-12-17 11:45:08 +08:00
|
|
|
|
```
|
|
|
|
|
使用此方法验证你的会话连接, 并将这个会话绑定一个BOT<br>
|
|
|
|
|
注意: 每个会话只能绑定一个BOT.
|
|
|
|
|
|
|
|
|
|
#### 请求:<br>
|
|
|
|
|
|
|
|
|
|
| 名字 | 类型 | 可选 | 举例 | 说明 |
|
|
|
|
|
| --- | --- | --- | --- | --- |
|
|
|
|
|
| key | String |false|U9HSaDXl39ksd918273hU|MIRAI API HTTP key, HTTP API的核心key|
|
|
|
|
|
| qq | String |false|1040400290|需要绑定的BOT QQ号|
|
|
|
|
|
|
2020-02-03 03:12:44 +08:00
|
|
|
|
|
2019-12-17 11:45:08 +08:00
|
|
|
|
#### 返回(成功):<br>
|
|
|
|
|
|
|
|
|
|
| 名字 | 类型 | 举例 | 说明|
|
|
|
|
|
| --- | --- | --- | --- |
|
2020-02-03 03:12:44 +08:00
|
|
|
|
| code |Int |0|返回状态|
|
2019-12-17 11:45:08 +08:00
|
|
|
|
| session |String |UANSHDKSLAOISN|你的session key|
|
|
|
|
|
|
2020-02-03 03:12:44 +08:00
|
|
|
|
#### 状态码:<br>
|
2019-12-17 11:45:08 +08:00
|
|
|
|
|
|
|
|
|
| 代码 | 原因|
|
|
|
|
|
| --- | --- |
|
2020-02-03 03:12:44 +08:00
|
|
|
|
| 0 | 正常 |
|
|
|
|
|
| 1 | 错误的MIRAI API HTTP key|
|
|
|
|
|
| 2 | 试图绑定不存在的bot|
|
2019-12-17 11:45:08 +08:00
|
|
|
|
|
|
|
|
|
session key 是使用以下方法必须携带的</br>
|
|
|
|
|
session key 需要被以cookie的形式上报 <b>cookies</b> :
|
2020-02-03 03:12:44 +08:00
|
|
|
|
|
|
|
|
|
| 名字 | 值 |
|
|
|
|
|
| --- | --- |
|
|
|
|
|
| session |your session key here |
|
|
|
|
|
|
|
|
|
|
如果出现HTTP 403错误码,代表session key已过期, 需要重新获取
|
|
|
|
|
|
|
|
|
|
### 发送好友消息
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
[POST] /sendFriendMessage
|
|
|
|
|
```
|
|
|
|
|
|