node-karin 0.3.3 → 0.3.5
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/lib/core/listener.d.ts +2 -2
- package/lib/core/listener.js +1 -1
- package/lib/event/message.handler.js +2 -3
- package/lib/index.d.ts +3 -3
- package/lib/render/app.d.ts +1 -1
- package/lib/types/plugin.d.ts +1 -1
- package/lib/utils/button.js +0 -1
- package/lib/utils/handler.d.ts +3 -2
- package/lib/utils/handler.js +1 -1
- package/modules.d.ts +14 -0
- package/modules.js +14 -0
- package/package.json +5 -2
package/lib/core/listener.d.ts
CHANGED
|
@@ -94,8 +94,8 @@ export declare const listener: {
|
|
|
94
94
|
* @param options.retry_count - 重试次数
|
|
95
95
|
*/
|
|
96
96
|
sendMsg(uid: string, contact: contact, elements: KarinElement, options?: {
|
|
97
|
-
recallMsg
|
|
98
|
-
retry_count
|
|
97
|
+
recallMsg?: number;
|
|
98
|
+
retry_count?: number;
|
|
99
99
|
}): Promise<{
|
|
100
100
|
message_id: string;
|
|
101
101
|
}>;
|
package/lib/core/listener.js
CHANGED
|
@@ -178,7 +178,7 @@ export const listener = new (class Listeners extends EventEmitter {
|
|
|
178
178
|
logger.bot('error', self_id, error)
|
|
179
179
|
}
|
|
180
180
|
/** 快速撤回 */
|
|
181
|
-
if (bot.RecallMessage && recallMsg > 0 && result?.message_id) {
|
|
181
|
+
if (recallMsg && bot.RecallMessage && recallMsg > 0 && result?.message_id) {
|
|
182
182
|
setTimeout(() => bot.RecallMessage(contact, result.message_id), recallMsg * 1000)
|
|
183
183
|
}
|
|
184
184
|
return result
|
|
@@ -45,9 +45,8 @@ export class MessageHandler extends EventHandler {
|
|
|
45
45
|
if (app.event && !this.filtEvent(app.event)) { continue }
|
|
46
46
|
/** 正则匹配 */
|
|
47
47
|
for (const v of app.rule) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (v.reg.test(this.e.msg)) {
|
|
48
|
+
const reg = v.reg
|
|
49
|
+
if (reg.test(this.e.msg)) {
|
|
51
50
|
/** 检查黑白名单插件 */
|
|
52
51
|
if ('GroupCD' in this.config && !review.PluginEnable(app, this.config)) { continue }
|
|
53
52
|
/** 判断子事件 */
|
package/lib/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare const Renderer: {
|
|
|
25
25
|
}): number;
|
|
26
26
|
unapp(index: number): boolean;
|
|
27
27
|
App(id?: string): import("./types/index.js").KarinRenderApp;
|
|
28
|
-
render(options: import("./types/index.js").KarinRenderType, id
|
|
28
|
+
render(options: import("./types/index.js").KarinRenderType, id?: string | undefined): Promise<string | string[]>;
|
|
29
29
|
renderHtml(data: string): Promise<string | string[]>;
|
|
30
30
|
};
|
|
31
31
|
export declare const Cfg: {
|
|
@@ -92,8 +92,8 @@ export declare const Bot: {
|
|
|
92
92
|
path: string;
|
|
93
93
|
}[] | (new () => import("./types/index.js").KarinAdapter)[];
|
|
94
94
|
sendMsg(uid: string, contact: import("./types/index.js").contact, elements: import("./types/index.js").KarinElement, options?: {
|
|
95
|
-
recallMsg
|
|
96
|
-
retry_count
|
|
95
|
+
recallMsg?: number | undefined;
|
|
96
|
+
retry_count?: number | undefined;
|
|
97
97
|
}): Promise<{
|
|
98
98
|
message_id: string;
|
|
99
99
|
}>;
|
package/lib/render/app.d.ts
CHANGED
package/lib/types/plugin.d.ts
CHANGED
package/lib/utils/button.js
CHANGED
package/lib/utils/handler.d.ts
CHANGED
|
@@ -28,8 +28,9 @@ export declare const handler: {
|
|
|
28
28
|
* @param key 事件键
|
|
29
29
|
* @param args 自定义参数 一般用来传递e之类的
|
|
30
30
|
*/
|
|
31
|
-
call(key: string, args
|
|
32
|
-
|
|
31
|
+
call(key: string, args: {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
e?: import("../index.js").KarinMessage | undefined;
|
|
33
34
|
}): Promise<any>;
|
|
34
35
|
/**
|
|
35
36
|
* 检查是否存在指定键的事件处理器
|
package/lib/utils/handler.js
CHANGED
|
@@ -65,7 +65,7 @@ export const handler = new (class EventHandler {
|
|
|
65
65
|
* @param key 事件键
|
|
66
66
|
* @param args 自定义参数 一般用来传递e之类的
|
|
67
67
|
*/
|
|
68
|
-
async call (key, args
|
|
68
|
+
async call (key, args) {
|
|
69
69
|
let res
|
|
70
70
|
for (const v of loader.handlerIds[key] || []) {
|
|
71
71
|
const info = loader.PluginList[v.index]
|
package/modules.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import ws from 'ws';
|
|
4
|
+
import moment from 'moment';
|
|
5
|
+
import lodash from 'lodash';
|
|
6
|
+
import express from 'express';
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import chokidar from 'chokidar';
|
|
10
|
+
import { Level as level } from 'level';
|
|
11
|
+
import schedule from 'node-schedule';
|
|
12
|
+
import yaml from 'yaml';
|
|
13
|
+
import log4js from 'log4js';
|
|
14
|
+
export { fs, ws, path, axios, lodash, moment, express, chalk, chokidar, level, schedule, yaml, log4js, };
|
package/modules.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import ws from 'ws';
|
|
4
|
+
import moment from 'moment';
|
|
5
|
+
import lodash from 'lodash';
|
|
6
|
+
import express from 'express';
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import chokidar from 'chokidar';
|
|
10
|
+
import { Level as level } from 'level';
|
|
11
|
+
import schedule from 'node-schedule';
|
|
12
|
+
import yaml from 'yaml';
|
|
13
|
+
import log4js from 'log4js';
|
|
14
|
+
export { fs, ws, path, axios, lodash, moment, express, chalk, chokidar, level, schedule, yaml, log4js, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-karin",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "基于 Kritor 进行开发的nodejs机器人框架",
|
|
6
6
|
"homepage": "https://github.com/KarinJS/Karin",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"/lib/**/*.d.ts",
|
|
27
27
|
"/config/defSet/*.yaml",
|
|
28
28
|
"/config/view/*.yaml",
|
|
29
|
+
"modules.js",
|
|
30
|
+
"modules.d.ts",
|
|
29
31
|
"LICENSE",
|
|
30
32
|
"package.json",
|
|
31
33
|
"README.md"
|
|
@@ -35,7 +37,8 @@
|
|
|
35
37
|
],
|
|
36
38
|
"scripts": {
|
|
37
39
|
"app": "node .",
|
|
38
|
-
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json && npm run fix",
|
|
40
|
+
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json && npm run fix && npm run cp",
|
|
41
|
+
"cp": "cp ./lib/modules.d.ts ./modules.d.ts && cp ./lib/modules.js ./modules.js",
|
|
39
42
|
"delete": "pm2 delete ./config/config/pm2.yaml",
|
|
40
43
|
"fix": "eslint lib/**/*.js --fix",
|
|
41
44
|
"fix:all": "eslint lib/**/*.js --fix && eslint src/**/*.ts --fix",
|