node-karin 0.12.13 → 0.12.15
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/input/index.d.ts +1 -1
- package/lib/adapter/input/index.js +1 -1
- package/lib/adapter/onebot/11/event.js +90 -84
- package/lib/adapter/onebot/11/index.d.ts +89 -127
- package/lib/adapter/onebot/11/index.js +192 -254
- package/lib/cli/index.js +2 -2
- package/lib/core/init/config.js +1 -1
- package/lib/core/karin/karin.d.ts +21 -30
- package/lib/core/karin/karin.js +7 -9
- package/lib/core/listener/listener.js +11 -11
- package/lib/core/plugin/base.d.ts +7 -21
- package/lib/core/plugin/base.js +2 -6
- package/lib/core/plugin/loader.d.ts +5 -15
- package/lib/core/plugin/loader.js +5 -15
- package/lib/core/server/server.js +4 -4
- package/lib/event/handler/base.d.ts +1 -3
- package/lib/event/handler/base.js +1 -3
- package/lib/event/handler/message.js +9 -3
- package/lib/event/handler/notice.js +38 -32
- package/lib/event/handler/request.js +6 -6
- package/lib/index.d.ts +6 -0
- package/lib/index.js +6 -0
- package/lib/modules.d.ts +2 -2
- package/lib/modules.js +3 -2
- package/lib/types/adapter/accept.d.ts +24 -0
- package/lib/types/adapter/accept.js +1 -0
- package/lib/types/adapter/api.d.ts +88 -264
- package/lib/types/adapter/base.d.ts +3 -3
- package/lib/types/config/config.d.ts +4 -12
- package/lib/types/element/element.d.ts +119 -349
- package/lib/types/element/qqbot.d.ts +4 -12
- package/lib/types/event/contact.d.ts +6 -12
- package/lib/types/event/event.d.ts +59 -163
- package/lib/types/event/message.d.ts +11 -31
- package/lib/types/event/message.js +10 -12
- package/lib/types/event/notice.d.ts +118 -325
- package/lib/types/event/notice.js +8 -10
- package/lib/types/event/request.d.ts +29 -66
- package/lib/types/event/request.js +8 -10
- package/lib/types/event/sender.d.ts +7 -21
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/onebot11/api.d.ts +49 -49
- package/lib/types/onebot11/event.d.ts +131 -347
- package/lib/types/onebot11/params.d.ts +184 -456
- package/lib/types/onebot11/response.d.ts +159 -381
- package/lib/types/onebot11/segment.d.ts +25 -75
- package/lib/types/onebot11/sender.d.ts +13 -39
- package/lib/types/plugin/app.d.ts +7 -11
- package/lib/types/plugin/plugin.d.ts +55 -165
- package/lib/types/render/render.d.ts +16 -48
- package/lib/utils/common/common.js +4 -2
- package/lib/utils/config/config.js +1 -1
- package/lib/utils/core/logger.js +3 -3
- package/lib/utils/core/segment.d.ts +28 -59
- package/lib/utils/core/segment.js +26 -30
- package/lib/utils/tools/restart.d.ts +3 -3
- package/lib/utils/tools/restart.js +5 -5
- package/package.json +1 -2
|
@@ -9,9 +9,7 @@ import { AdapterConvertKarin, KarinConvertAdapter } from './convert.js';
|
|
|
9
9
|
* @extends KarinAdapter
|
|
10
10
|
*/
|
|
11
11
|
export class AdapterOneBot11 {
|
|
12
|
-
/**
|
|
13
|
-
* - 重连次数 仅正向ws使用
|
|
14
|
-
*/
|
|
12
|
+
/** 重连次数 仅正向ws使用 */
|
|
15
13
|
index;
|
|
16
14
|
socket;
|
|
17
15
|
account;
|
|
@@ -28,13 +26,13 @@ export class AdapterOneBot11 {
|
|
|
28
26
|
*/
|
|
29
27
|
async server(socket, request) {
|
|
30
28
|
this.socket = socket;
|
|
31
|
-
const
|
|
29
|
+
const selfId = String(request.headers['x-self-id']);
|
|
32
30
|
const connect = 'ws://' + request.headers.host + request.url;
|
|
33
|
-
this.account.uin =
|
|
34
|
-
this.account.uid =
|
|
31
|
+
this.account.uin = selfId;
|
|
32
|
+
this.account.uid = selfId;
|
|
35
33
|
this.adapter.connect = connect;
|
|
36
34
|
this.adapter.sub_type = 'server';
|
|
37
|
-
this.logger('info', `[反向WS][onebot11-${request.headers.upgrade}][${
|
|
35
|
+
this.logger('info', `[反向WS][onebot11-${request.headers.upgrade}][${selfId}] ` + logger.green(connect));
|
|
38
36
|
await this.#initListener(connect);
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
@@ -104,16 +102,16 @@ export class AdapterOneBot11 {
|
|
|
104
102
|
async getSelf() {
|
|
105
103
|
const data = await this.GetCurrentAccount();
|
|
106
104
|
try {
|
|
107
|
-
const { app_name, version } = await this.GetVersion();
|
|
108
|
-
this.version.name =
|
|
109
|
-
this.version.app_name =
|
|
105
|
+
const { app_name: appName, version } = await this.GetVersion();
|
|
106
|
+
this.version.name = appName;
|
|
107
|
+
this.version.app_name = appName;
|
|
110
108
|
this.version.version = version;
|
|
111
109
|
}
|
|
112
110
|
catch (e) {
|
|
113
111
|
/** 兼容onebots */
|
|
114
|
-
const { app_name, version } = await this.SendApi("get_version" /* OB11Api
|
|
115
|
-
this.version.name =
|
|
116
|
-
this.version.app_name =
|
|
112
|
+
const { app_name: appName, version } = await this.SendApi("get_version" /* OB11Api.getVersion */);
|
|
113
|
+
this.version.name = appName;
|
|
114
|
+
this.version.app_name = appName;
|
|
117
115
|
this.version.version = version;
|
|
118
116
|
}
|
|
119
117
|
this.account.uid = data.account_uid;
|
|
@@ -156,13 +154,13 @@ export class AdapterOneBot11 {
|
|
|
156
154
|
}
|
|
157
155
|
/**
|
|
158
156
|
* 获取群头像
|
|
159
|
-
* @param
|
|
157
|
+
* @param groupId - 群号
|
|
160
158
|
* @param size - 头像大小,默认`0`
|
|
161
159
|
* @param history - 历史头像记录,默认`0`,若要获取历史群头像则填写1,2,3...
|
|
162
160
|
* @returns - 群头像的url地址
|
|
163
161
|
*/
|
|
164
|
-
getGroupAvatarUrl(
|
|
165
|
-
return `https://p.qlogo.cn/gh/${
|
|
162
|
+
getGroupAvatarUrl(groupId, size = 0, history = 0) {
|
|
163
|
+
return `https://p.qlogo.cn/gh/${groupId}/${groupId}${history ? '_' + history : ''}/` + size;
|
|
166
164
|
}
|
|
167
165
|
/**
|
|
168
166
|
* 发送消息
|
|
@@ -175,14 +173,14 @@ export class AdapterOneBot11 {
|
|
|
175
173
|
const { scene, peer } = contact;
|
|
176
174
|
let res;
|
|
177
175
|
if (scene === "group" /* Scene.Group */) {
|
|
178
|
-
res = await this.SendApi("send_msg" /* OB11Api
|
|
176
|
+
res = await this.SendApi("send_msg" /* OB11Api.sendMsg */, {
|
|
179
177
|
message_type: "group" /* MessageType.Group */,
|
|
180
178
|
group_id: Number(peer),
|
|
181
179
|
message: this.KarinConvertAdapter(elements),
|
|
182
180
|
});
|
|
183
181
|
}
|
|
184
182
|
else {
|
|
185
|
-
res = await this.SendApi("send_msg" /* OB11Api
|
|
183
|
+
res = await this.SendApi("send_msg" /* OB11Api.sendMsg */, {
|
|
186
184
|
message_type: "private" /* MessageType.Private */,
|
|
187
185
|
user_id: Number(peer),
|
|
188
186
|
message: this.KarinConvertAdapter(elements),
|
|
@@ -203,7 +201,7 @@ export class AdapterOneBot11 {
|
|
|
203
201
|
throw new Error('elements should be all node type');
|
|
204
202
|
}
|
|
205
203
|
const { scene, peer } = contact;
|
|
206
|
-
const
|
|
204
|
+
const messageType = scene === 'group' ? 'group_id' : 'user_id';
|
|
207
205
|
const messages = [];
|
|
208
206
|
const selfUin = this.account.uin;
|
|
209
207
|
const selfNick = this.account.name;
|
|
@@ -214,13 +212,13 @@ export class AdapterOneBot11 {
|
|
|
214
212
|
}
|
|
215
213
|
else {
|
|
216
214
|
const content = this.KarinConvertAdapter(i.content);
|
|
217
|
-
const
|
|
215
|
+
const userId = String(i.user_id || selfUin);
|
|
218
216
|
const nickname = String(i.nickname || selfNick);
|
|
219
|
-
messages.push({ type, data: { user_id, nickname, content } });
|
|
217
|
+
messages.push({ type, data: { user_id: userId, nickname, content } });
|
|
220
218
|
}
|
|
221
219
|
}
|
|
222
|
-
const params = { [
|
|
223
|
-
return await this.SendApi("send_forward_msg" /* OB11Api
|
|
220
|
+
const params = { [messageType]: String(peer), messages };
|
|
221
|
+
return await this.SendApi("send_forward_msg" /* OB11Api.sendForwardMsg */, params);
|
|
224
222
|
}
|
|
225
223
|
/**
|
|
226
224
|
* 通过资源id发送转发消息
|
|
@@ -231,14 +229,14 @@ export class AdapterOneBot11 {
|
|
|
231
229
|
let res;
|
|
232
230
|
const { scene, peer } = contact;
|
|
233
231
|
if (scene === "group" /* Scene.Group */) {
|
|
234
|
-
res = await this.SendApi("send_msg" /* OB11Api
|
|
232
|
+
res = await this.SendApi("send_msg" /* OB11Api.sendMsg */, {
|
|
235
233
|
message_type: "group" /* MessageType.Group */,
|
|
236
234
|
group_id: Number(peer),
|
|
237
235
|
message: [{ type: "forward" /* OB11SegmentType.Forward */, data: { id } }],
|
|
238
236
|
});
|
|
239
237
|
}
|
|
240
238
|
else {
|
|
241
|
-
res = await this.SendApi("send_msg" /* OB11Api
|
|
239
|
+
res = await this.SendApi("send_msg" /* OB11Api.sendMsg */, {
|
|
242
240
|
message_type: "private" /* MessageType.Private */,
|
|
243
241
|
user_id: Number(peer),
|
|
244
242
|
message: [{ type: "forward" /* OB11SegmentType.Forward */, data: { id } }],
|
|
@@ -249,11 +247,11 @@ export class AdapterOneBot11 {
|
|
|
249
247
|
/**
|
|
250
248
|
* 撤回消息
|
|
251
249
|
* @param _contact - ob11无需提供contact参数
|
|
252
|
-
* @param
|
|
250
|
+
* @param messageId - 消息ID
|
|
253
251
|
*/
|
|
254
|
-
async RecallMessage(_contact,
|
|
252
|
+
async RecallMessage(_contact, messageId) {
|
|
255
253
|
try {
|
|
256
|
-
await this.SendApi("delete_msg" /* OB11Api
|
|
254
|
+
await this.SendApi("delete_msg" /* OB11Api.deleteMsg */, { message_id: Number(messageId) });
|
|
257
255
|
return true;
|
|
258
256
|
}
|
|
259
257
|
catch {
|
|
@@ -263,10 +261,10 @@ export class AdapterOneBot11 {
|
|
|
263
261
|
/**
|
|
264
262
|
* 获取消息
|
|
265
263
|
* @param contact - 联系人信息
|
|
266
|
-
* @param
|
|
264
|
+
* @param messageId - 消息ID
|
|
267
265
|
*/
|
|
268
|
-
async GetMessage(contact,
|
|
269
|
-
const res = await this.SendApi("get_msg" /* OB11Api
|
|
266
|
+
async GetMessage(contact, messageId) {
|
|
267
|
+
const res = await this.SendApi("get_msg" /* OB11Api.getMsg */, { message_id: Number(messageId) });
|
|
270
268
|
return {
|
|
271
269
|
time: res.time,
|
|
272
270
|
message_id: res.message_id + '',
|
|
@@ -288,24 +286,24 @@ export class AdapterOneBot11 {
|
|
|
288
286
|
* 获取msg_id获取历史消息
|
|
289
287
|
* @description 此api各平台实现不同
|
|
290
288
|
*/
|
|
291
|
-
async GetHistoryMessage(contact,
|
|
292
|
-
const
|
|
289
|
+
async GetHistoryMessage(contact, startMessageId, count = 1) {
|
|
290
|
+
const messageSeq = (await this.GetMessage(contact, startMessageId)).message_seq;
|
|
293
291
|
// 先拿到消息的seq
|
|
294
292
|
let options;
|
|
295
293
|
if (this.version.name === 'Lagrange.OneBot') {
|
|
296
|
-
options = { message_id: Number(
|
|
294
|
+
options = { message_id: Number(startMessageId), message_count: count };
|
|
297
295
|
}
|
|
298
296
|
else {
|
|
299
|
-
options = { message_seq, message_count: count };
|
|
297
|
+
options = { message_seq: messageSeq, message_count: count };
|
|
300
298
|
}
|
|
301
299
|
let res;
|
|
302
300
|
if (contact.scene === 'group') {
|
|
303
301
|
options.group_id = Number(contact.peer);
|
|
304
|
-
res = await this.SendApi("get_group_msg_history" /* OB11Api
|
|
302
|
+
res = await this.SendApi("get_group_msg_history" /* OB11Api.getGroupMsgHistory */, options);
|
|
305
303
|
}
|
|
306
304
|
else {
|
|
307
305
|
options.user_id = Number(contact.peer);
|
|
308
|
-
res = await this.SendApi("get_friend_msg_history" /* OB11Api
|
|
306
|
+
res = await this.SendApi("get_friend_msg_history" /* OB11Api.getFriendMsgHistory */, options);
|
|
309
307
|
}
|
|
310
308
|
const all = [];
|
|
311
309
|
const elements = this.AdapterConvertKarin(res);
|
|
@@ -333,13 +331,13 @@ export class AdapterOneBot11 {
|
|
|
333
331
|
}
|
|
334
332
|
/**
|
|
335
333
|
* 发送好友赞
|
|
336
|
-
* @param
|
|
337
|
-
* @param
|
|
334
|
+
* @param targetId - 用户ID
|
|
335
|
+
* @param voteCount - 赞的次数,默认为`10`
|
|
338
336
|
*/
|
|
339
|
-
async VoteUser(
|
|
340
|
-
const
|
|
337
|
+
async VoteUser(targetId, voteCount = 10) {
|
|
338
|
+
const userId = Number(targetId);
|
|
341
339
|
try {
|
|
342
|
-
await this.SendApi("send_like" /* OB11Api
|
|
340
|
+
await this.SendApi("send_like" /* OB11Api.sendLike */, { user_id: userId, times: voteCount });
|
|
343
341
|
return true;
|
|
344
342
|
}
|
|
345
343
|
catch {
|
|
@@ -348,11 +346,15 @@ export class AdapterOneBot11 {
|
|
|
348
346
|
}
|
|
349
347
|
/**
|
|
350
348
|
* 群组踢人
|
|
349
|
+
* @param groupId - 群号
|
|
350
|
+
* @param targetId - 用户ID
|
|
351
|
+
* @param rejectAddRequest - 是否拒绝此人的加群请求
|
|
352
|
+
* @param kickReason - 踢人理由
|
|
351
353
|
*/
|
|
352
|
-
async KickMember(
|
|
353
|
-
const
|
|
354
|
+
async KickMember(groupId, targetId, rejectAddRequest = false, kickReason = '') {
|
|
355
|
+
const userId = Number(targetId);
|
|
354
356
|
try {
|
|
355
|
-
await this.SendApi("set_group_kick" /* OB11Api
|
|
357
|
+
await this.SendApi("set_group_kick" /* OB11Api.setGroupKick */, { group_id: Number(groupId), user_id: userId, reject_add_request: rejectAddRequest });
|
|
356
358
|
return true;
|
|
357
359
|
}
|
|
358
360
|
catch {
|
|
@@ -361,14 +363,14 @@ export class AdapterOneBot11 {
|
|
|
361
363
|
}
|
|
362
364
|
/**
|
|
363
365
|
* 禁言用户
|
|
364
|
-
* @param
|
|
365
|
-
* @param
|
|
366
|
+
* @param groupId - 群号
|
|
367
|
+
* @param targetId - 用户ID
|
|
366
368
|
* @param duration - 禁言时长,单位秒,0 表示取消禁言
|
|
367
369
|
*/
|
|
368
|
-
async BanMember(
|
|
369
|
-
const
|
|
370
|
+
async BanMember(groupId, targetId, duration) {
|
|
371
|
+
const userId = Number(targetId);
|
|
370
372
|
try {
|
|
371
|
-
await this.SendApi("set_group_ban" /* OB11Api
|
|
373
|
+
await this.SendApi("set_group_ban" /* OB11Api.setGroupBan */, { group_id: Number(groupId), user_id: userId, duration });
|
|
372
374
|
return true;
|
|
373
375
|
}
|
|
374
376
|
catch {
|
|
@@ -377,12 +379,12 @@ export class AdapterOneBot11 {
|
|
|
377
379
|
}
|
|
378
380
|
/**
|
|
379
381
|
* 群组全员禁言
|
|
380
|
-
* @param
|
|
381
|
-
* @param
|
|
382
|
+
* @param groupId - 群号
|
|
383
|
+
* @param isBan - 是否全员禁言
|
|
382
384
|
*/
|
|
383
|
-
async SetGroupWholeBan(
|
|
385
|
+
async SetGroupWholeBan(groupId, isBan = true) {
|
|
384
386
|
try {
|
|
385
|
-
await this.SendApi("set_group_whole_ban" /* OB11Api
|
|
387
|
+
await this.SendApi("set_group_whole_ban" /* OB11Api.setGroupWholeBan */, { group_id: Number(groupId), enable: isBan });
|
|
386
388
|
return true;
|
|
387
389
|
}
|
|
388
390
|
catch {
|
|
@@ -391,14 +393,14 @@ export class AdapterOneBot11 {
|
|
|
391
393
|
}
|
|
392
394
|
/**
|
|
393
395
|
* 设置群管理员
|
|
394
|
-
* @param
|
|
395
|
-
* @param
|
|
396
|
-
* @param
|
|
396
|
+
* @param groupId - 群号
|
|
397
|
+
* @param targetId - 目标用户ID
|
|
398
|
+
* @param isAdmin - 是否设置为管理员
|
|
397
399
|
*/
|
|
398
|
-
async SetGroupAdmin(
|
|
400
|
+
async SetGroupAdmin(groupId, targetId, isAdmin) {
|
|
399
401
|
try {
|
|
400
|
-
const
|
|
401
|
-
await this.SendApi("set_group_admin" /* OB11Api
|
|
402
|
+
const userId = Number(targetId);
|
|
403
|
+
await this.SendApi("set_group_admin" /* OB11Api.setGroupAdmin */, { group_id: Number(groupId), user_id: userId, enable: isAdmin });
|
|
402
404
|
return true;
|
|
403
405
|
}
|
|
404
406
|
catch {
|
|
@@ -407,14 +409,14 @@ export class AdapterOneBot11 {
|
|
|
407
409
|
}
|
|
408
410
|
/**
|
|
409
411
|
* 修改群名片
|
|
410
|
-
* @param
|
|
411
|
-
* @param
|
|
412
|
+
* @param groupId - 群号
|
|
413
|
+
* @param targetId - 目标用户ID
|
|
412
414
|
* @param card - 新名片
|
|
413
415
|
*/
|
|
414
|
-
async ModifyMemberCard(
|
|
416
|
+
async ModifyMemberCard(groupId, targetId, card) {
|
|
415
417
|
try {
|
|
416
|
-
const
|
|
417
|
-
await this.SendApi("set_group_card" /* OB11Api
|
|
418
|
+
const userId = Number(targetId);
|
|
419
|
+
await this.SendApi("set_group_card" /* OB11Api.setGroupCard */, { group_id: Number(groupId), user_id: userId, card });
|
|
418
420
|
return true;
|
|
419
421
|
}
|
|
420
422
|
catch {
|
|
@@ -423,12 +425,12 @@ export class AdapterOneBot11 {
|
|
|
423
425
|
}
|
|
424
426
|
/**
|
|
425
427
|
* 设置群名
|
|
426
|
-
* @param
|
|
427
|
-
* @param
|
|
428
|
+
* @param groupId - 群号
|
|
429
|
+
* @param groupName - 新群名
|
|
428
430
|
*/
|
|
429
|
-
async ModifyGroupName(
|
|
431
|
+
async ModifyGroupName(groupId, groupName) {
|
|
430
432
|
try {
|
|
431
|
-
await this.SendApi("set_group_name" /* OB11Api
|
|
433
|
+
await this.SendApi("set_group_name" /* OB11Api.setGroupName */, { group_id: Number(groupId), group_name: groupName });
|
|
432
434
|
return true;
|
|
433
435
|
}
|
|
434
436
|
catch {
|
|
@@ -437,12 +439,12 @@ export class AdapterOneBot11 {
|
|
|
437
439
|
}
|
|
438
440
|
/**
|
|
439
441
|
* 退出群组
|
|
440
|
-
* @param
|
|
441
|
-
* @param
|
|
442
|
+
* @param groupId - 群号
|
|
443
|
+
* @param isDismiss - 是否解散,如果登录号是群主,则仅在此项为 true 时能够解散
|
|
442
444
|
*/
|
|
443
|
-
async LeaveGroup(
|
|
445
|
+
async LeaveGroup(groupId, isDismiss = false) {
|
|
444
446
|
try {
|
|
445
|
-
await this.SendApi("set_group_leave" /* OB11Api
|
|
447
|
+
await this.SendApi("set_group_leave" /* OB11Api.setGroupLeave */, { group_id: Number(groupId), is_dismiss: isDismiss });
|
|
446
448
|
}
|
|
447
449
|
catch {
|
|
448
450
|
return false;
|
|
@@ -450,16 +452,16 @@ export class AdapterOneBot11 {
|
|
|
450
452
|
}
|
|
451
453
|
/**
|
|
452
454
|
* 设置群专属头衔
|
|
453
|
-
* @param
|
|
454
|
-
* @param
|
|
455
|
+
* @param groupId - 群号
|
|
456
|
+
* @param targetId - 目标用户ID
|
|
455
457
|
* @param special_title - 专属头衔
|
|
456
458
|
*/
|
|
457
|
-
async SetGroupUniqueTitle(
|
|
458
|
-
const
|
|
459
|
-
const
|
|
459
|
+
async SetGroupUniqueTitle(groupId, targetId, uniqueTitle) {
|
|
460
|
+
const userId = Number(targetId);
|
|
461
|
+
const specialTitle = uniqueTitle;
|
|
460
462
|
const duration = -1;
|
|
461
463
|
try {
|
|
462
|
-
await this.SendApi("set_group_special_title" /* OB11Api
|
|
464
|
+
await this.SendApi("set_group_special_title" /* OB11Api.setGroupSpecialTitle */, { group_id: Number(groupId), user_id: userId, special_title: specialTitle, duration });
|
|
463
465
|
}
|
|
464
466
|
catch {
|
|
465
467
|
return false;
|
|
@@ -469,7 +471,7 @@ export class AdapterOneBot11 {
|
|
|
469
471
|
* 获取登录号信息
|
|
470
472
|
*/
|
|
471
473
|
async GetCurrentAccount() {
|
|
472
|
-
const res = await this.SendApi("get_login_info" /* OB11Api
|
|
474
|
+
const res = await this.SendApi("get_login_info" /* OB11Api.getLoginInfo */);
|
|
473
475
|
return {
|
|
474
476
|
account_uid: res.user_id + '',
|
|
475
477
|
account_uin: res.user_id + '',
|
|
@@ -478,52 +480,32 @@ export class AdapterOneBot11 {
|
|
|
478
480
|
}
|
|
479
481
|
/**
|
|
480
482
|
* 获取陌生人信息 不支持批量获取 只支持一个
|
|
481
|
-
* @param
|
|
483
|
+
* @param targetId - 目标用户ID
|
|
482
484
|
*/
|
|
483
|
-
async GetStrangerProfileCard(
|
|
484
|
-
const
|
|
485
|
-
const res = await this.SendApi("get_stranger_info" /* OB11Api
|
|
485
|
+
async GetStrangerProfileCard(targetId) {
|
|
486
|
+
const userId = Number(targetId[0]);
|
|
487
|
+
const res = await this.SendApi("get_stranger_info" /* OB11Api.getStrangerInfo */, { user_id: userId, no_cache: true });
|
|
486
488
|
return [
|
|
487
489
|
{
|
|
488
|
-
/**
|
|
489
|
-
* - 用户UID
|
|
490
|
-
*/
|
|
490
|
+
/** 用户UID */
|
|
491
491
|
uid: res.user_id + '',
|
|
492
|
-
/**
|
|
493
|
-
* - 用户UIN
|
|
494
|
-
*/
|
|
492
|
+
/** 用户UIN */
|
|
495
493
|
uin: res.user_id + '',
|
|
496
|
-
/**
|
|
497
|
-
* - qid
|
|
498
|
-
*/
|
|
494
|
+
/** qid */
|
|
499
495
|
qid: '',
|
|
500
|
-
/**
|
|
501
|
-
* - 名称
|
|
502
|
-
*/
|
|
496
|
+
/** 名称 */
|
|
503
497
|
nick: res.nickname,
|
|
504
|
-
/**
|
|
505
|
-
* - 备注
|
|
506
|
-
*/
|
|
498
|
+
/** 备注 */
|
|
507
499
|
remark: '',
|
|
508
|
-
/**
|
|
509
|
-
* - 用户等级
|
|
510
|
-
*/
|
|
500
|
+
/** 用户等级 */
|
|
511
501
|
level: 0,
|
|
512
|
-
/**
|
|
513
|
-
* - 生日
|
|
514
|
-
*/
|
|
502
|
+
/** 生日 */
|
|
515
503
|
birthday: '',
|
|
516
|
-
/**
|
|
517
|
-
* - 登录天数
|
|
518
|
-
*/
|
|
504
|
+
/** 登录天数 */
|
|
519
505
|
login_day: 0,
|
|
520
|
-
/**
|
|
521
|
-
* - 点赞数
|
|
522
|
-
*/
|
|
506
|
+
/** 点赞数 */
|
|
523
507
|
vote_cnt: 0,
|
|
524
|
-
/**
|
|
525
|
-
* - 学校是否已核实
|
|
526
|
-
*/
|
|
508
|
+
/** 学校是否已核实 */
|
|
527
509
|
is_school_verified: undefined,
|
|
528
510
|
/**
|
|
529
511
|
* - 年龄
|
|
@@ -564,49 +546,29 @@ export class AdapterOneBot11 {
|
|
|
564
546
|
* 获取好友列表
|
|
565
547
|
*/
|
|
566
548
|
async GetFriendList() {
|
|
567
|
-
const friendList = await this.SendApi("get_friend_list" /* OB11Api
|
|
549
|
+
const friendList = await this.SendApi("get_friend_list" /* OB11Api.getFriendList */);
|
|
568
550
|
return friendList.map(v => {
|
|
569
|
-
const
|
|
551
|
+
const userId = v.user_id + '';
|
|
570
552
|
return {
|
|
571
|
-
/**
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* - 用户UIN
|
|
577
|
-
*/
|
|
578
|
-
uin: user_id,
|
|
579
|
-
/**
|
|
580
|
-
* - qid
|
|
581
|
-
*/
|
|
553
|
+
/** 用户UID */
|
|
554
|
+
uid: userId,
|
|
555
|
+
/** 用户UIN */
|
|
556
|
+
uin: userId,
|
|
557
|
+
/** qid */
|
|
582
558
|
qid: '',
|
|
583
|
-
/**
|
|
584
|
-
* - 名称
|
|
585
|
-
*/
|
|
559
|
+
/** 名称 */
|
|
586
560
|
nick: v.nickname,
|
|
587
|
-
/**
|
|
588
|
-
* - 备注
|
|
589
|
-
*/
|
|
561
|
+
/** 备注 */
|
|
590
562
|
remark: '',
|
|
591
|
-
/**
|
|
592
|
-
* - 用户等级
|
|
593
|
-
*/
|
|
563
|
+
/** 用户等级 */
|
|
594
564
|
level: 0,
|
|
595
|
-
/**
|
|
596
|
-
* - 生日
|
|
597
|
-
*/
|
|
565
|
+
/** 生日 */
|
|
598
566
|
birthday: '',
|
|
599
|
-
/**
|
|
600
|
-
* - 登录天数
|
|
601
|
-
*/
|
|
567
|
+
/** 登录天数 */
|
|
602
568
|
login_day: 0,
|
|
603
|
-
/**
|
|
604
|
-
* - 点赞数
|
|
605
|
-
*/
|
|
569
|
+
/** 点赞数 */
|
|
606
570
|
vote_cnt: 0,
|
|
607
|
-
/**
|
|
608
|
-
* - 学校是否已核实
|
|
609
|
-
*/
|
|
571
|
+
/** 学校是否已核实 */
|
|
610
572
|
is_school_verified: undefined,
|
|
611
573
|
/**
|
|
612
574
|
* - 年龄
|
|
@@ -645,11 +607,11 @@ export class AdapterOneBot11 {
|
|
|
645
607
|
}
|
|
646
608
|
/**
|
|
647
609
|
* 获取群信息
|
|
648
|
-
* @param
|
|
649
|
-
* @param
|
|
610
|
+
* @param _groupId - 群号
|
|
611
|
+
* @param noCache - 是否不使用缓存
|
|
650
612
|
*/
|
|
651
|
-
async GetGroupInfo(
|
|
652
|
-
const info = await this.SendApi("get_group_info" /* OB11Api
|
|
613
|
+
async GetGroupInfo(_groupId, noCache = false) {
|
|
614
|
+
const info = await this.SendApi("get_group_info" /* OB11Api.getGroupInfo */, { group_id: Number(_groupId), no_cache: noCache });
|
|
653
615
|
const groupId = info.group_id + '';
|
|
654
616
|
const groupName = info.group_name;
|
|
655
617
|
// todo 可以走群成员列表获取群主
|
|
@@ -668,7 +630,7 @@ export class AdapterOneBot11 {
|
|
|
668
630
|
* 获取群列表
|
|
669
631
|
*/
|
|
670
632
|
async GetGroupList() {
|
|
671
|
-
const groupList = await this.SendApi("get_group_list" /* OB11Api
|
|
633
|
+
const groupList = await this.SendApi("get_group_list" /* OB11Api.getGroupList */);
|
|
672
634
|
return groupList.map(v => {
|
|
673
635
|
const groupId = v.group_id + '';
|
|
674
636
|
const groupName = v.group_name;
|
|
@@ -686,16 +648,16 @@ export class AdapterOneBot11 {
|
|
|
686
648
|
}
|
|
687
649
|
/**
|
|
688
650
|
* 获取群成员信息
|
|
689
|
-
* @param
|
|
690
|
-
* @param
|
|
651
|
+
* @param groupId - 群号
|
|
652
|
+
* @param targetId - 目标用户ID
|
|
691
653
|
* @param refresh - 是否刷新缓存,默认为 false
|
|
692
654
|
*/
|
|
693
|
-
async GetGroupMemberInfo(
|
|
694
|
-
const
|
|
695
|
-
const info = await this.SendApi("get_group_member_info" /* OB11Api
|
|
655
|
+
async GetGroupMemberInfo(groupId, targetId, refresh = false) {
|
|
656
|
+
const userId = Number(targetId);
|
|
657
|
+
const info = await this.SendApi("get_group_member_info" /* OB11Api.getGroupMemberInfo */, { group_id: Number(groupId), user_id: userId, no_cache: refresh });
|
|
696
658
|
return {
|
|
697
|
-
uid:
|
|
698
|
-
uin:
|
|
659
|
+
uid: targetId,
|
|
660
|
+
uin: targetId,
|
|
699
661
|
nick: info.nickname,
|
|
700
662
|
role: info.role,
|
|
701
663
|
age: info.age,
|
|
@@ -714,16 +676,16 @@ export class AdapterOneBot11 {
|
|
|
714
676
|
}
|
|
715
677
|
/**
|
|
716
678
|
* 获取群成员列表
|
|
717
|
-
* @param
|
|
679
|
+
* @param groupId - 群号
|
|
718
680
|
* @param refresh - 是否刷新缓存,默认为 false
|
|
719
681
|
*/
|
|
720
|
-
async GetGroupMemberList(
|
|
721
|
-
const gl = await this.SendApi("get_group_member_list" /* OB11Api
|
|
682
|
+
async GetGroupMemberList(groupId, refresh = false) {
|
|
683
|
+
const gl = await this.SendApi("get_group_member_list" /* OB11Api.getGroupMemberList */, { group_id: Number(groupId), no_cache: refresh });
|
|
722
684
|
return gl.map(v => {
|
|
723
|
-
const
|
|
685
|
+
const userId = v.user_id + '';
|
|
724
686
|
return {
|
|
725
|
-
uid:
|
|
726
|
-
uin:
|
|
687
|
+
uid: userId,
|
|
688
|
+
uin: userId,
|
|
727
689
|
nick: v.nickname,
|
|
728
690
|
role: v.role,
|
|
729
691
|
age: v.age,
|
|
@@ -744,14 +706,14 @@ export class AdapterOneBot11 {
|
|
|
744
706
|
/**
|
|
745
707
|
* 获取群荣誉信息
|
|
746
708
|
*/
|
|
747
|
-
async GetGroupHonor(
|
|
748
|
-
const groupHonor = await this.SendApi("get_group_honor_info" /* OB11Api
|
|
709
|
+
async GetGroupHonor(groupId, refresh = false) {
|
|
710
|
+
const groupHonor = await this.SendApi("get_group_honor_info" /* OB11Api.getGroupHonorInfo */, { group_id: Number(groupId), type: 'all' });
|
|
749
711
|
const result = [];
|
|
750
712
|
groupHonor.talkative_list.forEach(honor => {
|
|
751
|
-
const
|
|
713
|
+
const userId = honor.user_id + '';
|
|
752
714
|
result.push({
|
|
753
|
-
uin:
|
|
754
|
-
uid:
|
|
715
|
+
uin: userId,
|
|
716
|
+
uid: userId,
|
|
755
717
|
nick: honor.nickname,
|
|
756
718
|
honor_name: '历史龙王',
|
|
757
719
|
id: 0,
|
|
@@ -760,10 +722,10 @@ export class AdapterOneBot11 {
|
|
|
760
722
|
});
|
|
761
723
|
});
|
|
762
724
|
groupHonor.performer_list.forEach(honor => {
|
|
763
|
-
const
|
|
725
|
+
const userId = honor.user_id + '';
|
|
764
726
|
result.push({
|
|
765
|
-
uin:
|
|
766
|
-
uid:
|
|
727
|
+
uin: userId,
|
|
728
|
+
uid: userId,
|
|
767
729
|
nick: honor.nickname,
|
|
768
730
|
honor_name: '群聊之火',
|
|
769
731
|
avatar: honor.avatar,
|
|
@@ -772,10 +734,10 @@ export class AdapterOneBot11 {
|
|
|
772
734
|
});
|
|
773
735
|
});
|
|
774
736
|
groupHonor.legend_list.forEach(honor => {
|
|
775
|
-
const
|
|
737
|
+
const userId = honor.user_id + '';
|
|
776
738
|
result.push({
|
|
777
|
-
uin:
|
|
778
|
-
uid:
|
|
739
|
+
uin: userId,
|
|
740
|
+
uid: userId,
|
|
779
741
|
nick: honor.nickname,
|
|
780
742
|
honor_name: '群聊炽焰',
|
|
781
743
|
avatar: honor.avatar,
|
|
@@ -784,10 +746,10 @@ export class AdapterOneBot11 {
|
|
|
784
746
|
});
|
|
785
747
|
});
|
|
786
748
|
groupHonor.strong_newbie_list.forEach(honor => {
|
|
787
|
-
const
|
|
749
|
+
const userId = honor.user_id + '';
|
|
788
750
|
result.push({
|
|
789
|
-
uin:
|
|
790
|
-
uid:
|
|
751
|
+
uin: userId,
|
|
752
|
+
uid: userId,
|
|
791
753
|
nick: honor.nickname,
|
|
792
754
|
honor_name: '冒尖小春笋',
|
|
793
755
|
avatar: honor.avatar,
|
|
@@ -796,10 +758,10 @@ export class AdapterOneBot11 {
|
|
|
796
758
|
});
|
|
797
759
|
});
|
|
798
760
|
groupHonor.emotion_list.forEach(honor => {
|
|
799
|
-
const
|
|
761
|
+
const userId = honor.user_id + '';
|
|
800
762
|
result.push({
|
|
801
|
-
uin:
|
|
802
|
-
uid:
|
|
763
|
+
uin: userId,
|
|
764
|
+
uid: userId,
|
|
803
765
|
nick: honor.nickname,
|
|
804
766
|
honor_name: '快乐之源',
|
|
805
767
|
avatar: honor.avatar,
|
|
@@ -812,12 +774,12 @@ export class AdapterOneBot11 {
|
|
|
812
774
|
/**
|
|
813
775
|
* 对消息进行表情回应
|
|
814
776
|
* @param contact - 联系人信息
|
|
815
|
-
* @param
|
|
816
|
-
* @param
|
|
777
|
+
* @param messageId - 消息ID
|
|
778
|
+
* @param faceId - 表情ID
|
|
817
779
|
*/
|
|
818
|
-
async ReactMessageWithEmoji(contact,
|
|
780
|
+
async ReactMessageWithEmoji(contact, messageId, faceId, isSet = true) {
|
|
819
781
|
try {
|
|
820
|
-
await this.SendApi("set_msg_emoji_like" /* OB11Api
|
|
782
|
+
await this.SendApi("set_msg_emoji_like" /* OB11Api.setMsgEmojiLike */, { message_id: messageId, emoji_id: faceId, is_set: isSet });
|
|
821
783
|
return true;
|
|
822
784
|
}
|
|
823
785
|
catch {
|
|
@@ -828,7 +790,7 @@ export class AdapterOneBot11 {
|
|
|
828
790
|
* 获取版本信息
|
|
829
791
|
*/
|
|
830
792
|
async GetVersion() {
|
|
831
|
-
const res = await this.SendApi("get_version_info" /* OB11Api
|
|
793
|
+
const res = await this.SendApi("get_version_info" /* OB11Api.getVersionInfo */);
|
|
832
794
|
return {
|
|
833
795
|
name: res.app_name,
|
|
834
796
|
app_name: res.app_name,
|
|
@@ -836,65 +798,41 @@ export class AdapterOneBot11 {
|
|
|
836
798
|
protocol: res.protocol_version,
|
|
837
799
|
};
|
|
838
800
|
}
|
|
839
|
-
async DownloadForwardMessage(
|
|
801
|
+
async DownloadForwardMessage(resId) {
|
|
840
802
|
throw new Error('Method not implemented.');
|
|
841
803
|
}
|
|
842
804
|
/**
|
|
843
805
|
* 精华消息
|
|
844
806
|
*/
|
|
845
|
-
async GetEssenceMessageList(
|
|
807
|
+
async GetEssenceMessageList(groupId, page, pageSize) {
|
|
846
808
|
const list = [];
|
|
847
|
-
const res = await this.SendApi("get_essence_msg_list" /* OB11Api
|
|
809
|
+
const res = await this.SendApi("get_essence_msg_list" /* OB11Api.getEssenceMsgList */, { group_id: Number(groupId) });
|
|
848
810
|
for (const v of res) {
|
|
849
|
-
const { message_seq, elements } = await this.GetMessage({ scene: "group" /* Scene.Group */, peer:
|
|
811
|
+
const { message_seq: messageSeq, elements } = await this.GetMessage({ scene: "group" /* Scene.Group */, peer: groupId }, v.message_id + '');
|
|
850
812
|
list.push({
|
|
851
|
-
/**
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
group_id,
|
|
855
|
-
/**
|
|
856
|
-
* - 发送者uid
|
|
857
|
-
*/
|
|
813
|
+
/** 群ID */
|
|
814
|
+
group_id: groupId,
|
|
815
|
+
/** 发送者uid */
|
|
858
816
|
sender_uid: v.sender_id + '',
|
|
859
|
-
/**
|
|
860
|
-
* - 发送者uin
|
|
861
|
-
*/
|
|
817
|
+
/** 发送者uin */
|
|
862
818
|
sender_uin: v.sender_id + '',
|
|
863
|
-
/**
|
|
864
|
-
* - 发送者昵称
|
|
865
|
-
*/
|
|
819
|
+
/** 发送者昵称 */
|
|
866
820
|
sender_nick: v.sender_nick,
|
|
867
|
-
/**
|
|
868
|
-
* - 操作者uid
|
|
869
|
-
*/
|
|
821
|
+
/** 操作者uid */
|
|
870
822
|
operator_uid: v.operator_id + '',
|
|
871
|
-
/**
|
|
872
|
-
* - 操作者uin
|
|
873
|
-
*/
|
|
823
|
+
/** 操作者uin */
|
|
874
824
|
operator_uin: v.operator_id + '',
|
|
875
|
-
/**
|
|
876
|
-
* - 操作者昵称
|
|
877
|
-
*/
|
|
825
|
+
/** 操作者昵称 */
|
|
878
826
|
operator_nick: v.operator_nick,
|
|
879
|
-
/**
|
|
880
|
-
* - 操作时间
|
|
881
|
-
*/
|
|
827
|
+
/** 操作时间 */
|
|
882
828
|
operation_time: v.operator_time,
|
|
883
|
-
/**
|
|
884
|
-
* - 消息时间
|
|
885
|
-
*/
|
|
829
|
+
/** 消息时间 */
|
|
886
830
|
message_time: v.sender_time,
|
|
887
|
-
/**
|
|
888
|
-
* - 消息ID
|
|
889
|
-
*/
|
|
831
|
+
/** 消息ID */
|
|
890
832
|
message_id: v.message_id + '',
|
|
891
|
-
/**
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
message_seq,
|
|
895
|
-
/**
|
|
896
|
-
* - 被设置的精华消息元素文本
|
|
897
|
-
*/
|
|
833
|
+
/** 消息序列号 */
|
|
834
|
+
message_seq: messageSeq,
|
|
835
|
+
/** 被设置的精华消息元素文本 */
|
|
898
836
|
json_elements: JSON.stringify(elements),
|
|
899
837
|
});
|
|
900
838
|
}
|
|
@@ -902,14 +840,14 @@ export class AdapterOneBot11 {
|
|
|
902
840
|
}
|
|
903
841
|
/**
|
|
904
842
|
* 上传群文件
|
|
905
|
-
* @param
|
|
843
|
+
* @param groupId - 群号
|
|
906
844
|
* @param file - 本地文件绝对路径
|
|
907
845
|
* @param name - 文件名称 必须提供
|
|
908
846
|
* @param folder - 父目录ID 不提供则上传到根目录
|
|
909
847
|
*/
|
|
910
|
-
async UploadGroupFile(
|
|
848
|
+
async UploadGroupFile(groupId, file, name, folder) {
|
|
911
849
|
try {
|
|
912
|
-
await this.SendApi("upload_group_file" /* OB11Api
|
|
850
|
+
await this.SendApi("upload_group_file" /* OB11Api.uploadGroupFile */, { group_id: Number(groupId), file, name, folder });
|
|
913
851
|
return true;
|
|
914
852
|
}
|
|
915
853
|
catch {
|
|
@@ -918,13 +856,13 @@ export class AdapterOneBot11 {
|
|
|
918
856
|
}
|
|
919
857
|
/**
|
|
920
858
|
* 上传私聊文件
|
|
921
|
-
* @param
|
|
859
|
+
* @param userId - 用户ID
|
|
922
860
|
* @param file - 本地文件绝对路径
|
|
923
861
|
* @param name - 文件名称 必须提供
|
|
924
862
|
*/
|
|
925
|
-
async UploadPrivateFile(
|
|
863
|
+
async UploadPrivateFile(userId, file, name) {
|
|
926
864
|
try {
|
|
927
|
-
await this.SendApi("upload_private_file" /* OB11Api
|
|
865
|
+
await this.SendApi("upload_private_file" /* OB11Api.uploadPrivateFile */, { user_id: Number(userId), file, name });
|
|
928
866
|
return true;
|
|
929
867
|
}
|
|
930
868
|
catch {
|
|
@@ -933,12 +871,12 @@ export class AdapterOneBot11 {
|
|
|
933
871
|
}
|
|
934
872
|
/**
|
|
935
873
|
* 设置精华消息
|
|
936
|
-
* @param
|
|
937
|
-
* @param
|
|
874
|
+
* @param _groupId - 群号
|
|
875
|
+
* @param messageId - 消息ID
|
|
938
876
|
*/
|
|
939
|
-
async SetEssenceMessage(
|
|
877
|
+
async SetEssenceMessage(_groupId, messageId) {
|
|
940
878
|
try {
|
|
941
|
-
await this.SendApi("set_essence_msg" /* OB11Api
|
|
879
|
+
await this.SendApi("set_essence_msg" /* OB11Api.setEssenceMsg */, { message_id: Number(messageId) });
|
|
942
880
|
return true;
|
|
943
881
|
}
|
|
944
882
|
catch {
|
|
@@ -947,43 +885,43 @@ export class AdapterOneBot11 {
|
|
|
947
885
|
}
|
|
948
886
|
/**
|
|
949
887
|
* 移除精华消息
|
|
950
|
-
* @param
|
|
951
|
-
* @param
|
|
888
|
+
* @param _groupId - 群号
|
|
889
|
+
* @param messageId - 消息ID
|
|
952
890
|
*/
|
|
953
|
-
async DeleteEssenceMessage(
|
|
891
|
+
async DeleteEssenceMessage(_groupId, messageId) {
|
|
954
892
|
try {
|
|
955
|
-
await this.SendApi("delete_essence_msg" /* OB11Api
|
|
893
|
+
await this.SendApi("delete_essence_msg" /* OB11Api.deleteEssenceMsg */, { message_id: Number(messageId) });
|
|
956
894
|
return true;
|
|
957
895
|
}
|
|
958
896
|
catch {
|
|
959
897
|
return false;
|
|
960
898
|
}
|
|
961
899
|
}
|
|
962
|
-
async PokeMember(
|
|
900
|
+
async PokeMember(groupId, targetId) {
|
|
963
901
|
// 这个接口比较特殊 暂时先搁置 lgl单独接口 shamrock单独接口 gocq字段不一样 llob貌似没实现?
|
|
964
902
|
throw new Error('Method not implemented.');
|
|
965
903
|
}
|
|
966
|
-
async SetFriendApplyResult(
|
|
904
|
+
async SetFriendApplyResult(requestId, isApprove, remark) {
|
|
967
905
|
try {
|
|
968
|
-
await this.SendApi("set_friend_add_request" /* OB11Api
|
|
906
|
+
await this.SendApi("set_friend_add_request" /* OB11Api.setFriendAddRequest */, { flag: requestId, approve: isApprove, remark });
|
|
969
907
|
return true;
|
|
970
908
|
}
|
|
971
909
|
catch {
|
|
972
910
|
return false;
|
|
973
911
|
}
|
|
974
912
|
}
|
|
975
|
-
async SetGroupApplyResult(
|
|
913
|
+
async SetGroupApplyResult(requestId, isApprove, denyReason) {
|
|
976
914
|
try {
|
|
977
|
-
await this.SendApi("set_group_add_request" /* OB11Api
|
|
915
|
+
await this.SendApi("set_group_add_request" /* OB11Api.setGroupAddRequest */, { flag: requestId, approve: isApprove, sub_type: 'add', reason: denyReason });
|
|
978
916
|
return true;
|
|
979
917
|
}
|
|
980
918
|
catch {
|
|
981
919
|
return false;
|
|
982
920
|
}
|
|
983
921
|
}
|
|
984
|
-
async SetInvitedJoinGroupResult(
|
|
922
|
+
async SetInvitedJoinGroupResult(requestId, isApprove, denyReason) {
|
|
985
923
|
try {
|
|
986
|
-
await this.SendApi("set_group_add_request" /* OB11Api
|
|
924
|
+
await this.SendApi("set_group_add_request" /* OB11Api.setGroupAddRequest */, { flag: requestId, approve: isApprove, sub_type: 'invite', reason: denyReason });
|
|
987
925
|
return true;
|
|
988
926
|
}
|
|
989
927
|
catch {
|
|
@@ -1003,11 +941,11 @@ export class AdapterOneBot11 {
|
|
|
1003
941
|
GetProhibitedUserList() { throw new Error('Method not implemented.'); }
|
|
1004
942
|
SetMessageReaded() { throw new Error('Method not implemented.'); }
|
|
1005
943
|
async sendForwardMessage(contact, elements) {
|
|
1006
|
-
let
|
|
944
|
+
let messageId = await this.UploadForwardMessage(contact, elements);
|
|
1007
945
|
if (this.version.name === 'Lagrange.OneBot') {
|
|
1008
|
-
|
|
946
|
+
messageId = (await this.SendMessage(contact, [segment.forward(messageId)])).message_id;
|
|
1009
947
|
}
|
|
1010
|
-
return { message_id };
|
|
948
|
+
return { message_id: messageId };
|
|
1011
949
|
}
|
|
1012
950
|
/**
|
|
1013
951
|
* 发送API请求
|