llonebot-dist 7.12.9 → 7.12.11

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/llbot.js CHANGED
@@ -11240,8 +11240,12 @@ var OB11Entities;
11240
11240
  let operatorUin;
11241
11241
  if (revokeElement.operatorUid === revokeElement.origMsgSenderUid) operatorUin = msg.senderUin;
11242
11242
  else operatorUin = await ctx.ntUserApi.getUinByUid(revokeElement.operatorUid);
11243
- if (msg.senderUin === "0" || !msg.senderUin) ctx.logger.warn(`发生异常 senderUin: ${msg.senderUin}`);
11244
- return new OB11GroupRecallNoticeEvent(Number(msg.peerUid), Number(msg.senderUin), Number(operatorUin), shortId);
11243
+ let senderUin = msg.senderUin;
11244
+ if (msg.senderUin === "0") {
11245
+ senderUin = await ctx.ntUserApi.getUinByUid(revokeElement.origMsgSenderUid);
11246
+ if (revokeElement.operatorUid === revokeElement.origMsgSenderUid) operatorUin = senderUin;
11247
+ }
11248
+ return new OB11GroupRecallNoticeEvent(Number(msg.peerUid), Number(senderUin), Number(operatorUin), shortId);
11245
11249
  } else return new OB11FriendRecallNoticeEvent(+msg.senderUin, shortId);
11246
11250
  }
11247
11251
  _OB11Entities.recallEvent = recallEvent;
@@ -11385,7 +11389,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
11385
11389
  };
11386
11390
  //#endregion
11387
11391
  //#region src/version.ts
11388
- var version$2 = "7.12.9";
11392
+ var version$2 = "7.12.11";
11389
11393
  //#endregion
11390
11394
  //#region node_modules/sift/es5m/index.js
