node-karin 0.6.6 → 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 +10 -2
- package/lib/adapter/onebot/onebot11.js +15 -12
- package/lib/index.d.ts +0 -1
- package/lib/types/onebots11.d.ts +18 -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
|
@@ -267,6 +267,13 @@ export declare class AdapterOneBot11 implements KarinAdapter {
|
|
|
267
267
|
id: number;
|
|
268
268
|
description: string;
|
|
269
269
|
}[]>;
|
|
270
|
+
/**
|
|
271
|
+
* 对消息进行表情回应
|
|
272
|
+
* @param contact - 联系人信息
|
|
273
|
+
* @param message_id - 消息ID
|
|
274
|
+
* @param face_id - 表情ID
|
|
275
|
+
*/
|
|
276
|
+
ReactMessageWithEmoji(contact: contact, message_id: string, face_id: number, is_set?: boolean): Promise<any>;
|
|
270
277
|
/**
|
|
271
278
|
* 获取版本信息
|
|
272
279
|
*/
|
|
@@ -278,10 +285,11 @@ export declare class AdapterOneBot11 implements KarinAdapter {
|
|
|
278
285
|
SetFriendApplyResult(): Promise<void>;
|
|
279
286
|
SetGroupApplyResult(): Promise<void>;
|
|
280
287
|
SetInvitedJoinGroupResult(): Promise<void>;
|
|
281
|
-
ReactMessageWithEmoji(): Promise<void>;
|
|
282
288
|
UploadPrivateFile(): Promise<void>;
|
|
283
289
|
UploadGroupFile(): Promise<void>;
|
|
284
|
-
sendForwardMessage(): Promise<{
|
|
290
|
+
sendForwardMessage(contact: contact, elements: KarinNodeElement[]): Promise<{
|
|
291
|
+
message_id: any;
|
|
292
|
+
}>;
|
|
285
293
|
/**
|
|
286
294
|
* 发送API请求
|
|
287
295
|
* @param action - API断点
|
|
@@ -1208,15 +1208,15 @@ export class AdapterOneBot11 {
|
|
|
1208
1208
|
});
|
|
1209
1209
|
return result;
|
|
1210
1210
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1211
|
+
/**
|
|
1212
|
+
* 对消息进行表情回应
|
|
1213
|
+
* @param contact - 联系人信息
|
|
1214
|
+
* @param message_id - 消息ID
|
|
1215
|
+
* @param face_id - 表情ID
|
|
1216
|
+
*/
|
|
1217
|
+
async ReactMessageWithEmoji(contact, message_id, face_id, is_set = true) {
|
|
1218
|
+
return await this.SendApi('set_msg_emoji_like', { message_id, emoji_id: face_id, is_set });
|
|
1219
|
+
}
|
|
1220
1220
|
/**
|
|
1221
1221
|
* 获取版本信息
|
|
1222
1222
|
*/
|
|
@@ -1234,11 +1234,14 @@ export class AdapterOneBot11 {
|
|
|
1234
1234
|
async SetFriendApplyResult() { }
|
|
1235
1235
|
async SetGroupApplyResult() { }
|
|
1236
1236
|
async SetInvitedJoinGroupResult() { }
|
|
1237
|
-
async ReactMessageWithEmoji() { }
|
|
1238
1237
|
async UploadPrivateFile() { }
|
|
1239
1238
|
async UploadGroupFile() { }
|
|
1240
|
-
async sendForwardMessage() {
|
|
1241
|
-
|
|
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 };
|
|
1242
1245
|
}
|
|
1243
1246
|
/**
|
|
1244
1247
|
* 发送API请求
|
package/lib/index.d.ts
CHANGED
package/lib/types/onebots11.d.ts
CHANGED
|
@@ -848,7 +848,7 @@ export type ByPostType<T extends EventPostType> = Extract<OneBot11Event, {
|
|
|
848
848
|
/**
|
|
849
849
|
* - OneBot11公开Api
|
|
850
850
|
*/
|
|
851
|
-
export type OneBot11Api = 'send_private_msg' | 'send_group_msg' | 'send_msg' | 'delete_msg' | 'get_msg' | 'get_forward_msg' | 'send_like' | 'set_group_kick' | 'set_group_ban' | 'set_group_anonymous_ban' | 'set_group_whole_ban' | 'set_group_admin' | 'set_group_anonymous' | 'set_group_card' | 'set_group_name' | 'set_group_leave' | 'set_group_special_title' | 'set_friend_add_request' | 'set_group_add_request' | 'get_login_info' | 'get_stranger_info' | 'get_friend_list' | 'get_group_info' | 'get_group_list' | 'get_group_member_info' | 'get_group_member_list' | 'get_group_honor_info' | 'get_cookies' | 'get_csrf_token' | 'get_credentials' | 'get_record' | 'get_image' | 'can_send_image' | 'can_send_record' | 'get_status' | 'get_version_info' | 'set_restart' | 'clean_cache' | 'get_version' | 'send_forward_msg' | 'get_friend_msg_history' | 'get_group_msg_history';
|
|
851
|
+
export type OneBot11Api = 'send_private_msg' | 'send_group_msg' | 'send_msg' | 'delete_msg' | 'get_msg' | 'get_forward_msg' | 'send_like' | 'set_group_kick' | 'set_group_ban' | 'set_group_anonymous_ban' | 'set_group_whole_ban' | 'set_group_admin' | 'set_group_anonymous' | 'set_group_card' | 'set_group_name' | 'set_group_leave' | 'set_group_special_title' | 'set_friend_add_request' | 'set_group_add_request' | 'get_login_info' | 'get_stranger_info' | 'get_friend_list' | 'get_group_info' | 'get_group_list' | 'get_group_member_info' | 'get_group_member_list' | 'get_group_honor_info' | 'get_cookies' | 'get_csrf_token' | 'get_credentials' | 'get_record' | 'get_image' | 'can_send_image' | 'can_send_record' | 'get_status' | 'get_version_info' | 'set_restart' | 'clean_cache' | 'get_version' | 'send_forward_msg' | 'get_friend_msg_history' | 'get_group_msg_history' | 'set_msg_emoji_like';
|
|
852
852
|
/**
|
|
853
853
|
* - OneBot11公开Api参数 params
|
|
854
854
|
*/
|
|
@@ -1362,6 +1362,23 @@ export type OneBot11ApiParams = {
|
|
|
1362
1362
|
*/
|
|
1363
1363
|
message_count: number;
|
|
1364
1364
|
};
|
|
1365
|
+
/**
|
|
1366
|
+
* - 对消息进行表情回应
|
|
1367
|
+
*/
|
|
1368
|
+
set_msg_emoji_like: {
|
|
1369
|
+
/**
|
|
1370
|
+
* - 需要回应的消息 ID
|
|
1371
|
+
*/
|
|
1372
|
+
message_id: string;
|
|
1373
|
+
/**
|
|
1374
|
+
* - 回应的表情 ID
|
|
1375
|
+
*/
|
|
1376
|
+
emoji_id: number;
|
|
1377
|
+
/**
|
|
1378
|
+
* - 设置、取消
|
|
1379
|
+
*/
|
|
1380
|
+
is_set: boolean;
|
|
1381
|
+
};
|
|
1365
1382
|
};
|
|
1366
1383
|
/**
|
|
1367
1384
|
* - OneBot11公开Api与参数映射
|
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 - 插件相对路径
|