Skip to content

Commit

Permalink
Release v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoii committed Mar 22, 2020
1 parent b33ce2d commit 18c6e36
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 2 deletions.
104 changes: 104 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ cacheSize: 4096

# 可选,是否开启websocket,默认关闭,建议通过Session范围的配置设置
enableWebsocket: false

# 可选,配置CORS跨域,默认为*,即允许所有域名
cors:
- '*'
```
Expand Down Expand Up @@ -1076,3 +1080,103 @@ Content-Type:multipart/form-data
| cacheSize | true | Int | 123456789 | 缓存大小 |
| enableWebsocket | true | Boolean | false | 是否开启Websocket |

## 插件相关、Console相关

### 简介

`Mirai-console`通过指令执行任务,如`/# qq password`进行登录,`Mirai-api-http`支持通过`POST`请求发送指令和注册指令,
帮助第三方开发语言进行符合`Mirai-console`规范的插件开发

`Mirai-console`通过`manager`列表进行对`bot`任务的鉴权。尽量避免各插件使用自己的鉴权方式而产生重复配置的混乱情况出现。

### 注册指令

```
[POST] /command/register
```

#### 请求:

```json5
{
"authKey": "U9HSaDXl39ksd918273hU",
"name": "login",
"alias": ["lg", "SignIn"],
"description": "用于登录",
"usage": "/# qq password",
}
```

| 名字 | 可选 | 类型 | 举例 | 说明 |
| ----------------- | ----- | ------- | ---------------- | -------------------- |
| authKey | false | String | "YourSessionKey" | 你的session key |
| name | false | Long | 123456789 | 指定群的群号 |
| alias | false | Long | 987654321 | 群员QQ号 |
| description | false | Object | {} | 群员资料 |
| usage | true | String | "Name" | 群名片,即群昵称 |

#### 响应

按普通文本处理



### 发送指令

```
[POST] /command/send
```

#### 请求:

```json5
{
"authKey": "U9HSaDXl39ksd918273hU",
"name": "login",
"args": ["123", "pwd"]
}
```

| 名字 | 可选 | 类型 | 举例 | 说明 |
| ----------------- | ----- | ------- | ---------------- | -------------------- |
| authKey | false | String | "YourSessionKey" | 你的session key |
| name | false | Long | 123456789 | 指定群的群号 |
| args | false | Long | 987654321 | 群员QQ号 |


#### 响应

按普通文本处理



### 监听指令

```
[ws] /command?authKey=U9HSaDXl39ksd918273hU
```

#### 响应

```json5
{
"name": "commandName",
"args": ["arg1", "arg2"]
}
```



### 获取Mangers

```
[GET] /managers?qq=123456
```

#### 响应

```json5
[123456789, 987654321]
```

> 响应Manager的qq号数组,当QQ号不存在时返回状态码(StateCode 2)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build
httpVersion=v1.2.3
httpVersion=v1.3.0

# style guide
kotlin.code.style=official
Expand Down
2 changes: 1 addition & 1 deletion mirai-api-http/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: MiraiAPIHTTP
path: net.mamoe.mirai.api.http.HttpApiPluginBase
version: v1.2.3
version: v1.3.0
info: Mirai HTTP API Server Plugin
author: "ryoii"

0 comments on commit 18c6e36

Please # to comment.