alemonjs 1.0.13 → 1.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/bin/main.js +1 -1
- package/lib/core/apps.js +0 -6
- package/lib/core/configs.js +22 -0
- package/lib/core/dealmsg.js +44 -134
- package/lib/core/index.js +1 -0
- package/lib/core/screenshot.js +2 -2
- package/lib/define/main.js +21 -13
- package/package.json +10 -8
- package/types/core/apps.d.ts +0 -6
- package/types/core/configs.d.ts +11 -0
- package/types/core/dealmsg.d.ts +5 -27
- package/types/core/index.d.ts +1 -0
- package/types/define/types.d.ts +11 -0
package/bin/main.js
CHANGED
package/lib/core/apps.js
CHANGED
|
@@ -2,7 +2,6 @@ import { dirname, basename } from 'path';
|
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
import { setMessage } from './message.js';
|
|
4
4
|
import { setApp } from './app.js';
|
|
5
|
-
import { setAppsHelp } from './dealmsg.js';
|
|
6
5
|
/**
|
|
7
6
|
* 得到执行路径
|
|
8
7
|
* @param url
|
|
@@ -34,11 +33,6 @@ export function createApp(AppName) {
|
|
|
34
33
|
*/
|
|
35
34
|
let acount = 0;
|
|
36
35
|
return {
|
|
37
|
-
/**
|
|
38
|
-
* 设置指令json地址
|
|
39
|
-
* @param rt = '/public/defset'
|
|
40
|
-
*/
|
|
41
|
-
setHelp: setAppsHelp,
|
|
42
36
|
/**
|
|
43
37
|
* 重定义消息
|
|
44
38
|
* @param fnc
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const ApplicationProcessingConfiguration = {
|
|
2
|
+
// 根目录
|
|
3
|
+
dir: '/application',
|
|
4
|
+
// 主函数
|
|
5
|
+
main: '/index',
|
|
6
|
+
type: 'ts',
|
|
7
|
+
// 打开正则
|
|
8
|
+
openRegex: /./,
|
|
9
|
+
// 屏蔽正则
|
|
10
|
+
closeRegex: /./,
|
|
11
|
+
// 指令生成地址
|
|
12
|
+
route: '/public/defset'
|
|
13
|
+
};
|
|
14
|
+
export function setAppProCoinfg(key, val) {
|
|
15
|
+
// 当前仅当同属性名的时候才会覆盖默认配置
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(ApplicationProcessingConfiguration, val)) {
|
|
17
|
+
ApplicationProcessingConfiguration[key] = val;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function getAppProCoinfg(key) {
|
|
21
|
+
return ApplicationProcessingConfiguration[key];
|
|
22
|
+
}
|
package/lib/core/dealmsg.js
CHANGED
|
@@ -6,71 +6,27 @@ import { getMessage } from './message.js';
|
|
|
6
6
|
import { getApp, delApp, getAppKey } from './app.js';
|
|
7
7
|
import { EventEnum } from './typings.js';
|
|
8
8
|
import { conversationHandlers, getConversationState } from './dialogue.js';
|
|
9
|
+
import { getAppProCoinfg } from './configs.js';
|
|
9
10
|
const Command = {};
|
|
10
11
|
const CommandNotR = {};
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* plugins管理
|
|
14
|
-
* ***********
|
|
13
|
+
* 机器人统计
|
|
15
14
|
*/
|
|
16
|
-
let PluginsArr = [];
|
|
17
15
|
const plugins = {};
|
|
18
|
-
/**
|
|
19
|
-
* 默认执行地址
|
|
20
|
-
*/
|
|
21
|
-
const route = '/public/defset';
|
|
22
|
-
/**
|
|
23
|
-
* 执行文件
|
|
24
|
-
*/
|
|
25
|
-
let addressMenu = join(process.cwd(), route);
|
|
26
16
|
// 大正则
|
|
27
17
|
let mergedRegex;
|
|
28
|
-
// 插件目录匹配规则
|
|
29
|
-
let appRegex = /./;
|
|
30
|
-
// 插件目录取消规则
|
|
31
|
-
let appRegexClose;
|
|
32
|
-
/**
|
|
33
|
-
* 插件名匹配
|
|
34
|
-
* @param val
|
|
35
|
-
*/
|
|
36
|
-
export function setAppRegex(val) {
|
|
37
|
-
const { RegexOpen, RegexClose } = val;
|
|
38
|
-
if (RegexOpen) {
|
|
39
|
-
appRegex = RegexOpen;
|
|
40
|
-
}
|
|
41
|
-
if (RegexClose) {
|
|
42
|
-
appRegexClose = RegexClose;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 得到插件名匹配模式
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
export function getAppRegex() {
|
|
50
|
-
return {
|
|
51
|
-
RegexOpen: appRegex,
|
|
52
|
-
RegexClose: appRegexClose
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* 设置指令json地址
|
|
57
|
-
* @param rt '/public/defset'
|
|
58
|
-
*/
|
|
59
|
-
export function setAppsHelp(rt = route) {
|
|
60
|
-
addressMenu = join(process.cwd(), rt);
|
|
61
|
-
}
|
|
62
18
|
/**
|
|
63
19
|
* 得到机器人帮助
|
|
64
20
|
* @param AppName
|
|
65
21
|
* @returns
|
|
66
22
|
*/
|
|
67
23
|
export function getPluginHelp(AppName) {
|
|
68
|
-
const
|
|
24
|
+
const dir = getAppProCoinfg('route');
|
|
25
|
+
const basePath = join(process.cwd(), dir, `${AppName}.json`);
|
|
69
26
|
return JSON.parse(readFileSync(basePath, 'utf8'));
|
|
70
27
|
}
|
|
71
28
|
/**
|
|
72
29
|
* 创建机器人帮助
|
|
73
|
-
* 存在且得到的app不为[]时才会创建json
|
|
74
30
|
*/
|
|
75
31
|
function createPluginHelp() {
|
|
76
32
|
// 存在app才创建
|
|
@@ -83,13 +39,14 @@ function createPluginHelp() {
|
|
|
83
39
|
}
|
|
84
40
|
}
|
|
85
41
|
if (t) {
|
|
42
|
+
const dir = join(process.cwd(), getAppProCoinfg('route'));
|
|
86
43
|
// 不存在
|
|
87
|
-
if (!existsSync(
|
|
88
|
-
mkdirSync(
|
|
44
|
+
if (!existsSync(dir))
|
|
45
|
+
mkdirSync(dir, { recursive: true });
|
|
89
46
|
// 创建help
|
|
90
47
|
for (const item in plugins) {
|
|
91
48
|
if (plugins[item] && plugins[item].length != 0) {
|
|
92
|
-
const basePath = join(
|
|
49
|
+
const basePath = join(dir, `${item}.json`);
|
|
93
50
|
const jsonData = JSON.stringify(plugins[item], null, 2);
|
|
94
51
|
// 异步创建避免阻塞
|
|
95
52
|
writeFile(basePath, jsonData, 'utf-8');
|
|
@@ -112,25 +69,18 @@ async function synthesis(AppsObj, appname) {
|
|
|
112
69
|
const keys = new AppsObj[item]();
|
|
113
70
|
// 控制类型
|
|
114
71
|
const eventType = keys['eventType'] ?? 'CREATE';
|
|
115
|
-
|
|
116
|
-
* 不合法
|
|
117
|
-
*/
|
|
72
|
+
// 不合法
|
|
118
73
|
if (!keys['rule'] ||
|
|
119
74
|
!Array.isArray(keys['rule']) ||
|
|
120
75
|
keys['rule'].length == 0) {
|
|
121
76
|
continue;
|
|
122
77
|
}
|
|
123
|
-
|
|
124
|
-
* 指令不存在
|
|
125
|
-
*/
|
|
78
|
+
// 指令不存在
|
|
126
79
|
for await (const key of keys['rule']) {
|
|
127
80
|
if (!key['fnc'] ||
|
|
128
81
|
!key['reg'] ||
|
|
129
82
|
typeof keys[key['fnc']] !== 'function') {
|
|
130
|
-
|
|
131
|
-
* 函数指定不存在,正则不存在
|
|
132
|
-
* 得到的不是函数
|
|
133
|
-
*/
|
|
83
|
+
/// 函数指定不存在,正则不存在 得到的不是函数
|
|
134
84
|
continue;
|
|
135
85
|
}
|
|
136
86
|
// 先看指令优先级,没有就看类优先级,再没有则默认优先级
|
|
@@ -202,41 +152,34 @@ async function loadPlugins(dir) {
|
|
|
202
152
|
const flies = readdirSync(dir);
|
|
203
153
|
if (flies.length == 0)
|
|
204
154
|
return;
|
|
155
|
+
// 读取配置
|
|
156
|
+
const open = getAppProCoinfg('openRegex');
|
|
157
|
+
const close = getAppProCoinfg('closeRegex');
|
|
158
|
+
// 排除
|
|
205
159
|
const apps = flies
|
|
206
|
-
.filter(item =>
|
|
160
|
+
.filter(item => open.test(item))
|
|
207
161
|
.filter(item => {
|
|
208
|
-
if (!
|
|
162
|
+
if (!close) {
|
|
209
163
|
return true;
|
|
210
164
|
}
|
|
211
|
-
if (
|
|
165
|
+
if (close.test(item)) {
|
|
212
166
|
return false;
|
|
213
167
|
}
|
|
214
168
|
return true;
|
|
215
169
|
});
|
|
216
170
|
/**
|
|
217
|
-
*
|
|
171
|
+
* 动态扫描
|
|
218
172
|
*/
|
|
173
|
+
const main = getAppProCoinfg('main');
|
|
174
|
+
const type = getAppProCoinfg('type');
|
|
219
175
|
for await (const appname of apps) {
|
|
220
|
-
if (existsSync(`${dir}/${appname}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
*/
|
|
224
|
-
await import(`file://${dir}/${appname}/index.ts`).catch(err => {
|
|
225
|
-
console.error(`file://${dir}/${appname}/index.ts`);
|
|
176
|
+
if (existsSync(`${dir}/${appname}${main}.${type}`)) {
|
|
177
|
+
await import(`file://${dir}/${appname}${main}.${type}`).catch(err => {
|
|
178
|
+
console.error(`file://${dir}/${appname}${main}.${type}`);
|
|
226
179
|
console.error(err);
|
|
227
180
|
process.exit();
|
|
228
181
|
});
|
|
229
182
|
}
|
|
230
|
-
else if (existsSync(`${dir}/${appname}/index.js`)) {
|
|
231
|
-
/**
|
|
232
|
-
* 允许js写法
|
|
233
|
-
*/
|
|
234
|
-
await import(`file://${dir}/${appname}/index.js`).catch(error => {
|
|
235
|
-
console.error(`file://${dir}/${appname}/index.js`);
|
|
236
|
-
console.error(error);
|
|
237
|
-
process.exit();
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
183
|
}
|
|
241
184
|
return;
|
|
242
185
|
}
|
|
@@ -244,7 +187,6 @@ async function loadPlugins(dir) {
|
|
|
244
187
|
* 初始化应用
|
|
245
188
|
*/
|
|
246
189
|
function dataInit() {
|
|
247
|
-
PluginsArr = [];
|
|
248
190
|
for (const item of EventEnum) {
|
|
249
191
|
if (isNaN(Number(item))) {
|
|
250
192
|
Command[item] = [];
|
|
@@ -258,87 +200,55 @@ function dataInit() {
|
|
|
258
200
|
* @returns
|
|
259
201
|
*/
|
|
260
202
|
export async function appsInit() {
|
|
261
|
-
|
|
262
|
-
* 清空当前的apps
|
|
263
|
-
*/
|
|
203
|
+
// 清空当前的apps
|
|
264
204
|
dataInit();
|
|
265
|
-
|
|
266
|
-
* 得到所有插件名
|
|
267
|
-
*/
|
|
205
|
+
// 得到所有插件名
|
|
268
206
|
const APPARR = getAppKey();
|
|
269
|
-
|
|
270
|
-
* 导出所有插件名
|
|
271
|
-
*/
|
|
207
|
+
// 导出所有插件名
|
|
272
208
|
for await (const item of APPARR) {
|
|
273
|
-
|
|
274
|
-
* 获取插件集
|
|
275
|
-
*/
|
|
209
|
+
// 获取插件集
|
|
276
210
|
const apps = getApp(item);
|
|
277
|
-
|
|
278
|
-
* 分析插件集
|
|
279
|
-
*/
|
|
211
|
+
// 分析插件集
|
|
280
212
|
await synthesis(apps, item);
|
|
281
|
-
|
|
282
|
-
* 记录该插件
|
|
283
|
-
*/
|
|
284
|
-
PluginsArr.push(item);
|
|
285
|
-
/**
|
|
286
|
-
* 删除指集
|
|
287
|
-
*/
|
|
213
|
+
// 删除指集
|
|
288
214
|
delApp(item);
|
|
289
215
|
}
|
|
290
|
-
|
|
291
|
-
* 排序
|
|
292
|
-
*/
|
|
216
|
+
// 排序
|
|
293
217
|
for (const val in Command) {
|
|
294
218
|
Command[val] = lodash.orderBy(Command[val], ['priority'], ['asc']);
|
|
295
219
|
}
|
|
296
|
-
|
|
297
|
-
* 排序
|
|
298
|
-
*/
|
|
220
|
+
// 排序
|
|
299
221
|
for (const val in CommandNotR) {
|
|
300
222
|
CommandNotR[val] = lodash.orderBy(CommandNotR[val], ['priority'], ['asc']);
|
|
301
223
|
}
|
|
302
|
-
|
|
303
|
-
* 排序之后把所有正则变成一条正则
|
|
304
|
-
*/
|
|
224
|
+
// 排序之后把所有正则变成一条正则
|
|
305
225
|
const mergedRegexArr = [];
|
|
306
226
|
for (const val in Command) {
|
|
307
|
-
for (const
|
|
308
|
-
|
|
309
|
-
mergedRegexArr.push(data.reg);
|
|
310
|
-
}
|
|
227
|
+
for await (const { reg } of Command[val]) {
|
|
228
|
+
mergedRegexArr.push(reg);
|
|
311
229
|
}
|
|
312
230
|
}
|
|
313
231
|
// 机器人整体指令正则
|
|
314
232
|
mergedRegex = new RegExp(mergedRegexArr.map(regex => regex.source).join('|'));
|
|
315
|
-
|
|
316
|
-
* 生成指令json
|
|
317
|
-
*/
|
|
233
|
+
// 生成指令json
|
|
318
234
|
createPluginHelp();
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
*/
|
|
322
|
-
console.info(`[LOAD] APPS*${PluginsArr.length} `);
|
|
235
|
+
// 打印
|
|
236
|
+
console.info(`[LOAD] APPS*${Object.keys(plugins).length} `);
|
|
323
237
|
return;
|
|
324
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* 得到大正则
|
|
241
|
+
* @returns
|
|
242
|
+
*/
|
|
325
243
|
export function getMergedRegex() {
|
|
326
244
|
return mergedRegex;
|
|
327
245
|
}
|
|
328
|
-
let appDir = '/application';
|
|
329
|
-
export function getAppDir() {
|
|
330
|
-
return appDir;
|
|
331
|
-
}
|
|
332
|
-
export function setAppDir(val) {
|
|
333
|
-
appDir = val;
|
|
334
|
-
}
|
|
335
246
|
/**
|
|
336
|
-
*
|
|
337
|
-
* @param param0 { mount = false, address = '/application' }
|
|
247
|
+
* 初始化应用
|
|
338
248
|
* @returns
|
|
339
249
|
*/
|
|
340
250
|
export async function loadInit() {
|
|
341
|
-
await loadPlugins(join(process.cwd(),
|
|
251
|
+
await loadPlugins(join(process.cwd(), getAppProCoinfg('dir')));
|
|
342
252
|
return;
|
|
343
253
|
}
|
|
344
254
|
/**
|
package/lib/core/index.js
CHANGED
package/lib/core/screenshot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import lodash from 'lodash';
|
|
2
2
|
import { join, basename } from 'path';
|
|
3
3
|
import { readFileSync, watch, mkdirSync } from 'fs';
|
|
4
|
-
import {
|
|
4
|
+
import { getAppProCoinfg } from './configs.js';
|
|
5
5
|
/**
|
|
6
6
|
* 源码缓存
|
|
7
7
|
*/
|
|
@@ -54,7 +54,7 @@ function watchCT(tplFile) {
|
|
|
54
54
|
*/
|
|
55
55
|
export function createStr(Options) {
|
|
56
56
|
const { AppName, tplFile, data } = Options;
|
|
57
|
-
const appDir =
|
|
57
|
+
const appDir = getAppProCoinfg('dir');
|
|
58
58
|
/**
|
|
59
59
|
* 插件路径
|
|
60
60
|
*/
|
package/lib/define/main.js
CHANGED
|
@@ -5,7 +5,7 @@ import { nodeScripts } from './child_process.js';
|
|
|
5
5
|
import { AvailableIntentsEventsEnum } from 'qq-guild-bot';
|
|
6
6
|
import { ClientAPIByQQ as ClientByNTQQ } from '../ntqq/sdk/index.js';
|
|
7
7
|
import { command } from './command.js';
|
|
8
|
-
import { createApp, setLanchConfig, loadInit, appsInit,
|
|
8
|
+
import { createApp, setLanchConfig, loadInit, appsInit, setAppProCoinfg, getAppProCoinfg } from '../core/index.js';
|
|
9
9
|
import { getPupPath, setBotConfigByKey, getBotConfigByKey } from '../config/index.js';
|
|
10
10
|
// 设置ntqq独立鉴权路径
|
|
11
11
|
export const setAuthenticationByNtqq = ClientByNTQQ.setAuthentication;
|
|
@@ -16,10 +16,10 @@ export const setAuthenticationByNtqq = ClientByNTQQ.setAuthentication;
|
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
18
|
export function ApplicationTools(AppName, name = 'apps') {
|
|
19
|
-
const appDir =
|
|
19
|
+
const appDir = getAppProCoinfg('dir');
|
|
20
20
|
return compilationTools({
|
|
21
|
-
aInput: `${appDir}/${AppName}/${name}/**/*.ts`,
|
|
22
|
-
aOutput: `${appDir}/${AppName}/apps.js`
|
|
21
|
+
aInput: `${appDir.replace(/^\//, '')}/${AppName}/${name}/**/*.ts`,
|
|
22
|
+
aOutput: `${appDir.replace(/^\//, '')}/${AppName}/apps.js`
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
let OptionsCache;
|
|
@@ -164,12 +164,12 @@ export async function defineAlemonConfig(Options) {
|
|
|
164
164
|
if (Options?.login && Options?.app?.init !== false) {
|
|
165
165
|
const app = createApp(Options?.app?.name ?? 'bot');
|
|
166
166
|
if (Options?.app?.regJSon?.address) {
|
|
167
|
-
|
|
167
|
+
setAppProCoinfg('route', Options?.app?.regJSon?.address);
|
|
168
168
|
}
|
|
169
169
|
if (Options?.app?.module) {
|
|
170
170
|
const word = await compilationTools({
|
|
171
|
-
aInput: Options?.app?.module?.input ?? 'apps/**/*.ts',
|
|
172
|
-
aOutput: Options?.app?.module?.
|
|
171
|
+
aInput: Options?.app?.module?.input?.replace(/^\//, '') ?? 'apps/**/*.ts',
|
|
172
|
+
aOutput: Options?.app?.module?.output.replace(/^\//, '') ?? '.apps/index.js'
|
|
173
173
|
});
|
|
174
174
|
app.component(word);
|
|
175
175
|
}
|
|
@@ -185,17 +185,25 @@ export async function defineAlemonConfig(Options) {
|
|
|
185
185
|
* 设置加载目录
|
|
186
186
|
* ************
|
|
187
187
|
*/
|
|
188
|
-
|
|
188
|
+
if (Options?.plugin?.directory) {
|
|
189
|
+
setAppProCoinfg('dir', Options?.plugin?.directory);
|
|
190
|
+
}
|
|
191
|
+
if (Options?.plugin?.main) {
|
|
192
|
+
setAppProCoinfg('main', Options?.plugin?.main);
|
|
193
|
+
}
|
|
194
|
+
if (Options?.plugin?.type) {
|
|
195
|
+
setAppProCoinfg('type', Options?.plugin?.type);
|
|
196
|
+
}
|
|
189
197
|
/**
|
|
190
198
|
* ************
|
|
191
199
|
* 设置扫描规则
|
|
192
200
|
* ***********
|
|
193
201
|
*/
|
|
194
|
-
if (Options?.plugin?.RegexOpen
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
202
|
+
if (Options?.plugin?.RegexOpen) {
|
|
203
|
+
setAppProCoinfg('openRegex', Options?.plugin?.RegexOpen);
|
|
204
|
+
}
|
|
205
|
+
if (Options?.plugin?.RegexClose) {
|
|
206
|
+
setAppProCoinfg('closeRegex', Options?.plugin?.RegexClose);
|
|
199
207
|
}
|
|
200
208
|
/**
|
|
201
209
|
* ************
|
package/package.json
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alemonjs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "阿柠檬框架",
|
|
5
5
|
"author": "ningmengchongshui",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
6
|
"license": "GPL-2.0",
|
|
8
7
|
"type": "module",
|
|
9
|
-
"exports": {
|
|
10
|
-
"./run": {
|
|
11
|
-
"types": "./run.d.ts",
|
|
12
|
-
"import": "./run.js"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
8
|
"scripts": {
|
|
16
9
|
"app": "alemonjs",
|
|
17
10
|
"dev": "alemonjs dev",
|
|
@@ -24,6 +17,7 @@
|
|
|
24
17
|
"@discordjs/core": "^0.6.0",
|
|
25
18
|
"@discordjs/rest": "^1.7.1",
|
|
26
19
|
"alemon-rollup": "^1.0.2",
|
|
20
|
+
"alemonjs": "^1.0.13",
|
|
27
21
|
"axios": "^1.4.0",
|
|
28
22
|
"discord.js": "^14.11.0",
|
|
29
23
|
"image-size": "^1.0.2",
|
|
@@ -51,6 +45,7 @@
|
|
|
51
45
|
"typescript": ">=5.0.4 <5.1.0"
|
|
52
46
|
},
|
|
53
47
|
"types": "types",
|
|
48
|
+
"main": "lib/index.js",
|
|
54
49
|
"files": [
|
|
55
50
|
"bin",
|
|
56
51
|
"lib",
|
|
@@ -58,6 +53,13 @@
|
|
|
58
53
|
"run.js",
|
|
59
54
|
"run.d.ts"
|
|
60
55
|
],
|
|
56
|
+
"exports": {
|
|
57
|
+
".": "./lib/index.js",
|
|
58
|
+
"./run": {
|
|
59
|
+
"import": "./run.js",
|
|
60
|
+
"types": "./run.d.ts"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
61
63
|
"bin": {
|
|
62
64
|
"alemonjs": "bin/main.js"
|
|
63
65
|
},
|
package/types/core/apps.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { setAppsHelp } from './dealmsg.js';
|
|
2
1
|
/**
|
|
3
2
|
* 得到执行路径
|
|
4
3
|
* @param url
|
|
@@ -17,11 +16,6 @@ export declare function getAppName(url: string | URL): string;
|
|
|
17
16
|
* @returns
|
|
18
17
|
*/
|
|
19
18
|
export declare function createApp(AppName: string): {
|
|
20
|
-
/**
|
|
21
|
-
* 设置指令json地址
|
|
22
|
-
* @param rt = '/public/defset'
|
|
23
|
-
*/
|
|
24
|
-
setHelp: typeof setAppsHelp;
|
|
25
19
|
/**
|
|
26
20
|
* 重定义消息
|
|
27
21
|
* @param fnc
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ApplicationProcessingOpsion {
|
|
2
|
+
dir: string;
|
|
3
|
+
main: string;
|
|
4
|
+
type: 'ts' | 'js';
|
|
5
|
+
openRegex: RegExp;
|
|
6
|
+
closeRegex: RegExp;
|
|
7
|
+
route: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function setAppProCoinfg<T extends keyof ApplicationProcessingOpsion>(key: T, val: ApplicationProcessingOpsion[T]): void;
|
|
10
|
+
export declare function getAppProCoinfg<T extends keyof ApplicationProcessingOpsion>(key: T): ApplicationProcessingOpsion[T];
|
|
11
|
+
export {};
|
package/types/core/dealmsg.d.ts
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
import { AMessage } from './typings.js';
|
|
2
|
-
interface RegexControl {
|
|
3
|
-
RegexOpen?: RegExp;
|
|
4
|
-
RegexClose?: RegExp;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* 插件名匹配
|
|
8
|
-
* @param val
|
|
9
|
-
*/
|
|
10
|
-
export declare function setAppRegex(val: RegexControl): void;
|
|
11
|
-
/**
|
|
12
|
-
* 得到插件名匹配模式
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
export declare function getAppRegex(): {
|
|
16
|
-
RegexOpen: RegExp;
|
|
17
|
-
RegexClose: RegExp;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* 设置指令json地址
|
|
21
|
-
* @param rt '/public/defset'
|
|
22
|
-
*/
|
|
23
|
-
export declare function setAppsHelp(rt?: string): void;
|
|
24
2
|
/**
|
|
25
3
|
* 得到机器人帮助
|
|
26
4
|
* @param AppName
|
|
@@ -32,12 +10,13 @@ export declare function getPluginHelp(AppName: string): any;
|
|
|
32
10
|
* @returns
|
|
33
11
|
*/
|
|
34
12
|
export declare function appsInit(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* 得到大正则
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
35
17
|
export declare function getMergedRegex(): RegExp;
|
|
36
|
-
export declare function getAppDir(): string;
|
|
37
|
-
export declare function setAppDir(val: string): void;
|
|
38
18
|
/**
|
|
39
|
-
*
|
|
40
|
-
* @param param0 { mount = false, address = '/application' }
|
|
19
|
+
* 初始化应用
|
|
41
20
|
* @returns
|
|
42
21
|
*/
|
|
43
22
|
export declare function loadInit(): Promise<void>;
|
|
@@ -54,4 +33,3 @@ export declare function InstructionMatching(e: AMessage): Promise<boolean>;
|
|
|
54
33
|
* @returns
|
|
55
34
|
*/
|
|
56
35
|
export declare function typeMessage(e: AMessage): Promise<boolean>;
|
|
57
|
-
export {};
|
package/types/core/index.d.ts
CHANGED
package/types/define/types.d.ts
CHANGED