Skip to content

Commit 18c6e36

Browse files
committed
Release v1.3.0
1 parent b33ce2d commit 18c6e36

File tree

3 files changed

+106
-2
lines changed

3 files changed

+106
-2
lines changed

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ cacheSize: 4096
4444

4545
# 可选,是否开启websocket,默认关闭,建议通过Session范围的配置设置
4646
enableWebsocket: false
47+
48+
# 可选,配置CORS跨域,默认为*,即允许所有域名
49+
cors:
50+
- '*'
4751
```
4852
4953
@@ -1076,3 +1080,103 @@ Content-Type:multipart/form-data
10761080
| cacheSize | true | Int | 123456789 | 缓存大小 |
10771081
| enableWebsocket | true | Boolean | false | 是否开启Websocket |
10781082

1083+
## 插件相关、Console相关
1084+
1085+
### 简介
1086+
1087+
`Mirai-console`通过指令执行任务,如`/login qq password`进行登录,`Mirai-api-http`支持通过`POST`请求发送指令和注册指令,
1088+
帮助第三方开发语言进行符合`Mirai-console`规范的插件开发
1089+
1090+
`Mirai-console`通过`manager`列表进行对`bot`任务的鉴权。尽量避免各插件使用自己的鉴权方式而产生重复配置的混乱情况出现。
1091+
1092+
### 注册指令
1093+
1094+
```
1095+
[POST] /command/register
1096+
```
1097+
1098+
#### 请求:
1099+
1100+
```json5
1101+
{
1102+
"authKey": "U9HSaDXl39ksd918273hU",
1103+
"name": "login",
1104+
"alias": ["lg", "SignIn"],
1105+
"description": "用于登录",
1106+
"usage": "/login qq password",
1107+
}
1108+
```
1109+
1110+
| 名字 | 可选 | 类型 | 举例 | 说明 |
1111+
| ----------------- | ----- | ------- | ---------------- | -------------------- |
1112+
| authKey | false | String | "YourSessionKey" | 你的session key |
1113+
| name | false | Long | 123456789 | 指定群的群号 |
1114+
| alias | false | Long | 987654321 | 群员QQ号 |
1115+
| description | false | Object | {} | 群员资料 |
1116+
| usage | true | String | "Name" | 群名片,即群昵称 |
1117+
1118+
#### 响应
1119+
1120+
按普通文本处理
1121+
1122+
1123+
1124+
### 发送指令
1125+
1126+
```
1127+
[POST] /command/send
1128+
```
1129+
1130+
#### 请求:
1131+
1132+
```json5
1133+
{
1134+
"authKey": "U9HSaDXl39ksd918273hU",
1135+
"name": "login",
1136+
"args": ["123", "pwd"]
1137+
}
1138+
```
1139+
1140+
| 名字 | 可选 | 类型 | 举例 | 说明 |
1141+
| ----------------- | ----- | ------- | ---------------- | -------------------- |
1142+
| authKey | false | String | "YourSessionKey" | 你的session key |
1143+
| name | false | Long | 123456789 | 指定群的群号 |
1144+
| args | false | Long | 987654321 | 群员QQ号 |
1145+
1146+
1147+
#### 响应
1148+
1149+
按普通文本处理
1150+
1151+
1152+
1153+
### 监听指令
1154+
1155+
```
1156+
[ws] /command?authKey=U9HSaDXl39ksd918273hU
1157+
```
1158+
1159+
#### 响应
1160+
1161+
```json5
1162+
{
1163+
"name": "commandName",
1164+
"args": ["arg1", "arg2"]
1165+
}
1166+
```
1167+
1168+
1169+
1170+
### 获取Mangers
1171+
1172+
```
1173+
[GET] /managers?qq=123456
1174+
```
1175+
1176+
#### 响应
1177+
1178+
```json5
1179+
[123456789, 987654321]
1180+
```
1181+
1182+
> 响应Manager的qq号数组,当QQ号不存在时返回状态码(StateCode 2)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build
2-
httpVersion=v1.2.3
2+
httpVersion=v1.3.0
33

44
# style guide
55
kotlin.code.style=official
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: MiraiAPIHTTP
22
path: net.mamoe.mirai.api.http.HttpApiPluginBase
3-
version: v1.2.3
3+
version: v1.3.0
44
info: Mirai HTTP API Server Plugin
55
author: "ryoii"

0 commit comments

Comments
 (0)