oicq-icalingua-plus-plus 1.24.2 → 1.24.3
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 +1 -1
- package/lib/client.js +9 -0
- package/lib/message/face.js +5 -0
- package/lib/message/image.js +26 -3
- package/lib/message/parser.js +7 -3
- package/package.json +3 -3
package/lib/client-ext.js
CHANGED
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) {
|
package/lib/message/face.js
CHANGED
package/lib/message/image.js
CHANGED
|
@@ -611,7 +611,7 @@ async function checkImgUrl(url) {
|
|
|
611
611
|
/**
|
|
612
612
|
* 获取QQNT私聊图URL
|
|
613
613
|
* @this {import("../ref").Client}
|
|
614
|
-
* @param {
|
|
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 {
|
|
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.
|
|
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
|
};
|
package/lib/message/parser.js
CHANGED
|
@@ -368,12 +368,14 @@ class Parser {
|
|
|
368
368
|
break;
|
|
369
369
|
case 46: //markdown button
|
|
370
370
|
break;
|
|
371
|
-
case 48: //
|
|
371
|
+
case 48: //ntv2richmedia
|
|
372
372
|
const imgData = await this.parseNTImgElem(type, elem);
|
|
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,7 +466,7 @@ 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) { //
|
|
469
|
+
} else if (elem[1] == 48) { //ntv2richmedia
|
|
468
470
|
await this.parsePartialElem(48, elem[2]);
|
|
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]);
|
|
@@ -487,10 +489,12 @@ 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) {
|
|
492
495
|
const data = { };
|
|
493
496
|
if (!elem[2] || !elem[2][1]) return null;
|
|
497
|
+
//const dm = businessType ? businessType === 10 : !!elem[2][1][11];
|
|
494
498
|
const dm = !!elem[2][1][11];
|
|
495
499
|
const extra = dm ? elem[2][1][11] : elem[2][1][12];
|
|
496
500
|
if (!extra) return null;
|
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.
|
|
5
|
-
"app_version": "1.24.
|
|
6
|
-
"upday": "2024/04/
|
|
4
|
+
"version": "1.24.3",
|
|
5
|
+
"app_version": "1.24.3",
|
|
6
|
+
"upday": "2024/04/23",
|
|
7
7
|
"protocol_version": "v11",
|
|
8
8
|
"description": "oicq(https://github.com/takayama-lily/oicq) v1 for Icalingua++",
|
|
9
9
|
"main": "index.js",
|