node-karin 0.6.17 → 0.6.18

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.
@@ -56,7 +56,10 @@ export default class AdapterKritor implements KarinAdapter {
56
56
  * @param elements - 消息元素
57
57
  * @param retry_count - 重试次数
58
58
  */
59
- SendMessage(contact: contact, elements: KarinElement[], retry_count?: number): Promise<kritor.message.SendMessageResponse>;
59
+ SendMessage(contact: contact, elements: KarinElement[], retry_count?: number): Promise<{
60
+ message_id: string;
61
+ message_time: number;
62
+ }>;
60
63
  /**
61
64
  * 撤回消息
62
65
  * @param contact - 联系人
@@ -338,7 +338,10 @@ export default class AdapterKritor {
338
338
  * 响应解码
339
339
  */
340
340
  const response = kritor[type][`${cmd}Response`].decode(res.buf);
341
- return response;
341
+ return {
342
+ message_id: response.message_id,
343
+ message_time: Number(response.message_time),
344
+ };
342
345
  }
343
346
  /**
344
347
  * 撤回消息
@@ -1,7 +1,7 @@
1
1
  import chokidar from 'chokidar';
2
2
  import schedule from 'node-schedule';
3
3
  import { Plugin } from './plugin.js';
4
- import { PluginApps, PluginTask, dirName, fileName, AppInfo } from '../types/index.js';
4
+ import { PluginApps, PluginTask, dirName, fileName, AppInfo, NewPlugin } from '../types/index.js';
5
5
  declare class PluginLoader {
6
6
  dir: './plugins';
7
7
  dirPath: string;
@@ -53,7 +53,7 @@ declare class PluginLoader {
53
53
  * - 定时任务
54
54
  */
55
55
  task: Array<PluginTask & {
56
- App: new () => Plugin;
56
+ App: NewPlugin;
57
57
  schedule?: schedule.Job;
58
58
  file: {
59
59
  dir: dirName;
@@ -118,7 +118,7 @@ declare class PluginLoader {
118
118
  /**
119
119
  * 新增task
120
120
  */
121
- addTask(dir: dirName, name: fileName, index: number, Class: Plugin, App: new () => Plugin): Promise<void>;
121
+ addTask(dir: dirName, name: fileName, index: number, Class: Plugin, App: NewPlugin): Promise<void>;
122
122
  /**
123
123
  * 新增accept、handler
124
124
  */
@@ -1,7 +1,8 @@
1
1
  import schedule from 'node-schedule';
2
+ import { Plugin } from '../core/index.js';
2
3
  import { Reply, replyCallback, replyForward } from './reply.js';
3
4
  import { EventType, Event, Permission, SubEvent, KarinMessageEvent, KarinNoticeEvent, KarinRequestEvent } from './event.js';
4
- import { Plugin } from '../core/index.js';
5
+ import { KarinMessage } from '../event/index.js';
5
6
  /**
6
7
  * - 插件根目录名称
7
8
  * - 例如: karin-plugin-example
@@ -272,3 +273,7 @@ export interface PluginApps {
272
273
  */
273
274
  handler: Array<PluginHandler>;
274
275
  }
276
+ /**
277
+ * 未实例化的插件
278
+ */
279
+ export type NewPlugin = new (e?: KarinMessage) => Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "0.6.17",
3
+ "version": "0.6.18",
4
4
  "private": false,
5
5
  "description": "基于 Kritor 进行开发的nodejs机器人框架",
6
6
  "homepage": "https://github.com/KarinJS/Karin",