oicq-icalingua-plus-plus 1.24.2 → 1.24.4

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/client-ext.js CHANGED
@@ -352,7 +352,7 @@ Client.prototype.pbGetMsg = async function () {
352
352
 
353
353
  function sleep(time) {
354
354
  return new Promise(resolve => setTimeout(resolve, time));
355
- }
355
+ }
356
356
 
357
357
  /**
358
358
  * 注册qsign
package/lib/client.js CHANGED
@@ -21,6 +21,7 @@ const nessy = require("./core/nessy");
21
21
  const { WtLogin } = require("./wtlogin/wt");
22
22
  const chat = require("./message/chat");
23
23
  const multi = require("./message/multi");
24
+ const image = require("./message/image");
24
25
  const { Gfs } = require("./message/file");
25
26
  const { getErrorMessage, TimeoutError } = require("./exception");
26
27
 
@@ -619,6 +620,14 @@ class Client extends EventEmitter {
619
620
  return this._useProtocol(chat.preloadImages, arguments);
620
621
  }
621
622
 
623
+ getGroupNTPicRkey() {
624
+ return this._useProtocol(image.getGroupNTPicRkey, arguments);
625
+ }
626
+
627
+ getOffNTPicRkey() {
628
+ return this._useProtocol(image.getOffNTPicRkey, arguments);
629
+ }
630
+
622
631
  ///////////////////////////////////////////////////
623
632
 
624
633
  async getCookies(domain) {
@@ -287,6 +287,11 @@ const map = {
287
287
  357: "/裂开",
288
288
  358: "/骰子",
289
289
  359: "/包剪锤",
290
+
291
+ 392: "/龙年快乐",
292
+ 393: "/新年中龙",
293
+ 394: "/新年大龙",
294
+ 395: "/略略略",
290
295
  };
291
296
 
292
297
  const FACE_OLD_BUF = Buffer.from([0x00, 0x01, 0x00, 0x04, 0x52, 0xCC, 0xF5, 0xD0]);
@@ -611,7 +611,7 @@ async function checkImgUrl(url) {
611
611
  /**
612
612
  * 获取QQNT私聊图URL
613
613
  * @this {import("../ref").Client}
614
- * @param {Buffer} imgInfo
614
+ * @param {Object} imgInfo
615
615
  * @param {String} uid
616
616
  */
617
617
  async function getOffNTPicURL(imgInfo, uid = String(this.uid || this.uin)) {
@@ -659,7 +659,7 @@ async function getOffNTPicURL(imgInfo, uid = String(this.uid || this.uin)) {
659
659
  /**
660
660
  * 获取QQNT群图URL
661
661
  * @this {import("../ref").Client}
662
- * @param {Buffer} imgInfo
662
+ * @param {Object} imgInfo
663
663
  * @param {number} gid
664
664
  */
665
665
  async function getGroupNTPicURL(imgInfo, gid = 284840486) {
@@ -692,7 +692,7 @@ async function getGroupNTPicURL(imgInfo, gid = 284840486) {
692
692
  },
693
693
  });
694
694
  try {
695
- const rsp = await this.sendOidbSvcTrpcTcp("OidbSvcTrpcTcp.0x11c5_200", body);
695
+ const rsp = await this.sendOidbSvcTrpcTcp("OidbSvcTrpcTcp.0x11c4_200", body);
696
696
  const rkey = rsp[3][1];
697
697
  if (!rkey)
698
698
  throw new Error("rkey不存在");
@@ -703,8 +703,31 @@ async function getGroupNTPicURL(imgInfo, gid = 284840486) {
703
703
  }
704
704
  }
705
705
 
706
+ /**
707
+ * 获取QQNT群图rkey
708
+ * @this {import("../ref").Client}
709
+ */
710
+ async function getGroupNTPicRkey() {
711
+ const rsp = await getGroupNTPicURL.call(this, {
712
+ 3: 1,
713
+ });
714
+ return '&rkey=' + rsp.match(/&rkey=([^&]+)/)[1];
715
+ }
716
+
717
+ /**
718
+ * 获取QQNT私聊图rkey
719
+ * @this {import("../ref").Client}
720
+ */
721
+ async function getOffNTPicRkey() {
722
+ const rsp = await getOffNTPicURL.call(this, {
723
+ 3: 1,
724
+ });
725
+ return '&rkey=' + rsp.match(/&rkey=([^&]+)/)[1];
726
+ }
727
+
706
728
  module.exports = {
707
729
  ImageBuilder, uploadImages, buildImageFileParam,
708
730
  groupNTPicDown, offNTPicDown, checkImgUrl,
709
731
  getGroupNTPicURL, getOffNTPicURL,
732
+ getGroupNTPicRkey, getOffNTPicRkey,
710
733
  };
@@ -368,12 +368,14 @@ class Parser {
368
368
  break;
369
369
  case 46: //markdown button
370
370
  break;
371
- case 48: //image of qqnt
372
- const imgData = await this.parseNTImgElem(type, elem);
371
+ case 48: //ntv2richmedia
372
+ const imgData = await this.parseNTImgElem(type, elem[2], elem[3]);
373
373
  if (imgData) {
374
374
  msg.type = "image";
375
375
  msg.data = imgData;
376
376
  brief = "[图片]";
377
+ } else {
378
+ return;
377
379
  }
378
380
  break;
379
381
  default:
@@ -464,8 +466,8 @@ class Parser {
464
466
  await this.parseExclusiveElem(37, elem);
465
467
  } else if (elem[1] === 20) { //json only for mobileqq
466
468
  await this.parseExclusiveElem(51, elem[2]);
467
- } else if (elem[1] == 48) { //image prefix of qqnt
468
- await this.parsePartialElem(48, elem[2]);
469
+ } else if (elem[1] == 48) { //ntv2richmedia
470
+ await this.parsePartialElem(48, elem);
469
471
  if (elem[2] && elem[2][1] && elem[2][1][2] && elem[2][1][2][1] && elem[2][1][2][3])
470
472
  this.imgprefix = "https://" + String(elem[2][1][2][3]) + String(elem[2][1][2][1]);
471
473
  } else if (elem[1] == 45) { //markdown
@@ -487,13 +489,14 @@ class Parser {
487
489
  * @private
488
490
  * @param {number} type 48|3
489
491
  * @param {import("../ref").Proto} elem
492
+ * @param {number} businessType
490
493
  */
491
- async parseNTImgElem(type, elem) {
494
+ async parseNTImgElem(type, elem, businessType = 0) {
495
+ if (![0, 10, 20].includes(businessType)) return null;
492
496
  const data = { };
493
497
  if (!elem[2] || !elem[2][1]) return null;
494
- const dm = !!elem[2][1][11];
495
- const extra = dm ? elem[2][1][11] : elem[2][1][12];
496
- if (!extra) return null;
498
+ const dm = businessType ? businessType === 10 : !!elem[2][1][11];
499
+ const extra = elem[2][1][11] || elem[2][1][12] || { 30: "" };
497
500
  const ntPath = String(extra[30] || "");
498
501
 
499
502
  const imgInfo = elem[1][1];
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "oicq-icalingua-plus-plus",
3
3
  "app_name": "oicq-icalingua-plus-plus",
4
- "version": "1.24.2",
5
- "app_version": "1.24.2",
6
- "upday": "2024/04/22",
4
+ "version": "1.24.4",
5
+ "app_version": "1.24.4",
6
+ "upday": "2024/04/24",
7
7
  "protocol_version": "v11",
8
8
  "description": "oicq(https://github.com/takayama-lily/oicq) v1 for Icalingua++",
9
9
  "main": "index.js",