node-karin 0.11.0 → 0.11.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.
@@ -208,19 +208,19 @@ class PluginLoader {
208
208
  * @param isNpm - 是否为npm插件
209
209
  */
210
210
  async loadMain(root, main, isNpm) {
211
- const _path = 'file://' + path.resolve(root, main || '');
212
- if (!common.exists(_path)) {
211
+ const _path = path.resolve(root, main || '');
212
+ if (!common.exists(_path) || !main) {
213
213
  if (isNpm)
214
214
  return false;
215
- const defRoot = 'file://' + path.resolve(root, 'index.js');
215
+ const defRoot = path.resolve(root, 'index.js');
216
216
  if (common.exists(defRoot)) {
217
- await import(defRoot);
217
+ await import(`file://${defRoot}`);
218
218
  return true;
219
219
  }
220
220
  logger.debug(`[插件收集][${main}] 入口文件不存在,已忽略`);
221
221
  return false;
222
222
  }
223
- await import(_path);
223
+ await import(`file://${_path}`);
224
224
  return true;
225
225
  }
226
226
  /**
@@ -11,12 +11,11 @@ export class MessageHandler extends EventBaseHandler {
11
11
  constructor(e) {
12
12
  super(e);
13
13
  this.e = e;
14
- const cd = this.getCd();
15
14
  this.init();
16
- if (!cd)
17
- return;
18
15
  // todo: emit event
19
16
  if (this.e.group_id) {
17
+ if (!this.getCd())
18
+ return;
20
19
  if (!this.getMode())
21
20
  return;
22
21
  if (!this.getGroupEnable())
@@ -10,11 +10,10 @@ export class NoticeHandler extends EventBaseHandler {
10
10
  constructor(e) {
11
11
  super(e);
12
12
  this.e = e;
13
- const cd = this.getCd();
14
13
  this.init();
15
- if (!cd)
16
- return;
17
14
  if (this.e.group_id) {
15
+ if (!this.getCd())
16
+ return;
18
17
  if (!this.getGroupEnable())
19
18
  return;
20
19
  if (!this.getUserEnable())
@@ -10,11 +10,10 @@ export class RequestHandler extends EventBaseHandler {
10
10
  constructor(e) {
11
11
  super(e);
12
12
  this.e = e;
13
- const cd = this.getCd();
14
13
  this.init();
15
- if (!cd)
16
- return;
17
14
  if (this.e.group_id) {
15
+ if (!this.getCd())
16
+ return;
18
17
  if (!this.getGroupEnable())
19
18
  return;
20
19
  if (!this.getUserEnable())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "private": false,
5
5
  "description": "基于 Kritor 进行开发的nodejs机器人框架",
6
6
  "homepage": "https://github.com/KarinJS/Karin",