11391
11395
  /******************************************************************************
@@ -18112,8 +18116,12 @@ async function createSendElements(ctx, messageData, peer, ignoreTypes = []) {
18112
18116
  if (isAdmin && remainAtAllCount > 0) sendElements.push(SendElement.at(atQQ, atQQ, AtType.All, "@全体成员"));
18113
18117
  } else if (peer.chatType === ChatType.Group) {
18114
18118
  const uid = await ctx.ntUserApi.getUidByUin(atQQ, peer.peerUid);
18115
- let display = "";
18119
+ let display;
18116
18120
  if (segment.data.name) display = `@${segment.data.name}`;
18121
+ else {
18122
+ const info = await ctx.ntGroupApi.getGroupMember(peer.peerUid, uid);
18123
+ display = `@${info.cardName || info.nick}`;
18124
+ }
18117
18125
  sendElements.push(SendElement.at(atQQ, uid, AtType.One, display));
18118
18126
  }
18119
18127
  }
@@ -26411,8 +26419,15 @@ var SendGroupAiRecord = class extends BaseAction {
26411
26419
  chat_type: lib_default$1.union([Number, String]).default(1)
26412
26420
  });
26413
26421
  async _handle(payload) {
26414
- await this.ctx.pmhq.getGroupGenerateAiRecord(+payload.group_id, payload.character, payload.text, +payload.chat_type);
26415
- return { message_id: 0 };
26422
+ const targetMsgRandom = (await this.ctx.pmhq.getGroupGenerateAiRecord(+payload.group_id, payload.character, payload.text, +payload.chat_type)).msgRandom.toString();
26423
+ const { promise, resolve } = Promise.withResolvers();
26424
+ const dispose = this.ctx.on("nt/message-created", (msg) => {
26425
+ if (msg.msgRandom === targetMsgRandom) {
26426
+ dispose();
26427
+ resolve({ message_id: this.ctx.store.createMsgShortId(msg) });
26428
+ }
26429
+ });
26430
+ return promise;
26416
26431
  }
26417
26432
  };
26418
26433
  //#endregion
@@ -28540,7 +28555,12 @@ var MessageEncoder = class {
28540
28555
  if (attrs.type === "all") this.elements.push(SendElement.at("", "", AtType.All, "@全体成员"));
28541
28556
  else {
28542
28557
  const uid = await this.ctx.ntUserApi.getUidByUin(attrs.id, this.peer.peerUid);
28543
- const display = attrs.name ? "@" + attrs.name : "";
28558
+ let display;
28559
+ if (attrs.name) display = `@${attrs.name}`;
28560
+ else {
28561
+ const info = await this.ctx.ntGroupApi.getGroupMember(this.peer.peerUid, uid);
28562
+ display = `@${info.cardName || info.nick}`;
28563
+ }
28544
28564
  this.elements.push(SendElement.at(attrs.id, uid, AtType.One, display));
28545
28565
  }
28546
28566
  } else if (type === "a") {
@@ -43687,7 +43707,8 @@ async function transformOutgoingMessage(ctx, segments, peerUid, isGroup = false)
43687
43707
  else if (segment.type === "mention" && isGroup) {
43688
43708
  const memberUin = segment.data.user_id.toString();
43689
43709
  const memberUid = await ctx.ntUserApi.getUidByUin(memberUin, peerUid);
43690
- elements.push(SendElement.at(memberUin, memberUid, AtType.One, ""));
43710
+ const info = await ctx.ntGroupApi.getGroupMember(peerUid, memberUid);
43711
+ elements.push(SendElement.at(memberUin, memberUid, AtType.One, `@${info.cardName || info.nick}`));
43691
43712
  } else if (segment.type === "mention_all" && isGroup) elements.push(SendElement.at("", "", AtType.All, "@全体成员"));
43692
43713
  else if (segment.type === "face") elements.push(SendElement.face(+segment.data.face_id, segment.data.is_large ? 3 : void 0));
43693
43714
  else if (segment.type === "reply") {
@@ -53760,7 +53781,7 @@ var NTQQMsgApi = class extends Service {
53760
53781
  chatInfo: peer,
53761
53782
  filterMsgType: [],
53762
53783
  filterSendersUid,
53763
- filterMsgToTime: filterMsgTime,
53784
+ filterMsgToTime: String(filterMsgTime + 1),
53764
53785
  filterMsgFromTime: filterMsgTime,
53765
53786
  isReverseOrder: true,
53766
53787
  isIncludeCurrent: true,
@@ -54040,7 +54061,7 @@ var NTQQUserApi = class extends Service {
54040
54061
  const funcs = [async () => {
54041
54062
  return (await this.ctx.pmhq.invoke("nodeIKernelUixConvertService/getUin", [[uid]])).uinInfo.get(uid);
54042
54063
  }, async () => {
54043
- return (await this.fetchUserDetailInfo(uid)).detail.get(uid)?.uin;
54064
+ return (await this.getUserSimpleInfo(uid)).uin;
54044
54065
  }];
54045
54066
  for (const f of funcs) try {
54046
54067
  const result = await f();
@@ -54050,6 +54071,7 @@ var NTQQUserApi = class extends Service {
54050
54071
  }
54051
54072
  return "";
54052
54073
  }
54074
+ /** 始终会从服务器拉取 */
54053
54075
  async fetchUserDetailInfo(uid) {
54054
54076
  return await this.ctx.pmhq.invoke("nodeIKernelProfileService/fetchUserDetailInfo", [
54055
54077
  "BuddyProfileStore",
@@ -54064,12 +54086,14 @@ var NTQQUserApi = class extends Service {
54064
54086
  resultCb: (payload) => payload.simpleInfo.uid === uid
54065
54087
  });
54066
54088
  }
54089
+ /** 无缓存时会从服务器拉取 */
54067
54090
  async getUserSimpleInfo(uid, force = true) {
54068
54091
  return (await this.ctx.pmhq.invoke("nodeIKernelProfileService/getUserSimpleInfo", [force, [uid]], {
54069
54092
  resultCmd: ReceiveCmdS.USER_INFO,
54070
54093
  resultCb: (payload) => payload.has(uid)
54071
54094
  })).get(uid);
54072
54095
  }
54096
+ /** 无缓存时会获取不到用户信息 */
54073
54097
  async getCoreAndBaseInfo(uids) {
54074
54098
  return await this.ctx.pmhq.invoke("nodeIKernelProfileService/getCoreAndBaseInfo", ["nodeStore", uids]);
54075
54099
  }
@@ -70326,12 +70350,13 @@ function MessageMixin(Base) {
70326
70350
  return Oidb.FetchAiCharacterListResp.decode(oidbRespBody);
70327
70351
  }
70328
70352
  async getGroupGenerateAiRecord(groupId, character, text, chatType) {
70353
+ const msgRandom = randomBytes(4).readUInt32BE(0);
70329
70354
  const body = Oidb.GetGroupGenerateAiRecordReq.encode({
70330
70355
  groupId,
70331
70356
  voiceId: character,
70332
70357
  text,
70333
70358
  chatType,
70334
- clientMsgInfo: { msgRandom: randomBytes(4).readUInt32BE(0) }
70359
+ clientMsgInfo: { msgRandom }
70335
70360
  });
70336
70361
  const data = Oidb.Base.encode({
70337
70362
  command: 37531,
@@ -70339,6 +70364,7 @@ function MessageMixin(Base) {
70339
70364
  body
70340
70365
  });
70341
70366
  await this.httpSendPB("OidbSvcTrpcTcp.0x929b_0", data);
70367
+ return { msgRandom };
70342
70368
  }
70343
70369
  };
70344
70370
  }
@@ -70377,7 +70403,7 @@ function UserMixin(Base) {
70377
70403
  const info = Oidb.FetchUserInfoResp.decode(oidbRespBody);
70378
70404
  const numbers = Object.fromEntries(info.body.properties.numberProperties.map((p) => [p.key, p.value]));
70379
70405
  const bytes = Object.fromEntries(info.body.properties.bytesProperties.map((p) => [p.key, p.value]));
70380
- const business = bytes[107] ? Misc.UserInfoBusiness.decode(bytes[107]) : void 0;
70406
+ const vipInfo = (bytes[107] ? Misc.UserInfoBusiness.decode(bytes[107]) : void 0)?.body.lists.find((e) => e.type === 1);
70381
70407
  return {
70382
70408
  uin: info.body.uin,
70383
70409
  nick: bytes[20002]?.toString() ?? "",
@@ -70395,9 +70421,9 @@ function UserMixin(Base) {
70395
70421
  labels: bytes[104] ? Misc.UserInfoLabel.decode(bytes[104]).labels.map((e) => e.content) : [],
70396
70422
  school: bytes[20021]?.toString() ?? "",
70397
70423
  remark: bytes[103]?.toString() ?? "",
70398
- isVip: !!business?.body.lists[0],
70399
- isYearsVip: !!business?.body.lists[0]?.isYear,
70400
- vipLevel: business?.body.lists[0]?.level ?? 0
70424
+ isVip: !!vipInfo,
70425
+ isYearsVip: !!vipInfo?.isYear,
70426
+ vipLevel: vipInfo?.level ?? 0
70401
70427
  };
70402
70428
  }
70403
70429
  async fetchUserLoginDays(uin) {