node-karin 0.3.7 → 0.3.8

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.
@@ -4,7 +4,7 @@ import { KarinAdapter, contact, KarinElement } from '../types/index.js';
4
4
  /**
5
5
  * 监听器管理
6
6
  */
7
- export declare const listener: {
7
+ declare class Listeners extends EventEmitter {
8
8
  /**
9
9
  * Bot索引
10
10
  * @type - Bot索引
@@ -24,6 +24,7 @@ export declare const listener: {
24
24
  adapter: new () => KarinAdapter;
25
25
  path: string;
26
26
  }>;
27
+ constructor();
27
28
  /**
28
29
  * 注册Bot 返回索引id
29
30
  */
@@ -80,7 +81,7 @@ export declare const listener: {
80
81
  * @param isType - 是否返回包含的类型列表 默认返回适配器实例列表
81
82
  */
82
83
  getAdapterAll(isType?: boolean): {
83
- type: KarinAdapter['adapter']['type'];
84
+ type: "internal" | "http" | "grpc" | "ws" | "render";
84
85
  adapter: new () => KarinAdapter;
85
86
  path: string;
86
87
  }[] | (new () => KarinAdapter)[];
@@ -99,20 +100,6 @@ export declare const listener: {
99
100
  }): Promise<{
100
101
  message_id: string;
101
102
  }>;
102
- [EventEmitter.captureRejectionSymbol]?<K>(error: Error, event: string | symbol, ...args: any[]): void;
103
- addListener<K_1>(eventName: string | symbol, listener: (...args: any[]) => void): any;
104
- on<K_2>(eventName: string | symbol, listener: (...args: any[]) => void): any;
105
- once<K_3>(eventName: string | symbol, listener: (...args: any[]) => void): any;
106
- removeListener<K_4>(eventName: string | symbol, listener: (...args: any[]) => void): any;
107
- off<K_5>(eventName: string | symbol, listener: (...args: any[]) => void): any;
108
- removeAllListeners(eventName?: string | symbol | undefined): any;
109
- setMaxListeners(n: number): any;
110
- getMaxListeners(): number;
111
- listeners<K_6>(eventName: string | symbol): Function[];
112
- rawListeners<K_7>(eventName: string | symbol): Function[];
113
- emit<K_8>(eventName: string | symbol, ...args: any[]): boolean;
114
- listenerCount<K_9>(eventName: string | symbol, listener?: Function | undefined): number;
115
- prependListener<K_10>(eventName: string | symbol, listener: (...args: any[]) => void): any;
116
- prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
117
- eventNames(): (string | symbol)[];
118
- };
103
+ }
104
+ export declare const listener: Listeners;
105
+ export {};
@@ -5,7 +5,7 @@ import { MessageHandler } from '../event/message.handler.js'
5
5
  /**
6
6
  * 监听器管理
7
7
  */
8
- export const listener = new (class Listeners extends EventEmitter {
8
+ class Listeners extends EventEmitter {
9
9
  /**
10
10
  * Bot索引
11
11
  * @type - Bot索引
@@ -183,4 +183,5 @@ export const listener = new (class Listeners extends EventEmitter {
183
183
  }
184
184
  return result
185
185
  }
186
- })()
186
+ }
187
+ export const listener = new Listeners()
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "private": false,
5
5
  "description": "基于 Kritor 进行开发的nodejs机器人框架",
6
6
  "homepage": "https://github.com/KarinJS/Karin",
7
- "types": "./lib/index.d.ts",
8
7
  "bugs": {
9
8
  "url": "https://github.com/KarinJS/Karin/issues"
10
9
  },
@@ -19,6 +18,7 @@
19
18
  "#Karin": "./lib/index.js"
20
19
  },
21
20
  "main": "./lib/index.js",
21
+ "types": "./lib/index.d.ts",
22
22
  "bin": {
23
23
  "init": "./lib/tools/init.js"
24
24
  },
@@ -41,12 +41,12 @@
41
41
  "build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json && npm run fix && npm run cp",
42
42
  "cp": "cp ./lib/modules.d.ts ./modules.d.ts && cp ./lib/modules.js ./modules.js && cp ./src/utils/kritor-proto.d.ts ./lib/utils/kritor-proto.d.ts",
43
43
  "delete": "pm2 delete ./config/config/pm2.yaml",
44
+ "dev": "tsx ./lib/index.js --dev",
44
45
  "fix": "eslint lib/**/*.js --fix",
45
46
  "fix:all": "eslint lib/**/*.js --fix && eslint src/**/*.ts --fix",
46
47
  "init": "node lib/tools/install.js",
47
48
  "init:dev": "node lib/tools/install.js",
48
49
  "init:pack": "node lib/tools/install.js",
49
- "dev": "tsx ./lib/index.js --dev",
50
50
  "log": "node lib/tools/pm2Log.js",
51
51
  "monit": "pm2 monit",
52
52
  "pub": "npm publish --access public",
@@ -88,6 +88,13 @@
88
88
  "tsx": "^4.15.7",
89
89
  "typescript": "^4.9.5"
90
90
  },
91
+ "bundledDependencies": [
92
+ "@types/express",
93
+ "@types/lodash",
94
+ "@types/node",
95
+ "@types/node-schedule",
96
+ "@types/ws"
97
+ ],
91
98
  "engines": {
92
99
  "node": ">=18"
93
100
  },