node-karin 0.0.3 → 0.1.0
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 +674 -674
- package/README.md +57 -57
- package/config/defSet/App.yaml +37 -37
- package/config/defSet/config.yaml +43 -43
- package/config/defSet/group.yaml +18 -18
- package/config/defSet/pm2.yaml +21 -21
- package/config/defSet/server.yaml +42 -42
- package/config/view/App.yaml +74 -74
- package/config/view/config.yaml +100 -100
- package/config/view/group.yaml +62 -62
- package/config/view/pm2.yaml +41 -41
- package/config/view/redis.yaml +25 -25
- package/config/view/server.yaml +93 -93
- package/lib/adapter/onebot/onebot11.d.ts +430 -430
- package/lib/adapter/onebot/onebot11.js +1265 -1302
- package/lib/core/init.js +4 -4
- package/lib/core/karin.d.ts +72 -72
- package/lib/core/karin.js +51 -51
- package/lib/core/listener.d.ts +121 -121
- package/lib/core/listener.js +178 -178
- package/lib/core/plugin.app.d.ts +15 -15
- package/lib/core/plugin.app.js +18 -18
- package/lib/core/plugin.d.ts +182 -182
- package/lib/core/plugin.js +132 -132
- package/lib/core/plugin.loader.d.ts +149 -149
- package/lib/core/plugin.loader.js +451 -451
- package/lib/core/server.d.ts +26 -26
- package/lib/core/server.js +209 -209
- package/lib/db/level.d.ts +20 -20
- package/lib/db/level.js +36 -36
- package/lib/db/redis.d.ts +41 -41
- package/lib/db/redis.js +131 -131
- package/lib/db/redis_level.d.ts +113 -113
- package/lib/db/redis_level.js +274 -274
- package/lib/event/event.d.ts +138 -138
- package/lib/event/event.handler.d.ts +29 -29
- package/lib/event/event.handler.js +138 -138
- package/lib/event/event.js +120 -120
- package/lib/event/message.d.ts +102 -102
- package/lib/event/message.handler.d.ts +25 -25
- package/lib/event/message.handler.js +237 -237
- package/lib/event/message.js +69 -69
- package/lib/event/notice.d.ts +49 -49
- package/lib/event/notice.js +14 -14
- package/lib/event/request.d.ts +49 -49
- package/lib/event/request.js +14 -14
- package/lib/event/review.handler.d.ts +54 -54
- package/lib/event/review.handler.js +374 -374
- package/lib/index.d.ts +23 -23
- package/lib/index.js +39 -40
- package/lib/renderer/app.d.ts +53 -53
- package/lib/renderer/app.js +88 -88
- package/lib/renderer/base.d.ts +30 -30
- package/lib/renderer/base.js +68 -68
- package/lib/renderer/client.d.ts +30 -30
- package/lib/renderer/client.js +155 -155
- package/lib/renderer/http.d.ts +19 -19
- package/lib/renderer/http.js +50 -50
- package/lib/renderer/server.d.ts +42 -42
- package/lib/renderer/server.js +110 -110
- package/lib/renderer/wormhole.d.ts +1 -1
- package/lib/renderer/wormhole.js +154 -154
- package/lib/types/adapter.d.ts +575 -575
- package/lib/types/adapter.js +1 -1
- package/lib/types/config.d.ts +327 -327
- package/lib/types/config.js +1 -1
- package/lib/types/element.d.ts +576 -576
- package/lib/types/element.js +1 -1
- package/lib/types/index.d.ts +8 -8
- package/lib/types/index.js +8 -8
- package/lib/types/logger.d.ts +109 -109
- package/lib/types/logger.js +1 -1
- package/lib/types/onebots11.d.ts +1371 -1371
- package/lib/types/onebots11.js +1 -1
- package/lib/types/plugin.d.ts +282 -282
- package/lib/types/plugin.js +1 -1
- package/lib/types/render.d.ts +111 -111
- package/lib/types/render.js +1 -1
- package/lib/types/reply.d.ts +40 -40
- package/lib/types/reply.js +1 -1
- package/lib/types/types.d.ts +898 -898
- package/lib/types/types.js +1 -1
- package/lib/utils/YamlEditor.d.ts +62 -62
- package/lib/utils/YamlEditor.js +197 -197
- package/lib/utils/button.d.ts +49 -49
- package/lib/utils/button.js +75 -75
- package/lib/utils/common.d.ts +123 -123
- package/lib/utils/common.js +396 -396
- package/lib/utils/config.d.ts +72 -72
- package/lib/utils/config.js +254 -254
- package/lib/utils/exec.d.ts +22 -22
- package/lib/utils/exec.js +36 -36
- package/lib/utils/ffmpeg.d.ts +12 -12
- package/lib/utils/ffmpeg.js +25 -25
- package/lib/utils/handler.d.ts +76 -76
- package/lib/utils/handler.js +98 -98
- package/lib/utils/logger.d.ts +3 -3
- package/lib/utils/logger.js +104 -104
- package/lib/utils/segment.d.ts +276 -276
- package/lib/utils/segment.js +420 -420
- package/lib/utils/update.d.ts +69 -69
- package/lib/utils/update.js +145 -145
- package/lib/utils/updateVersion.d.ts +33 -33
- package/lib/utils/updateVersion.js +140 -140
- package/package.json +92 -91
package/lib/types/render.d.ts
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import chokidar from 'chokidar';
|
|
2
|
-
/**
|
|
3
|
-
* 渲染标准方法传参
|
|
4
|
-
*/
|
|
5
|
-
export interface KarinRenderType {
|
|
6
|
-
/**
|
|
7
|
-
* - 渲染文件路径或HTTP地址 与vue二选一
|
|
8
|
-
*/
|
|
9
|
-
file: string;
|
|
10
|
-
/**
|
|
11
|
-
* - vue文件路径 与file二选一
|
|
12
|
-
*/
|
|
13
|
-
vue?: string;
|
|
14
|
-
/**
|
|
15
|
-
* - 模板名称
|
|
16
|
-
*/
|
|
17
|
-
name?: string;
|
|
18
|
-
/**
|
|
19
|
-
* - art-template后的文件名
|
|
20
|
-
*/
|
|
21
|
-
fileID?: string;
|
|
22
|
-
/**
|
|
23
|
-
* - 传递给模板的数据 template.render(data)
|
|
24
|
-
*/
|
|
25
|
-
data?: object;
|
|
26
|
-
/**
|
|
27
|
-
* - 截图类型 默认'webp'
|
|
28
|
-
*/
|
|
29
|
-
type?: 'png' | 'jpeg' | 'webp';
|
|
30
|
-
/**
|
|
31
|
-
* - 截图质量 默认90 1-100
|
|
32
|
-
*/
|
|
33
|
-
quality?: number;
|
|
34
|
-
/**
|
|
35
|
-
* - 是否隐藏背景 默认false
|
|
36
|
-
*/
|
|
37
|
-
omitBackground?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* - 设置视窗大小和设备像素比 默认1920*1080、1
|
|
40
|
-
*/
|
|
41
|
-
setViewport?: {
|
|
42
|
-
/**
|
|
43
|
-
* - 视窗宽度
|
|
44
|
-
*/
|
|
45
|
-
width?: number;
|
|
46
|
-
/**
|
|
47
|
-
* - 视窗高度
|
|
48
|
-
*/
|
|
49
|
-
height?: number;
|
|
50
|
-
/**
|
|
51
|
-
* - 设备像素比
|
|
52
|
-
*/
|
|
53
|
-
deviceScaleFactor?: string;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* - 分页截图 传递数字则视为视窗高度 返回数组
|
|
57
|
-
*/
|
|
58
|
-
multiPage?: number | boolean;
|
|
59
|
-
/**
|
|
60
|
-
* - 页面goto时的参数
|
|
61
|
-
*/
|
|
62
|
-
pageGotoParams?: {
|
|
63
|
-
/**
|
|
64
|
-
* - 页面加载超时时间
|
|
65
|
-
*/
|
|
66
|
-
timeout?: number;
|
|
67
|
-
/**
|
|
68
|
-
* - 页面加载状态
|
|
69
|
-
*/
|
|
70
|
-
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
|
|
71
|
-
[key: string]: any;
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* 渲染基类
|
|
76
|
-
*/
|
|
77
|
-
export interface KarinRender {
|
|
78
|
-
dir: './temp/html';
|
|
79
|
-
html: {
|
|
80
|
-
[key: string]: string;
|
|
81
|
-
};
|
|
82
|
-
watcher: {
|
|
83
|
-
[key: string]: chokidar.FSWatcher;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* 模板渲染
|
|
87
|
-
* @param options - 渲染参数
|
|
88
|
-
* @param isAbs - 是否返回绝对路径 默认true
|
|
89
|
-
*/
|
|
90
|
-
dealTpl(options: KarinRenderType, isAbs: boolean): string;
|
|
91
|
-
/**
|
|
92
|
-
* 监听模板文件
|
|
93
|
-
* @param tplFile 模板文件路径
|
|
94
|
-
*/
|
|
95
|
-
watch(tplFile: string): void;
|
|
96
|
-
/**
|
|
97
|
-
* 渲染
|
|
98
|
-
* @param options - 标准渲染方法
|
|
99
|
-
*/
|
|
100
|
-
render: (options: KarinRenderType) => Promise<string | Array<string>>;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* 渲染器管理
|
|
104
|
-
*/
|
|
105
|
-
export interface KarinRenderApp {
|
|
106
|
-
index: number;
|
|
107
|
-
id: string;
|
|
108
|
-
type: string;
|
|
109
|
-
time: number;
|
|
110
|
-
render: KarinRender['render'];
|
|
111
|
-
}
|
|
1
|
+
import chokidar from 'chokidar';
|
|
2
|
+
/**
|
|
3
|
+
* 渲染标准方法传参
|
|
4
|
+
*/
|
|
5
|
+
export interface KarinRenderType {
|
|
6
|
+
/**
|
|
7
|
+
* - 渲染文件路径或HTTP地址 与vue二选一
|
|
8
|
+
*/
|
|
9
|
+
file: string;
|
|
10
|
+
/**
|
|
11
|
+
* - vue文件路径 与file二选一
|
|
12
|
+
*/
|
|
13
|
+
vue?: string;
|
|
14
|
+
/**
|
|
15
|
+
* - 模板名称
|
|
16
|
+
*/
|
|
17
|
+
name?: string;
|
|
18
|
+
/**
|
|
19
|
+
* - art-template后的文件名
|
|
20
|
+
*/
|
|
21
|
+
fileID?: string;
|
|
22
|
+
/**
|
|
23
|
+
* - 传递给模板的数据 template.render(data)
|
|
24
|
+
*/
|
|
25
|
+
data?: object;
|
|
26
|
+
/**
|
|
27
|
+
* - 截图类型 默认'webp'
|
|
28
|
+
*/
|
|
29
|
+
type?: 'png' | 'jpeg' | 'webp';
|
|
30
|
+
/**
|
|
31
|
+
* - 截图质量 默认90 1-100
|
|
32
|
+
*/
|
|
33
|
+
quality?: number;
|
|
34
|
+
/**
|
|
35
|
+
* - 是否隐藏背景 默认false
|
|
36
|
+
*/
|
|
37
|
+
omitBackground?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* - 设置视窗大小和设备像素比 默认1920*1080、1
|
|
40
|
+
*/
|
|
41
|
+
setViewport?: {
|
|
42
|
+
/**
|
|
43
|
+
* - 视窗宽度
|
|
44
|
+
*/
|
|
45
|
+
width?: number;
|
|
46
|
+
/**
|
|
47
|
+
* - 视窗高度
|
|
48
|
+
*/
|
|
49
|
+
height?: number;
|
|
50
|
+
/**
|
|
51
|
+
* - 设备像素比
|
|
52
|
+
*/
|
|
53
|
+
deviceScaleFactor?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* - 分页截图 传递数字则视为视窗高度 返回数组
|
|
57
|
+
*/
|
|
58
|
+
multiPage?: number | boolean;
|
|
59
|
+
/**
|
|
60
|
+
* - 页面goto时的参数
|
|
61
|
+
*/
|
|
62
|
+
pageGotoParams?: {
|
|
63
|
+
/**
|
|
64
|
+
* - 页面加载超时时间
|
|
65
|
+
*/
|
|
66
|
+
timeout?: number;
|
|
67
|
+
/**
|
|
68
|
+
* - 页面加载状态
|
|
69
|
+
*/
|
|
70
|
+
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
|
|
71
|
+
[key: string]: any;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 渲染基类
|
|
76
|
+
*/
|
|
77
|
+
export interface KarinRender {
|
|
78
|
+
dir: './temp/html';
|
|
79
|
+
html: {
|
|
80
|
+
[key: string]: string;
|
|
81
|
+
};
|
|
82
|
+
watcher: {
|
|
83
|
+
[key: string]: chokidar.FSWatcher;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* 模板渲染
|
|
87
|
+
* @param options - 渲染参数
|
|
88
|
+
* @param isAbs - 是否返回绝对路径 默认true
|
|
89
|
+
*/
|
|
90
|
+
dealTpl(options: KarinRenderType, isAbs: boolean): string;
|
|
91
|
+
/**
|
|
92
|
+
* 监听模板文件
|
|
93
|
+
* @param tplFile 模板文件路径
|
|
94
|
+
*/
|
|
95
|
+
watch(tplFile: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* 渲染
|
|
98
|
+
* @param options - 标准渲染方法
|
|
99
|
+
*/
|
|
100
|
+
render: (options: KarinRenderType) => Promise<string | Array<string>>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 渲染器管理
|
|
104
|
+
*/
|
|
105
|
+
export interface KarinRenderApp {
|
|
106
|
+
index: number;
|
|
107
|
+
id: string;
|
|
108
|
+
type: string;
|
|
109
|
+
time: number;
|
|
110
|
+
render: KarinRender['render'];
|
|
111
|
+
}
|
package/lib/types/render.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|
package/lib/types/reply.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { KarinElement } from './element.js';
|
|
2
|
-
export type Reply = (
|
|
3
|
-
/**
|
|
4
|
-
* 发送的消息
|
|
5
|
-
*/
|
|
6
|
-
elements: string | KarinElement | Array<KarinElement | string>,
|
|
7
|
-
/**
|
|
8
|
-
* 选项
|
|
9
|
-
*/
|
|
10
|
-
options?: {
|
|
11
|
-
/**
|
|
12
|
-
* 是否@回复
|
|
13
|
-
*/
|
|
14
|
-
at?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* 是否回复
|
|
17
|
-
*/
|
|
18
|
-
reply?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* 发送成功后撤回发送消息的时间
|
|
21
|
-
*/
|
|
22
|
-
recallMsg?: number;
|
|
23
|
-
/**
|
|
24
|
-
* 重试次数
|
|
25
|
-
*/
|
|
26
|
-
retry_count?: number;
|
|
27
|
-
}) => Promise<{
|
|
28
|
-
message_id?: string;
|
|
29
|
-
}>;
|
|
30
|
-
export type replyCallback = (
|
|
31
|
-
/**
|
|
32
|
-
* 发送的消息
|
|
33
|
-
*/
|
|
34
|
-
elements: KarinElement[],
|
|
35
|
-
/**
|
|
36
|
-
* 重试次数
|
|
37
|
-
*/
|
|
38
|
-
retry_count?: number) => Promise<{
|
|
39
|
-
message_id?: string;
|
|
40
|
-
}>;
|
|
1
|
+
import { KarinElement } from './element.js';
|
|
2
|
+
export type Reply = (
|
|
3
|
+
/**
|
|
4
|
+
* 发送的消息
|
|
5
|
+
*/
|
|
6
|
+
elements: string | KarinElement | Array<KarinElement | string>,
|
|
7
|
+
/**
|
|
8
|
+
* 选项
|
|
9
|
+
*/
|
|
10
|
+
options?: {
|
|
11
|
+
/**
|
|
12
|
+
* 是否@回复
|
|
13
|
+
*/
|
|
14
|
+
at?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 是否回复
|
|
17
|
+
*/
|
|
18
|
+
reply?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 发送成功后撤回发送消息的时间
|
|
21
|
+
*/
|
|
22
|
+
recallMsg?: number;
|
|
23
|
+
/**
|
|
24
|
+
* 重试次数
|
|
25
|
+
*/
|
|
26
|
+
retry_count?: number;
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
message_id?: string;
|
|
29
|
+
}>;
|
|
30
|
+
export type replyCallback = (
|
|
31
|
+
/**
|
|
32
|
+
* 发送的消息
|
|
33
|
+
*/
|
|
34
|
+
elements: KarinElement[],
|
|
35
|
+
/**
|
|
36
|
+
* 重试次数
|
|
37
|
+
*/
|
|
38
|
+
retry_count?: number) => Promise<{
|
|
39
|
+
message_id?: string;
|
|
40
|
+
}>;
|
package/lib/types/reply.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|