llonebot-dist 8.0.6 → 8.0.7

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
@@ -12531,14 +12531,15 @@ var Oidb;
12531
12531
  msgSeq: ProtoField(3, "uint32"),
12532
12532
  chatType: ProtoField(4, "uint32"),
12533
12533
  emojiCode: ProtoField(5, "string"),
12534
- cookie: ProtoField(6, "bytes"),
12534
+ cookie: ProtoField(6, "string"),
12535
12535
  field7: ProtoField(7, "uint32"),
12536
12536
  count: ProtoField(8, "uint32")
12537
12537
  });
12538
12538
  _Oidb.FetchEmojiLikesResp = ProtoMessage.of({
12539
12539
  users: ProtoField(1, { uin: ProtoField(1, "uint32") }, "repeated"),
12540
- totalCount: ProtoField(3, "uint32", "optional"),
12541
- hasMore: ProtoField(4, "uint32", "optional")
12540
+ cookie: ProtoField(2, "string"),
12541
+ isLastPage: ProtoField(3, "bool"),
12542
+ isFirstPage: ProtoField(4, "bool")
12542
12543
  });
12543
12544
  _Oidb.FlashFileSetIdByCodeReq = ProtoMessage.of({ code: ProtoField(1, "string") });
12544
12545
  _Oidb.FlashFileSetIdByCodeResp = ProtoMessage.of({ fileSetId: ProtoField(1, "string") });
@@ -19748,7 +19749,7 @@ async function handleGroupJoinRequest(ctx, msg) {
19748
19749
  initiatorUid: decoded.memberUid,
19749
19750
  notificationSeq,
19750
19751
  isDoubt,
19751
- comment: commit
19752
+ comment: commit ?? ""
19752
19753
  });
19753
19754
  } catch (e) {
19754
19755
  ctx.logger.warn("Failed to parse GroupJoinRequest:", e.message);
@@ -20677,7 +20678,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
20677
20678
  };
20678
20679
  //#endregion
20679
20680
  //#region src/version.ts
20680
- var version$3 = "8.0.6";
20681
+ var version$3 = "8.0.7";
20681
20682
  //#endregion
20682
20683
  //#region node_modules/sift/es5m/index.js
