alemonjs 1.0.44 → 1.0.45
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/dealmsg.js +1 -18
- package/lib/core/plugin.js +3 -3
- package/package.json +1 -1
- package/types/core/plugin.d.ts +3 -3
- package/types/define/types.d.ts +1 -1
package/lib/core/dealmsg.js
CHANGED
|
@@ -103,8 +103,7 @@ async function synthesis(AppsObj, appname) {
|
|
|
103
103
|
}
|
|
104
104
|
CommandApp[itemX] = {
|
|
105
105
|
name: appname,
|
|
106
|
-
|
|
107
|
-
character: keys['character'] ?? defaultCharacter,
|
|
106
|
+
character: keys?.startCharacter ?? defaultCharacter,
|
|
108
107
|
APP: AppsObj[item]
|
|
109
108
|
};
|
|
110
109
|
for await (const key of keys['rule']) {
|
|
@@ -286,22 +285,6 @@ export function getMergedRegex() {
|
|
|
286
285
|
export async function loadInit() {
|
|
287
286
|
await loadPlugins(join(process.cwd(), getAppProCoinfg('dir')));
|
|
288
287
|
}
|
|
289
|
-
/**
|
|
290
|
-
* 起始符转换器
|
|
291
|
-
* @param reg
|
|
292
|
-
* @returns
|
|
293
|
-
*/
|
|
294
|
-
function getStartSymbol(reg) {
|
|
295
|
-
const source = reg.source;
|
|
296
|
-
let startSymbol = '';
|
|
297
|
-
if (source.startsWith('#')) {
|
|
298
|
-
startSymbol = '#';
|
|
299
|
-
}
|
|
300
|
-
else if (source.startsWith('/')) {
|
|
301
|
-
startSymbol = '/';
|
|
302
|
-
}
|
|
303
|
-
return startSymbol;
|
|
304
|
-
}
|
|
305
288
|
/**
|
|
306
289
|
* 指令匹配
|
|
307
290
|
* @param e alemonjs message
|
package/lib/core/plugin.js
CHANGED
|
@@ -38,7 +38,7 @@ export class plugin {
|
|
|
38
38
|
/**
|
|
39
39
|
* 起始符特性
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
startCharacter;
|
|
42
42
|
/**
|
|
43
43
|
* @deprecated 已废弃,建议使用原生模块 node-schedule
|
|
44
44
|
*/
|
|
@@ -54,13 +54,13 @@ export class plugin {
|
|
|
54
54
|
* @param rule.doc 指令文档 doc
|
|
55
55
|
* @param rule.priority 优先级 数字越小优先级越高
|
|
56
56
|
*/
|
|
57
|
-
constructor({ name = 'app-name', event = 'MESSAGES', eventType = 'CREATE', priority = 9000,
|
|
57
|
+
constructor({ name = 'app-name', event = 'MESSAGES', eventType = 'CREATE', priority = 9000, startCharacter = '/', rule = [], task }) {
|
|
58
58
|
this.name = name;
|
|
59
59
|
this.event = event;
|
|
60
60
|
this.eventType = eventType;
|
|
61
61
|
this.priority = priority;
|
|
62
62
|
this.rule = rule;
|
|
63
|
-
this.
|
|
63
|
+
this.startCharacter = startCharacter;
|
|
64
64
|
this.task = {
|
|
65
65
|
name: task?.name ?? '',
|
|
66
66
|
fnc: task?.fnc ?? '',
|
package/package.json
CHANGED
package/types/core/plugin.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface PluginInitType {
|
|
|
19
19
|
name?: string;
|
|
20
20
|
dsc?: string;
|
|
21
21
|
rule?: PluginRuleType[];
|
|
22
|
-
|
|
22
|
+
startCharacter?: '/' | '#';
|
|
23
23
|
/**
|
|
24
24
|
* @deprecated 已废弃,建议使用原生模块 node-schedule
|
|
25
25
|
*/
|
|
@@ -86,7 +86,7 @@ export declare class plugin {
|
|
|
86
86
|
/**
|
|
87
87
|
* 起始符特性
|
|
88
88
|
*/
|
|
89
|
-
|
|
89
|
+
startCharacter?: '/' | '#';
|
|
90
90
|
/**
|
|
91
91
|
* @deprecated 已废弃,建议使用原生模块 node-schedule
|
|
92
92
|
*/
|
|
@@ -102,7 +102,7 @@ export declare class plugin {
|
|
|
102
102
|
* @param rule.doc 指令文档 doc
|
|
103
103
|
* @param rule.priority 优先级 数字越小优先级越高
|
|
104
104
|
*/
|
|
105
|
-
constructor({ name, event, eventType, priority,
|
|
105
|
+
constructor({ name, event, eventType, priority, startCharacter, rule, task }: PluginInitType);
|
|
106
106
|
/**
|
|
107
107
|
* @param content 内容
|
|
108
108
|
* @param img 图片buffer | 指定图片名
|