node-karin 0.6.7 → 0.6.9

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.
@@ -287,7 +287,9 @@ export declare class AdapterOneBot11 implements KarinAdapter {
287
287
  SetInvitedJoinGroupResult(): Promise<void>;
288
288
  UploadPrivateFile(): Promise<void>;
289
289
  UploadGroupFile(): Promise<void>;
290
- sendForwardMessage(): Promise<{}>;
290
+ sendForwardMessage(contact: contact, elements: KarinNodeElement[]): Promise<{
291
+ message_id: any;
292
+ }>;
291
293
  /**
292
294
  * 发送API请求
293
295
  * @param action - API断点
@@ -1236,8 +1236,12 @@ export class AdapterOneBot11 {
1236
1236
  async SetInvitedJoinGroupResult() { }
1237
1237
  async UploadPrivateFile() { }
1238
1238
  async UploadGroupFile() { }
1239
- async sendForwardMessage() {
1240
- return {};
1239
+ async sendForwardMessage(contact, elements) {
1240
+ let message_id = await this.UploadForwardMessage(contact, elements);
1241
+ if (this.version.name === 'Lagrange.OneBot') {
1242
+ message_id = await this.SendMessage(contact, [segment.forward(message_id)]);
1243
+ }
1244
+ return { message_id };
1241
1245
  }
1242
1246
  /**
1243
1247
  * 发送API请求
package/lib/index.d.ts CHANGED
@@ -57,7 +57,6 @@ export declare const Cfg: {
57
57
  };
58
58
  export declare const Update: {
59
59
  dir: string;
60
- getPlugins(): string[];
61
60
  update(path: string, cmd?: string, time?: number): Promise<{
62
61
  status: string;
63
62
  data: string;
@@ -1,6 +1,5 @@
1
1
  import schedule from 'node-schedule';
2
- import { KarinNodeElement } from './element.js';
3
- import { Reply, replyCallback } from './reply.js';
2
+ import { Reply, replyCallback, replyForward } from './reply.js';
4
3
  import { EventType, Event, Permission, SubEvent, KarinMessageEvent, KarinNoticeEvent, KarinRequestEvent } from './event.js';
5
4
  /**
6
5
  * - 插件根目录名称
@@ -175,9 +174,7 @@ export interface PluginType {
175
174
  /**
176
175
  * - 快速回复合并转发
177
176
  */
178
- replyForward: (msg: KarinNodeElement[]) => Promise<{
179
- message_id?: string;
180
- }>;
177
+ replyForward: replyForward;
181
178
  /**
182
179
  * - 构建上下文键
183
180
  */
@@ -10,7 +10,8 @@ export interface KarinRenderType {
10
10
  /**
11
11
  * - vue文件路径 与file二选一
12
12
  */
13
- vue?: string;
13
+ vue?: boolean;
14
+ props?: any;
14
15
  /**
15
16
  * - 模板名称
16
17
  */
@@ -1,4 +1,4 @@
1
- import { KarinElement } from './element.js';
1
+ import { KarinElement, KarinNodeElement } from './element.js';
2
2
  export type Reply = (
3
3
  /**
4
4
  * 发送的消息
@@ -38,3 +38,6 @@ elements: KarinElement[],
38
38
  retry_count?: number) => Promise<{
39
39
  message_id?: string;
40
40
  }>;
41
+ export type replyForward = (msg: KarinNodeElement[]) => Promise<{
42
+ message_id?: string;
43
+ }>;
@@ -1,11 +1,6 @@
1
1
  import fs from 'fs';
2
2
  export declare const update: {
3
3
  dir: string;
4
- /**
5
- * 获取插件列表 拥有packageon才会被识别
6
- * @returns {string[]}
7
- */
8
- getPlugins(): string[];
9
4
  /**
10
5
  * 更新框架或插件
11
6
  * @param path - 插件相对路径
@@ -6,23 +6,6 @@ export const update = new (class Update {
6
6
  this.dir = './plugins'
7
7
  }
8
8
 
9
- /**
10
- * 获取插件列表 拥有packageon才会被识别
11
- * @returns {string[]}
12
- */
13
- getPlugins () {
14
- const list = []
15
- const files = fs.readdirSync(this.dir, { withFileTypes: true })
16
- /** 忽略非文件夹、非karin-plugin-开头的文件夹或/karin-adapter-开头的文件夹 */
17
- files.forEach(file => {
18
- if (!file.isDirectory()) { return }
19
- if (!file.name.startsWith('karin-plugin-') && !file.name.startsWith('karin-adapter-')) { return }
20
- if (!fs.existsSync(`${this.dir}/${file.name}/packageon`)) { return }
21
- list.push(file.name)
22
- })
23
- return list
24
- }
25
-
26
9
  /**
27
10
  * 更新框架或插件
28
11
  * @param path - 插件相对路径
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "private": false,
5
5
  "description": "基于 Kritor 进行开发的nodejs机器人框架",
6
6
  "homepage": "https://github.com/KarinJS/Karin",