@karinjs/adapter-qqbot 1.0.1 → 1.1.1
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/README.md +5 -0
- package/lib/core/index.js +6 -0
- package/lib/utils/dir.d.ts +1 -1
- package/lib/utils/dir.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/core/index.js
CHANGED
|
@@ -163,6 +163,12 @@ export class AdapterQQBot {
|
|
|
163
163
|
elements.push(segment.face(Number(Match[1])));
|
|
164
164
|
}
|
|
165
165
|
else {
|
|
166
|
+
const BotConfig = Config.getBotConfig(this.account.uid) || { regex: [] };
|
|
167
|
+
for (const reg of BotConfig.regex) {
|
|
168
|
+
if (typeof v === 'string') {
|
|
169
|
+
v = v.trim().replace(new RegExp(reg.reg), reg.rep);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
166
172
|
elements.push(segment.text(v));
|
|
167
173
|
}
|
|
168
174
|
});
|
package/lib/utils/dir.d.ts
CHANGED
package/lib/utils/dir.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
3
|
import { fileURLToPath } from 'url';
|
|
3
4
|
/** 当前文件的绝对路径 */
|
|
@@ -5,5 +6,5 @@ const filePath = fileURLToPath(import.meta.url).replace(/\\/g, '/');
|
|
|
5
6
|
/** 插件包绝对路径 */
|
|
6
7
|
const dirPath = path.resolve(filePath, '../../../');
|
|
7
8
|
/** 插件包的名称 */
|
|
8
|
-
const basename =
|
|
9
|
+
const basename = JSON.parse(fs.readFileSync(`${dirPath}/package.json`, 'utf-8')).name;
|
|
9
10
|
export { dirPath, basename };
|