onebots 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +63 -63
- package/lib/bin.d.ts +2 -2
- package/lib/bin.js +5 -5
- package/lib/db.d.ts +19 -19
- package/lib/db.js +91 -91
- package/lib/index.d.ts +5 -5
- package/lib/index.js +21 -21
- package/lib/onebot.d.ts +44 -44
- package/lib/onebot.js +86 -86
- package/lib/server/app.d.ts +52 -52
- package/lib/server/app.js +232 -232
- package/lib/server/router.d.ts +9 -9
- package/lib/server/router.js +32 -32
- package/lib/service/V11/action/common.d.ts +65 -66
- package/lib/service/V11/action/common.js +142 -142
- package/lib/service/V11/action/friend.d.ts +38 -38
- package/lib/service/V11/action/friend.js +44 -44
- package/lib/service/V11/action/group.d.ts +104 -104
- package/lib/service/V11/action/group.js +138 -138
- package/lib/service/V11/action/index.d.ts +9 -9
- package/lib/service/V11/action/index.js +10 -10
- package/lib/service/V11/config.d.ts +10 -10
- package/lib/service/V11/config.js +2 -2
- package/lib/service/V11/index.d.ts +95 -95
- package/lib/service/V11/index.js +499 -488
- package/lib/service/V12/action/common.d.ts +33 -33
- package/lib/service/V12/action/common.js +108 -108
- package/lib/service/V12/action/friend.d.ts +13 -13
- package/lib/service/V12/action/friend.js +15 -15
- package/lib/service/V12/action/group.d.ts +104 -104
- package/lib/service/V12/action/group.js +138 -138
- package/lib/service/V12/action/guild.d.ts +2 -2
- package/lib/service/V12/action/guild.js +6 -6
- package/lib/service/V12/action/index.d.ts +10 -10
- package/lib/service/V12/action/index.js +11 -11
- package/lib/service/V12/config.d.ts +17 -17
- package/lib/service/V12/config.js +2 -2
- package/lib/service/V12/index.d.ts +102 -102
- package/lib/service/V12/index.js +538 -537
- package/lib/types.d.ts +3 -3
- package/lib/types.js +2 -2
- package/lib/utils.d.ts +14 -14
- package/lib/utils.js +150 -150
- package/package.json +58 -58
- package/lib/config.sample.yaml +0 -31
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 凉菜
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 凉菜
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<h1>基于oicq的oneBot实现</h1>
|
|
3
|
-
<p>
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/onebots)
|
|
6
|
-
[](https://onebot.dev/)
|
|
7
|
-
[](https://12.onebot.dev/)
|
|
8
|
-
[](https://nodejs.org)
|
|
9
|
-
[](https://jq.qq.com/?_wv=1027&k=B22VGXov)
|
|
10
|
-
|
|
11
|
-
[](https://star-history.com/#lc-cn/onebots&Date)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[Type Docs](https://lc-cn.github.io/onebots)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</p>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
# 使用示例
|
|
21
|
-
1. 新建一个node项目
|
|
22
|
-
```shell
|
|
23
|
-
npm init -y
|
|
24
|
-
```
|
|
25
|
-
2. 安装onebots
|
|
26
|
-
```shell
|
|
27
|
-
npm install onebots
|
|
28
|
-
```
|
|
29
|
-
3. 在项目跟目录添加配置文件config.yaml
|
|
30
|
-
```yaml
|
|
31
|
-
port: 6727 # 项目onebots监听的端口(默认:6727)
|
|
32
|
-
1472258369: # 你的机器人账户
|
|
33
|
-
version: V11 # oneBot版本(V11 或 V12)
|
|
34
|
-
```
|
|
35
|
-
4. 新建入口文件`index.js`并输入一下内容
|
|
36
|
-
```javascript
|
|
37
|
-
const {createApp}=require('onebots')
|
|
38
|
-
createApp()
|
|
39
|
-
.start()
|
|
40
|
-
```
|
|
41
|
-
5. 启动项目
|
|
42
|
-
```shell
|
|
43
|
-
node ./index.js
|
|
44
|
-
```
|
|
45
|
-
# 使用命令行启动
|
|
46
|
-
```shell
|
|
47
|
-
npm install -g onebots
|
|
48
|
-
onebots
|
|
49
|
-
```
|
|
50
|
-
# 使用接口管理oneBot
|
|
51
|
-
|
|
52
|
-
| url | method | params | desc |
|
|
53
|
-
|:--------| :--- |:----------------|:-------------------------------|
|
|
54
|
-
| /list | GET | | 获取当前运行的机器人列表 |
|
|
55
|
-
| /detail | GET | uin | 获取指定机器人配置 |
|
|
56
|
-
| /qrcode | GET | uin | 获取指定机器人登录二维码 |
|
|
57
|
-
| /add | POST | {uin,...config} | 添加机器人 config 为机器人配置 |
|
|
58
|
-
| /edit | POST | {uin,...config} | 修改机器人配置 config 为机器人配置 |
|
|
59
|
-
| /remove | get | uin,force | 移除机器人,force为true时,将删除机器人data目录 |
|
|
60
|
-
|
|
61
|
-
# 鸣谢
|
|
62
|
-
1. [takayama-lily/oicq](https://github.com/takayama-lily/oicq) 底层服务支持
|
|
63
|
-
2. [takayama-lily/onebot](https://github.com/takayama-lily/node-onebot) oneBots原先版本
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>基于oicq的oneBot实现</h1>
|
|
3
|
+
<p>
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/onebots)
|
|
6
|
+
[](https://onebot.dev/)
|
|
7
|
+
[](https://12.onebot.dev/)
|
|
8
|
+
[](https://nodejs.org)
|
|
9
|
+
[](https://jq.qq.com/?_wv=1027&k=B22VGXov)
|
|
10
|
+
|
|
11
|
+
[](https://star-history.com/#lc-cn/onebots&Date)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
[Type Docs](https://lc-cn.github.io/onebots)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
# 使用示例
|
|
21
|
+
1. 新建一个node项目
|
|
22
|
+
```shell
|
|
23
|
+
npm init -y
|
|
24
|
+
```
|
|
25
|
+
2. 安装onebots
|
|
26
|
+
```shell
|
|
27
|
+
npm install onebots
|
|
28
|
+
```
|
|
29
|
+
3. 在项目跟目录添加配置文件config.yaml
|
|
30
|
+
```yaml
|
|
31
|
+
port: 6727 # 项目onebots监听的端口(默认:6727)
|
|
32
|
+
1472258369: # 你的机器人账户
|
|
33
|
+
version: V11 # oneBot版本(V11 或 V12)
|
|
34
|
+
```
|
|
35
|
+
4. 新建入口文件`index.js`并输入一下内容
|
|
36
|
+
```javascript
|
|
37
|
+
const {createApp}=require('onebots')
|
|
38
|
+
createApp()
|
|
39
|
+
.start()
|
|
40
|
+
```
|
|
41
|
+
5. 启动项目
|
|
42
|
+
```shell
|
|
43
|
+
node ./index.js
|
|
44
|
+
```
|
|
45
|
+
# 使用命令行启动
|
|
46
|
+
```shell
|
|
47
|
+
npm install -g onebots
|
|
48
|
+
onebots
|
|
49
|
+
```
|
|
50
|
+
# 使用接口管理oneBot
|
|
51
|
+
|
|
52
|
+
| url | method | params | desc |
|
|
53
|
+
|:--------| :--- |:----------------|:-------------------------------|
|
|
54
|
+
| /list | GET | | 获取当前运行的机器人列表 |
|
|
55
|
+
| /detail | GET | uin | 获取指定机器人配置 |
|
|
56
|
+
| /qrcode | GET | uin | 获取指定机器人登录二维码 |
|
|
57
|
+
| /add | POST | {uin,...config} | 添加机器人 config 为机器人配置 |
|
|
58
|
+
| /edit | POST | {uin,...config} | 修改机器人配置 config 为机器人配置 |
|
|
59
|
+
| /remove | get | uin,force | 移除机器人,force为true时,将删除机器人data目录 |
|
|
60
|
+
|
|
61
|
+
# 鸣谢
|
|
62
|
+
1. [takayama-lily/oicq](https://github.com/takayama-lily/oicq) 底层服务支持
|
|
63
|
+
2. [takayama-lily/onebot](https://github.com/takayama-lily/node-onebot) oneBots原先版本
|
package/lib/bin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
export {};
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export {};
|
package/lib/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const app_1 = require("./server/app");
|
|
5
|
-
(0, app_1.createApp)().start();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const app_1 = require("./server/app");
|
|
5
|
+
(0, app_1.createApp)().start();
|
package/lib/db.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from "events";
|
|
3
|
-
export declare class Db extends EventEmitter {
|
|
4
|
-
private readonly path;
|
|
5
|
-
private data;
|
|
6
|
-
private raw_data;
|
|
7
|
-
constructor(path: string, force_create?: boolean);
|
|
8
|
-
get(key: string, escape?: boolean): any;
|
|
9
|
-
set(key: string, value: any, escape?: boolean): any;
|
|
10
|
-
has(key: string, escape?: boolean): boolean;
|
|
11
|
-
delete(key: string, escape?: boolean): boolean;
|
|
12
|
-
write(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
export declare namespace Db {
|
|
15
|
-
interface Config {
|
|
16
|
-
path: string;
|
|
17
|
-
force?: boolean;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from "events";
|
|
3
|
+
export declare class Db extends EventEmitter {
|
|
4
|
+
private readonly path;
|
|
5
|
+
private data;
|
|
6
|
+
private raw_data;
|
|
7
|
+
constructor(path: string, force_create?: boolean);
|
|
8
|
+
get(key: string, escape?: boolean): any;
|
|
9
|
+
set(key: string, value: any, escape?: boolean): any;
|
|
10
|
+
has(key: string, escape?: boolean): boolean;
|
|
11
|
+
delete(key: string, escape?: boolean): boolean;
|
|
12
|
+
write(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace Db {
|
|
15
|
+
interface Config {
|
|
16
|
+
path: string;
|
|
17
|
+
force?: boolean;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/lib/db.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Db = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const promises_1 = require("fs/promises");
|
|
6
|
-
const events_1 = require("events");
|
|
7
|
-
class Db extends events_1.EventEmitter {
|
|
8
|
-
constructor(path, force_create = true) {
|
|
9
|
-
super();
|
|
10
|
-
this.path = path;
|
|
11
|
-
this.data = {};
|
|
12
|
-
this.raw_data = '{}';
|
|
13
|
-
if (!this.path.toLowerCase().endsWith('.json'))
|
|
14
|
-
this.path = this.path + '.json';
|
|
15
|
-
if (!(0, fs_1.existsSync)(this.path) && force_create) {
|
|
16
|
-
(0, fs_1.writeFileSync)(this.path, this.raw_data);
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const raw_data = (0, fs_1.readFileSync)(this.path, 'utf8');
|
|
20
|
-
this.raw_data = raw_data || this.raw_data;
|
|
21
|
-
this.data = JSON.parse(this.raw_data);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
const { message } = error;
|
|
25
|
-
if (!message.includes('ENOENT: no such file or directory')) {
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
get(key, escape = true) {
|
|
31
|
-
const func = new Function(`return this.data.${key}`);
|
|
32
|
-
const _this = this;
|
|
33
|
-
let result;
|
|
34
|
-
try {
|
|
35
|
-
result = escape ? func.apply(this) : this.data[key];
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
throw new Error('不可达的位置:' + key.toString());
|
|
39
|
-
}
|
|
40
|
-
return result && typeof result === 'object' ? new Proxy(result, {
|
|
41
|
-
get(target, p) {
|
|
42
|
-
return target[p];
|
|
43
|
-
},
|
|
44
|
-
set(target, p, value, receiver) {
|
|
45
|
-
const result = target[p] = value;
|
|
46
|
-
_this.write();
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
}) : result;
|
|
50
|
-
}
|
|
51
|
-
set(key, value, escape = true) {
|
|
52
|
-
const func = new Function('value', `return this.data.${key}=value`);
|
|
53
|
-
const _this = this;
|
|
54
|
-
let result;
|
|
55
|
-
result = escape ? func.apply(this, [value]) : this.data[key] = value;
|
|
56
|
-
this.raw_data = JSON.stringify(this.data, null, 2);
|
|
57
|
-
this.write();
|
|
58
|
-
return result && typeof result === 'object' ? new Proxy(result, {
|
|
59
|
-
get(target, p) {
|
|
60
|
-
return target[p];
|
|
61
|
-
},
|
|
62
|
-
set(target, p, value, receiver) {
|
|
63
|
-
const result = target[p] = value;
|
|
64
|
-
_this.write();
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
}) : result;
|
|
68
|
-
}
|
|
69
|
-
has(key, escape = true) {
|
|
70
|
-
return escape ? new Function(`return !!this.data.${key}`).apply(this) : !!this.data[key];
|
|
71
|
-
}
|
|
72
|
-
delete(key, escape = true) {
|
|
73
|
-
const result = escape ? new Function(`return delete this.data.${key}`).apply(this) : delete this.data[key];
|
|
74
|
-
this.write();
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
77
|
-
async write() {
|
|
78
|
-
try {
|
|
79
|
-
const raw_data = JSON.stringify(this.data, null, 2);
|
|
80
|
-
if (raw_data !== this.raw_data) {
|
|
81
|
-
await (0, promises_1.writeFile)(this.path, raw_data);
|
|
82
|
-
this.raw_data = raw_data;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
this.data = JSON.parse(this.raw_data);
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.Db = Db;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Db = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const promises_1 = require("fs/promises");
|
|
6
|
+
const events_1 = require("events");
|
|
7
|
+
class Db extends events_1.EventEmitter {
|
|
8
|
+
constructor(path, force_create = true) {
|
|
9
|
+
super();
|
|
10
|
+
this.path = path;
|
|
11
|
+
this.data = {};
|
|
12
|
+
this.raw_data = '{}';
|
|
13
|
+
if (!this.path.toLowerCase().endsWith('.json'))
|
|
14
|
+
this.path = this.path + '.json';
|
|
15
|
+
if (!(0, fs_1.existsSync)(this.path) && force_create) {
|
|
16
|
+
(0, fs_1.writeFileSync)(this.path, this.raw_data);
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const raw_data = (0, fs_1.readFileSync)(this.path, 'utf8');
|
|
20
|
+
this.raw_data = raw_data || this.raw_data;
|
|
21
|
+
this.data = JSON.parse(this.raw_data);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const { message } = error;
|
|
25
|
+
if (!message.includes('ENOENT: no such file or directory')) {
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
get(key, escape = true) {
|
|
31
|
+
const func = new Function(`return this.data.${key}`);
|
|
32
|
+
const _this = this;
|
|
33
|
+
let result;
|
|
34
|
+
try {
|
|
35
|
+
result = escape ? func.apply(this) : this.data[key];
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
throw new Error('不可达的位置:' + key.toString());
|
|
39
|
+
}
|
|
40
|
+
return result && typeof result === 'object' ? new Proxy(result, {
|
|
41
|
+
get(target, p) {
|
|
42
|
+
return target[p];
|
|
43
|
+
},
|
|
44
|
+
set(target, p, value, receiver) {
|
|
45
|
+
const result = target[p] = value;
|
|
46
|
+
_this.write();
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
}) : result;
|
|
50
|
+
}
|
|
51
|
+
set(key, value, escape = true) {
|
|
52
|
+
const func = new Function('value', `return this.data.${key}=value`);
|
|
53
|
+
const _this = this;
|
|
54
|
+
let result;
|
|
55
|
+
result = escape ? func.apply(this, [value]) : this.data[key] = value;
|
|
56
|
+
this.raw_data = JSON.stringify(this.data, null, 2);
|
|
57
|
+
this.write();
|
|
58
|
+
return result && typeof result === 'object' ? new Proxy(result, {
|
|
59
|
+
get(target, p) {
|
|
60
|
+
return target[p];
|
|
61
|
+
},
|
|
62
|
+
set(target, p, value, receiver) {
|
|
63
|
+
const result = target[p] = value;
|
|
64
|
+
_this.write();
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
}) : result;
|
|
68
|
+
}
|
|
69
|
+
has(key, escape = true) {
|
|
70
|
+
return escape ? new Function(`return !!this.data.${key}`).apply(this) : !!this.data[key];
|
|
71
|
+
}
|
|
72
|
+
delete(key, escape = true) {
|
|
73
|
+
const result = escape ? new Function(`return delete this.data.${key}`).apply(this) : delete this.data[key];
|
|
74
|
+
this.write();
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
async write() {
|
|
78
|
+
try {
|
|
79
|
+
const raw_data = JSON.stringify(this.data, null, 2);
|
|
80
|
+
if (raw_data !== this.raw_data) {
|
|
81
|
+
await (0, promises_1.writeFile)(this.path, raw_data);
|
|
82
|
+
this.raw_data = raw_data;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
this.data = JSON.parse(this.raw_data);
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.Db = Db;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './server/app';
|
|
2
|
-
export * from './server/router';
|
|
3
|
-
export * from './onebot';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export * from './utils';
|
|
1
|
+
export * from './server/app';
|
|
2
|
+
export * from './server/router';
|
|
3
|
+
export * from './onebot';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './utils';
|
package/lib/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./server/app"), exports);
|
|
18
|
-
__exportStar(require("./server/router"), exports);
|
|
19
|
-
__exportStar(require("./onebot"), exports);
|
|
20
|
-
__exportStar(require("./types"), exports);
|
|
21
|
-
__exportStar(require("./utils"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./server/app"), exports);
|
|
18
|
+
__exportStar(require("./server/router"), exports);
|
|
19
|
+
__exportStar(require("./onebot"), exports);
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
21
|
+
__exportStar(require("./utils"), exports);
|
package/lib/onebot.d.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import 'oicq2-cq-enable';
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
|
-
import { App } from "./server/app";
|
|
5
|
-
import { Client } from "oicq";
|
|
6
|
-
import { V11 } from "./service/V11";
|
|
7
|
-
import { V12 } from "./service/V12";
|
|
8
|
-
import { MayBeArray } from "./types";
|
|
9
|
-
export declare class NotFoundError extends Error {
|
|
10
|
-
message: string;
|
|
11
|
-
}
|
|
12
|
-
export declare class OneBot<V extends OneBot.Version> extends EventEmitter {
|
|
13
|
-
app: App;
|
|
14
|
-
readonly uin: number;
|
|
15
|
-
config: OneBotConfig[];
|
|
16
|
-
status: OneBotStatus;
|
|
17
|
-
protected password: string;
|
|
18
|
-
client: Client;
|
|
19
|
-
instances: (V11 | V12)[];
|
|
20
|
-
constructor(app: App, uin: number, config: MayBeArray<OneBotConfig>);
|
|
21
|
-
start(): Promise<void>;
|
|
22
|
-
startListen(): void;
|
|
23
|
-
stop(force?: boolean): Promise<void>;
|
|
24
|
-
dispatch(data: any): void;
|
|
25
|
-
}
|
|
26
|
-
export declare enum OneBotStatus {
|
|
27
|
-
Good = 0,
|
|
28
|
-
Bad = 1
|
|
29
|
-
}
|
|
30
|
-
export
|
|
31
|
-
export declare namespace OneBot {
|
|
32
|
-
type Version = 'V11' | 'V12';
|
|
33
|
-
type Config<V extends Version = 'V11'> = ({
|
|
34
|
-
version?: V;
|
|
35
|
-
password?: string;
|
|
36
|
-
} & (V extends 'V11' ? V11.Config : V12.Config));
|
|
37
|
-
interface Base {
|
|
38
|
-
start(path?: string): any;
|
|
39
|
-
stop(): any;
|
|
40
|
-
dispatch(...args: any[]): any;
|
|
41
|
-
apply(...args: any[]): any;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export declare const BOOLS: string[];
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import 'oicq2-cq-enable';
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import { App } from "./server/app";
|
|
5
|
+
import { Client } from "oicq";
|
|
6
|
+
import { V11 } from "./service/V11";
|
|
7
|
+
import { V12 } from "./service/V12";
|
|
8
|
+
import { MayBeArray } from "./types";
|
|
9
|
+
export declare class NotFoundError extends Error {
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class OneBot<V extends OneBot.Version> extends EventEmitter {
|
|
13
|
+
app: App;
|
|
14
|
+
readonly uin: number;
|
|
15
|
+
config: OneBotConfig[];
|
|
16
|
+
status: OneBotStatus;
|
|
17
|
+
protected password: string;
|
|
18
|
+
client: Client;
|
|
19
|
+
instances: (V11 | V12)[];
|
|
20
|
+
constructor(app: App, uin: number, config: MayBeArray<OneBotConfig>);
|
|
21
|
+
start(): Promise<void>;
|
|
22
|
+
startListen(): void;
|
|
23
|
+
stop(force?: boolean): Promise<void>;
|
|
24
|
+
dispatch(data: any): void;
|
|
25
|
+
}
|
|
26
|
+
export declare enum OneBotStatus {
|
|
27
|
+
Good = 0,
|
|
28
|
+
Bad = 1
|
|
29
|
+
}
|
|
30
|
+
export type OneBotConfig = OneBot.Config<OneBot.Version>;
|
|
31
|
+
export declare namespace OneBot {
|
|
32
|
+
type Version = 'V11' | 'V12';
|
|
33
|
+
type Config<V extends Version = 'V11'> = ({
|
|
34
|
+
version?: V;
|
|
35
|
+
password?: string;
|
|
36
|
+
} & (V extends 'V11' ? V11.Config : V12.Config));
|
|
37
|
+
interface Base {
|
|
38
|
+
start(path?: string): any;
|
|
39
|
+
stop(): any;
|
|
40
|
+
dispatch(...args: any[]): any;
|
|
41
|
+
apply(...args: any[]): any;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export declare const BOOLS: string[];
|