20683
20684
  /******************************************************************************
@@ -31378,24 +31379,27 @@ var GetProfileLikeMe = class extends BaseAction {
31378
31379
  var FetchEmojiLike = class extends BaseAction {
31379
31380
  actionName = ActionName.FetchEmojiLike;
31380
31381
  payloadSchema = lib_default$1.object({
31381
- emoji_id: lib_default$1.string().required(),
31382
31382
  message_id: lib_default$1.union([Number, String]).required(),
31383
- count: lib_default$1.union([Number, String]).default(20)
31383
+ emoji_id: lib_default$1.union([Number, String]),
31384
+ emojiId: lib_default$1.union([Number, String]),
31385
+ count: lib_default$1.union([Number, String]).default(20),
31386
+ cookie: lib_default$1.string()
31384
31387
  });
31385
31388
  async _handle(payload) {
31386
31389
  const msgInfo = await this.ctx.store.getMsgInfoByShortId(+payload.message_id);
31387
31390
  if (!msgInfo) throw new Error("消息不存在");
31388
- const result = await this.ctx.ntMsgApi.getMsgReactionList(msgInfo.peer, msgInfo.msgSeq, payload.emoji_id, +payload.count);
31391
+ const emojiId = payload.emoji_id ?? payload.emojiId;
31392
+ if (!emojiId) throw new Error("未指定表情 ID");
31393
+ const result = await this.ctx.ntMsgApi.getMsgReactionList(msgInfo.peer, msgInfo.msgSeq, emojiId.toString(), +payload.count, payload.cookie ?? "");
31389
31394
  return {
31390
- emojiLikesList: await Promise.all(result.users.map(async (u) => ({
31391
- uid: await this.ctx.ntUserApi.getUidByUin(u.uin, +msgInfo.peer.peerUid),
31392
- uin: u.uin.toString(),
31395
+ emojiLikesList: result.users.map((u) => ({
31396
+ tinyId: u.uin.toString(),
31393
31397
  nickName: "",
31394
31398
  headUrl: `https://q1.qlogo.cn/g?b=qq&nk=${u.uin}&s=640`
31395
- }))),
31396
- cookie: "",
31397
- isLastPage: !result.hasMore,
31398
- isFirstPage: true
31399
+ })),
31400
+ cookie: result.cookie,
31401
+ isLastPage: result.isLastPage,
31402
+ isFirstPage: result.isFirstPage
31399
31403
  };
31400
31404
  }
31401
31405
  };
@@ -56531,13 +56535,8 @@ var NTMsgApi = class extends Service {
56531
56535
  async setGroupMsgReaction(groupCode, msgSeq, emojiId, setEmoji, emojiType) {
56532
56536
  return await this.ctx.qqProtocol.setGroupReaction(groupCode, msgSeq, emojiId, setEmoji, emojiType);
56533
56537
  }
56534
- async getMsgReactionList(peer, msgSeq, emojiId, count) {
56535
- const resp = await this.ctx.qqProtocol.fetchMsgEmojiLikes(+peer.peerUid, msgSeq, emojiId, count);
56536
- return {
56537
- users: resp.users ?? [],
56538
- totalCount: resp.totalCount ?? 0,
56539
- hasMore: !!resp.hasMore
56540
- };
56538
+ async getMsgReactionList(peer, msgSeq, emojiId, count, cookie) {
56539
+ return await this.ctx.qqProtocol.fetchMsgEmojiLikes(+peer.peerUid, msgSeq, emojiId, count, cookie);
56541
56540
  }
56542
56541
  async recallMsg(peer, msgSeq, clientSeq, msgRandom, msgTime) {
56543
56542
  if (peer.chatType === ChatType.Group) await this.ctx.qqProtocol.recallGroupMessage(+peer.peerUid, msgSeq);
@@ -73434,13 +73433,12 @@ async function requestSign(cmd, src, seq, guid, qua, uin, protocolToken12B) {
73434
73433
  }
73435
73434
  async function acquireSignToken(uin, qua) {
73436
73435
  if (!inited) throw new Error("sign not initialized");
73437
- const r = await acquireSignToken$1({
73438
- uin,
73439
- qua
73440
- });
73441
73436
  return {
73442
- token: r.token.toString("utf-8"),
73443
- ttlSecs: r.ttlSecs
73437
+ token: (await acquireSignToken$1({
73438
+ uin,
73439
+ qua
73440
+ })).token.toString("utf-8"),
73441
+ ttlSecs: 1440 * 60
73444
73442
  };
73445
73443
  }
73446
73444
  function formatNativeSignError(cmd, qua, e) {
@@ -74240,10 +74238,9 @@ var DirectProtocolClient = class extends EventEmitter {
74240
74238
  this.signTokenLastFetchAt = Date.now();
74241
74239
  const { token, ttlSecs } = await acquireSignToken(uin, AppInfo.qua);
74242
74240
  if (this.session) {
74243
- const ttlMs = ttlSecs > 0 ? ttlSecs * 1e3 : 1200 * 1e3;
74244
74241
  this.session.signToken12B = token;
74245
- this.session.signTokenExpiresAt = Date.now() + ttlMs;
74246
- console.log(`[SignToken] acquired "${token}" ttl=${ttlSecs > 0 ? ttlSecs + "s" : "default"}`);
74242
+ this.session.signTokenExpiresAt = Date.now() + ttlSecs * 1e3;
74243
+ console.log(`[SignToken] acquired "${token}" ttl=${ttlSecs}s`);
74247
74244
  }
74248
74245
  } catch (e) {
74249
74246
  console.warn(`[SignToken] acquire failed: ${e.message}`);
@@ -75303,7 +75300,10 @@ var QQProtocolBase = class extends Service {
75303
75300
  try {
75304
75301
  const nick = await ctx.ntUserApi.getSelfNick(false);
75305
75302
  this.logger.info(`getSelfNick -> ${JSON.stringify(nick)}`);
75306
- if (nick) selfInfo.nick = nick;
75303
+ if (nick) {
75304
+ selfInfo.nick = nick;
75305
+ ctx.parallel("llbot/self-nick-changed", { nick });
75306
+ }
75307
75307
  } catch (e) {
75308
75308
  this.logger.warn(`getSelfNick threw: ${e.message}`);
75309
75309
  }
@@ -78043,13 +78043,13 @@ function MessageMixin(Base) {
78043
78043
  };
78044
78044
  }
78045
78045
  /** 拉取消息表情回应用户列表 (OidbSvcTrpcTcp.0x9083_1) */
78046
- async fetchMsgEmojiLikes(groupCode, msgSeq, emojiCode, count) {
78046
+ async fetchMsgEmojiLikes(groupCode, msgSeq, emojiCode, count, cookie) {
78047
78047
  const body = Oidb.FetchEmojiLikesReq.encode({
78048
78048
  groupCode,
78049
78049
  msgSeq,
78050
78050
  chatType: 1,
78051
78051
  emojiCode,
78052
- cookie: Buffer.alloc(0),
78052
+ cookie,
78053
78053
  field7: 0,
78054
78054
  count
78055
78055
  });
@@ -78668,6 +78668,9 @@ async function onLoad() {
78668
78668
  };
78669
78669
  ctx.on("qq/online", handleOnline);
78670
78670
  if (selfInfo.online && selfInfo.uid) handleOnline();
78671
+ ctx.on("llbot/self-nick-changed", (info) => {
78672
+ setLoginState({ nickname: info.nick });
78673
+ });
78671
78674
  ctx.on("protocol/disconnect", () => {
78672
78675
  ctx.logger.info("协议层断开,等待重连…");
78673
78676
  });
@@ -78680,13 +78683,13 @@ async function onLoad() {
78680
78683
  });
78681
78684
  else ctx.qqProtocol.startHook();
78682
78685
  });
78686
+ process.on("unhandledRejection", (reason) => {
78687
+ ctx.logger.error("[unhandledRejection]", reason);
78688
+ });
78689
+ process.on("uncaughtException", (err) => {
78690
+ ctx.logger.error("[uncaughtException]", err);
78691
+ });
78683
78692
  }
78684
- process.on("unhandledRejection", (reason) => {
78685
- console.error("[unhandledRejection]", reason);
78686
- });
78687
- process.on("uncaughtException", (err) => {
78688
- console.error("[uncaughtException]", err);
78689
- });
78690
78693
  onLoad().catch((e) => console.error(e));
78691
78694
  //#endregion
78692
78695
  export {};