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.
- package/lib/adapter/onebot/onebot11.d.ts +3 -1
- package/lib/adapter/onebot/onebot11.js +6 -2
- package/lib/index.d.ts +0 -1
- package/lib/types/plugin.d.ts +2 -5
- package/lib/types/render.d.ts +2 -1
- package/lib/types/reply.d.ts +4 -1
- package/lib/utils/update.d.ts +0 -5
- package/lib/utils/update.js +0 -17
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import schedule from 'node-schedule';
|
|
2
|
-
import {
|
|
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:
|
|
179
|
-
message_id?: string;
|
|
180
|
-
}>;
|
|
177
|
+
replyForward: replyForward;
|
|
181
178
|
/**
|
|
182
179
|
* - 构建上下文键
|
|
183
180
|
*/
|
package/lib/types/render.d.ts
CHANGED
package/lib/types/reply.d.ts
CHANGED
|
@@ -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
|
+
}>;
|
package/lib/utils/update.d.ts
CHANGED
package/lib/utils/update.js
CHANGED
|
@@ -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 - 插件相对路径
|