llonebot-dist 8.0.2 → 8.0.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/llbot.js +230 -60
- package/llbot.js.map +1 -1
- package/package.json +1 -1
- package/sign-proxy.linux-arm64.node +0 -0
- package/sign-proxy.linux-x64.node +0 -0
- package/sign-proxy.package.json +1 -1
- package/webui/assets/index-DJZ0BFgC.js +34 -0
- package/webui/index.html +1 -1
- package/webui/assets/index-DerXsgri.js +0 -34
package/llbot.js
CHANGED
|
@@ -11267,7 +11267,7 @@ var Msg;
|
|
|
11267
11267
|
toUid: ProtoField(4, "string")
|
|
11268
11268
|
}, "optional"),
|
|
11269
11269
|
trans0X211: ProtoField(15, {
|
|
11270
|
-
toUin: ProtoField(1, "
|
|
11270
|
+
toUin: ProtoField(1, "uint32", "optional"),
|
|
11271
11271
|
ccCmd: ProtoField(2, "uint32", "optional"),
|
|
11272
11272
|
uid: ProtoField(8, "string", "optional")
|
|
11273
11273
|
}, "optional")
|
|
@@ -12992,7 +12992,7 @@ var Oidb;
|
|
|
12992
12992
|
clientWording: ProtoField(3, "string")
|
|
12993
12993
|
});
|
|
12994
12994
|
_Oidb.FetchProfileLikeReq = ProtoMessage.of({
|
|
12995
|
-
|
|
12995
|
+
selfUid: ProtoField(1, "string"),
|
|
12996
12996
|
field2: ProtoField(2, "uint32"),
|
|
12997
12997
|
direction: ProtoField(3, "uint32"),
|
|
12998
12998
|
field4: ProtoField(4, "uint32"),
|
|
@@ -13003,11 +13003,24 @@ var Oidb;
|
|
|
13003
13003
|
_Oidb.FetchProfileLikeResp = ProtoMessage.of({ body: ProtoField(1, {
|
|
13004
13004
|
targetUid: ProtoField(1, "string"),
|
|
13005
13005
|
field2: ProtoField(2, "uint32"),
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13006
|
+
favoriteInfo: ProtoField(3, { users: ProtoField(4, {
|
|
13007
|
+
uid: ProtoField(1, "string"),
|
|
13008
|
+
src: ProtoField(2, "uint32"),
|
|
13009
|
+
latestTime: ProtoField(3, "uint32"),
|
|
13010
|
+
count: ProtoField(4, "uint32"),
|
|
13011
|
+
giftCount: ProtoField(5, "uint32"),
|
|
13012
|
+
customId: ProtoField(6, "uint32"),
|
|
13013
|
+
lastCharged: ProtoField(8, "uint32"),
|
|
13014
|
+
bTodayVotedCnt: ProtoField(22, "uint32"),
|
|
13015
|
+
nick: ProtoField(101, "string"),
|
|
13016
|
+
gender: ProtoField(102, "uint32"),
|
|
13017
|
+
age: ProtoField(103, "uint32"),
|
|
13018
|
+
isvip: ProtoField(105, "bool"),
|
|
13019
|
+
isSvip: ProtoField(106, "bool")
|
|
13020
|
+
}, "repeated") }),
|
|
13021
|
+
voteInfo: ProtoField(4, {
|
|
13022
|
+
totalCount: ProtoField(1, "uint32"),
|
|
13023
|
+
users: ProtoField(5, {
|
|
13011
13024
|
uid: ProtoField(1, "string"),
|
|
13012
13025
|
src: ProtoField(2, "uint32"),
|
|
13013
13026
|
latestTime: ProtoField(3, "uint32"),
|
|
@@ -13022,8 +13035,10 @@ var Oidb;
|
|
|
13022
13035
|
isvip: ProtoField(105, "bool"),
|
|
13023
13036
|
isSvip: ProtoField(106, "bool")
|
|
13024
13037
|
}, "repeated")
|
|
13025
|
-
}
|
|
13038
|
+
})
|
|
13026
13039
|
}) });
|
|
13040
|
+
_Oidb.FetchProfileLikeCountReq = ProtoMessage.of({ uid: ProtoField(1, "string") });
|
|
13041
|
+
_Oidb.FetchProfileLikeCountResp = ProtoMessage.of({ body: ProtoField(1, { voteInfo: ProtoField(4, { totalCount: ProtoField(1, "uint32") }) }) });
|
|
13027
13042
|
_Oidb.RenameGroupFileReq = ProtoMessage.of({ rename: ProtoField(5, {
|
|
13028
13043
|
groupCode: ProtoField(1, "uint32"),
|
|
13029
13044
|
busId: ProtoField(3, "uint32"),
|
|
@@ -17432,6 +17447,7 @@ function parseElements(elems) {
|
|
|
17432
17447
|
replyMsgSeq: elem.srcMsg.attr.ntMsgSeq ?? elem.srcMsg.origSeqs[0],
|
|
17433
17448
|
replyMsgTime: elem.srcMsg.time,
|
|
17434
17449
|
senderUin: elem.srcMsg.senderUin,
|
|
17450
|
+
senderUid: elem.srcMsg.attr.senderUid,
|
|
17435
17451
|
replyMsgClientSeq: elem.srcMsg.attr.ntMsgSeq ? elem.srcMsg.origSeqs[0] : 0
|
|
17436
17452
|
}
|
|
17437
17453
|
});
|
|
@@ -18956,7 +18972,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
|
|
|
18956
18972
|
};
|
|
18957
18973
|
//#endregion
|
|
18958
18974
|
//#region src/version.ts
|
|
18959
|
-
var version$3 = "8.0.
|
|
18975
|
+
var version$3 = "8.0.3";
|
|
18960
18976
|
//#endregion
|
|
18961
18977
|
//#region node_modules/sift/es5m/index.js
|
|
18962
18978
|
/******************************************************************************
|
|
@@ -21548,12 +21564,13 @@ var SendElement;
|
|
|
21548
21564
|
};
|
|
21549
21565
|
}
|
|
21550
21566
|
_SendElement.at = at;
|
|
21551
|
-
function reply(msgSeq, senderUin, msgTime, clientSeq, srcMsg) {
|
|
21567
|
+
function reply(msgSeq, senderUin, senderUid, msgTime, clientSeq, srcMsg) {
|
|
21552
21568
|
return {
|
|
21553
21569
|
elementType: ElementType.Reply,
|
|
21554
21570
|
replyElement: {
|
|
21555
21571
|
replyMsgSeq: msgSeq,
|
|
21556
21572
|
senderUin,
|
|
21573
|
+
senderUid,
|
|
21557
21574
|
replyMsgTime: msgTime,
|
|
21558
21575
|
replyMsgClientSeq: clientSeq,
|
|
21559
21576
|
srcMsg
|
|
@@ -21730,6 +21747,19 @@ var SendElement;
|
|
|
21730
21747
|
};
|
|
21731
21748
|
}
|
|
21732
21749
|
_SendElement.forward = forward;
|
|
21750
|
+
async function file(ctx, filePath, fileName) {
|
|
21751
|
+
const fileSize = (await stat(filePath)).size;
|
|
21752
|
+
if (fileSize === 0) throw new Error("文件异常,大小为 0");
|
|
21753
|
+
return {
|
|
21754
|
+
elementType: ElementType.File,
|
|
21755
|
+
fileElement: {
|
|
21756
|
+
fileName,
|
|
21757
|
+
filePath,
|
|
21758
|
+
fileSize
|
|
21759
|
+
}
|
|
21760
|
+
};
|
|
21761
|
+
}
|
|
21762
|
+
_SendElement.file = file;
|
|
21733
21763
|
})(SendElement || (SendElement = {}));
|
|
21734
21764
|
//#endregion
|
|
21735
21765
|
//#region src/common/utils/misc.ts
|
|
@@ -21915,7 +21945,7 @@ async function transformOutgoingSegments(ctx, messageData, peer, isInsideForward
|
|
|
21915
21945
|
const { msgByteList } = await ctx.ntMsgApi.getSingleMsg(info.peer, info.msgSeq);
|
|
21916
21946
|
srcMsg = msgByteList[0];
|
|
21917
21947
|
}
|
|
21918
|
-
sendElements.push(SendElement.reply(msg.msgSeq,
|
|
21948
|
+
sendElements.push(SendElement.reply(msg.msgSeq, msg.senderUin, msg.senderUid, msg.msgTime, msg.clientSeq, srcMsg));
|
|
21919
21949
|
}
|
|
21920
21950
|
}
|
|
21921
21951
|
break;
|
|
@@ -22059,16 +22089,24 @@ async function transformOutgoingSegments(ctx, messageData, peer, isInsideForward
|
|
|
22059
22089
|
sendElements.push(SendElement.ark(content));
|
|
22060
22090
|
}
|
|
22061
22091
|
break;
|
|
22062
|
-
case OB11MessageDataType.Node:
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
|
-
|
|
22092
|
+
case OB11MessageDataType.Node:
|
|
22093
|
+
{
|
|
22094
|
+
const inner = await transformOutgoingSegments(ctx, segment.data.content ? message2List(segment.data.content) : [], peer, true);
|
|
22095
|
+
deleteAfterSentFiles.push(...inner.deleteAfterSentFiles);
|
|
22096
|
+
nodes.push({
|
|
22097
|
+
senderUin: Number(segment.data.uin ?? segment.data.user_id ?? selfInfo.uin),
|
|
22098
|
+
senderName: segment.data.name ?? segment.data.nickname ?? selfInfo.nick,
|
|
22099
|
+
elements: inner.sendElements,
|
|
22100
|
+
msgTime: segment.data.time ? +segment.data.time : void 0
|
|
22101
|
+
});
|
|
22102
|
+
}
|
|
22103
|
+
break;
|
|
22104
|
+
case OB11MessageDataType.File:
|
|
22105
|
+
{
|
|
22106
|
+
const { path, fileName } = await handleOb11RichMedia(ctx, segment, deleteAfterSentFiles);
|
|
22107
|
+
sendElements.push(await SendElement.file(ctx, path, fileName));
|
|
22108
|
+
}
|
|
22109
|
+
break;
|
|
22072
22110
|
}
|
|
22073
22111
|
if (nodes.length > 0) sendElements.push(SendElement.forward(nodes));
|
|
22074
22112
|
return {
|
|
@@ -26115,6 +26153,7 @@ var ActionName = /* @__PURE__ */ function(ActionName) {
|
|
|
26115
26153
|
ActionName["SetInputStatus"] = "set_input_status";
|
|
26116
26154
|
ActionName["GetGroupAlbumMediaList"] = "get_group_album_media_list";
|
|
26117
26155
|
ActionName["GetGroupSignedList"] = "get_group_signed_list";
|
|
26156
|
+
ActionName["GetProfileLikeCount"] = "get_profile_like_count";
|
|
26118
26157
|
ActionName["SendLike"] = "send_like";
|
|
26119
26158
|
ActionName["GetLoginInfo"] = "get_login_info";
|
|
26120
26159
|
ActionName["GetFriendList"] = "get_friend_list";
|
|
@@ -26554,6 +26593,7 @@ var GetStrangerInfo = class extends BaseAction {
|
|
|
26554
26593
|
birthday_day: info.birthdayDay,
|
|
26555
26594
|
labels: info.labels,
|
|
26556
26595
|
is_vip: info.isVip,
|
|
26596
|
+
is_svip: info.isSvip,
|
|
26557
26597
|
is_years_vip: info.isYearsVip,
|
|
26558
26598
|
vip_level: info.vipLevel,
|
|
26559
26599
|
remark: info.remark
|
|
@@ -31267,12 +31307,14 @@ var GetProfileLikeMe = class extends BaseAction {
|
|
|
31267
31307
|
count: lib_default$1.union([Number, String]).default(20)
|
|
31268
31308
|
});
|
|
31269
31309
|
async _handle(payload) {
|
|
31270
|
-
const
|
|
31271
|
-
const
|
|
31272
|
-
|
|
31310
|
+
const users = (await this.ctx.ntUserApi.getProfileLikeMe(selfInfo.uid, +payload.count)).body.voteInfo.users ?? [];
|
|
31311
|
+
for (const item of users) Object.assign(item, {
|
|
31312
|
+
uin: await this.ctx.ntUserApi.getUinByUid(item.uid),
|
|
31313
|
+
isFriend: await this.ctx.ntFriendApi.isFriend(item.uid)
|
|
31314
|
+
});
|
|
31273
31315
|
return {
|
|
31274
31316
|
users,
|
|
31275
|
-
nextStart:
|
|
31317
|
+
nextStart: 0
|
|
31276
31318
|
};
|
|
31277
31319
|
}
|
|
31278
31320
|
};
|
|
@@ -31784,12 +31826,14 @@ var GetProfileLike = class extends BaseAction {
|
|
|
31784
31826
|
count: lib_default$1.union([Number, String]).default(20)
|
|
31785
31827
|
});
|
|
31786
31828
|
async _handle(payload) {
|
|
31787
|
-
const
|
|
31788
|
-
const
|
|
31789
|
-
|
|
31829
|
+
const users = (await this.ctx.ntUserApi.getProfileLike(selfInfo.uid, +payload.count)).body.favoriteInfo.users ?? [];
|
|
31830
|
+
for (const item of users) Object.assign(item, {
|
|
31831
|
+
uin: await this.ctx.ntUserApi.getUinByUid(item.uid),
|
|
31832
|
+
isFriend: await this.ctx.ntFriendApi.isFriend(item.uid)
|
|
31833
|
+
});
|
|
31790
31834
|
return {
|
|
31791
31835
|
users,
|
|
31792
|
-
nextStart:
|
|
31836
|
+
nextStart: 0
|
|
31793
31837
|
};
|
|
31794
31838
|
}
|
|
31795
31839
|
};
|
|
@@ -32618,6 +32662,17 @@ var GetGroupSignedList = class extends BaseAction {
|
|
|
32618
32662
|
}
|
|
32619
32663
|
};
|
|
32620
32664
|
//#endregion
|
|
32665
|
+
//#region src/onebot11/action/llbot/user/GetProfileLikeCount.ts
|
|
32666
|
+
var GetProfileLikeCount = class extends BaseAction {
|
|
32667
|
+
actionName = ActionName.GetProfileLikeCount;
|
|
32668
|
+
payloadSchema = lib_default$1.object({ user_id: lib_default$1.union([Number, String]).required() });
|
|
32669
|
+
async _handle(payload) {
|
|
32670
|
+
const uid = await this.ctx.ntUserApi.getUidByUin(+payload.user_id);
|
|
32671
|
+
if (!uid) throw new Error("无法获取用户信息");
|
|
32672
|
+
return { count: (await this.ctx.ntUserApi.getProfileLikeCount(uid)).body.voteInfo.totalCount };
|
|
32673
|
+
}
|
|
32674
|
+
};
|
|
32675
|
+
//#endregion
|
|
32621
32676
|
//#region src/onebot11/action/index.ts
|
|
32622
32677
|
function initActionMap(adapter) {
|
|
32623
32678
|
const actionHandlers = [
|
|
@@ -32675,6 +32730,7 @@ function initActionMap(adapter) {
|
|
|
32675
32730
|
new SetInputStatus(adapter),
|
|
32676
32731
|
new GetGroupAlbumMediaList(adapter),
|
|
32677
32732
|
new GetGroupSignedList(adapter),
|
|
32733
|
+
new GetProfileLikeCount(adapter),
|
|
32678
32734
|
new SendLike(adapter),
|
|
32679
32735
|
new GetMsg(adapter),
|
|
32680
32736
|
new GetLoginInfo$1(adapter),
|
|
@@ -34441,7 +34497,7 @@ var MessageEncoder = class {
|
|
|
34441
34497
|
const { msgList } = await this.ctx.ntMsgApi.getSingleMsg(this.peer, msgSeq);
|
|
34442
34498
|
source = msgList[0];
|
|
34443
34499
|
}
|
|
34444
|
-
if (source) this.elements.push(SendElement.reply(source.msgSeq, source.senderUin, source.msgTime, source.clientSeq));
|
|
34500
|
+
if (source) this.elements.push(SendElement.reply(source.msgSeq, source.senderUin, source.senderUid, source.msgTime, source.clientSeq));
|
|
34445
34501
|
} else if (type === "face") this.elements.push(SendElement.face(+attrs.id, +attrs.type));
|
|
34446
34502
|
else if (type === "author") Object.assign(this.stack[0].author, attrs);
|
|
34447
34503
|
else if (type === "llonebot:market-face") this.elements.push(SendElement.mface(+attrs.emojiPackageId, attrs.emojiId, attrs.key, attrs.summary));
|
|
@@ -50050,7 +50106,7 @@ async function transformOutgoingMessage(ctx, segments, peerUid, isGroup, isInsid
|
|
|
50050
50106
|
const { msgByteList } = await ctx.ntMsgApi.getSingleMsg(peer, segment.data.message_seq);
|
|
50051
50107
|
srcMsg = msgByteList[0];
|
|
50052
50108
|
}
|
|
50053
|
-
elements.push(SendElement.reply(segment.data.message_seq,
|
|
50109
|
+
elements.push(SendElement.reply(segment.data.message_seq, msg.senderUin, msg.senderUid, msg.msgTime, msg.clientSeq, srcMsg));
|
|
50054
50110
|
} else if (segment.type === "image") {
|
|
50055
50111
|
const imageBuffer = await resolveMilkyUri(segment.data.uri);
|
|
50056
50112
|
const tempPath = path.join(TEMP_DIR, `image-${randomUUID()}`);
|
|
@@ -55429,6 +55485,7 @@ var NTFileApi = class extends Service {
|
|
|
55429
55485
|
}
|
|
55430
55486
|
return {
|
|
55431
55487
|
fileId: result.fileId,
|
|
55488
|
+
fileSize: result.fileSize,
|
|
55432
55489
|
fileMd5: result.md5.toString("hex")
|
|
55433
55490
|
};
|
|
55434
55491
|
}
|
|
@@ -56043,6 +56100,7 @@ var MessageBuilding = class MessageBuilding {
|
|
|
56043
56100
|
chatType;
|
|
56044
56101
|
peerUid;
|
|
56045
56102
|
nestedForwardTrace;
|
|
56103
|
+
content;
|
|
56046
56104
|
constructor(ctx, elements, chatType, peerUid, nestedForwardTrace = /* @__PURE__ */ new Map()) {
|
|
56047
56105
|
this.ctx = ctx;
|
|
56048
56106
|
this.inputElems = elements;
|
|
@@ -56167,22 +56225,31 @@ var MessageBuilding = class MessageBuilding {
|
|
|
56167
56225
|
origSeqs: [replyElement.replyMsgClientSeq || replyElement.replyMsgSeq],
|
|
56168
56226
|
senderUin: replyElement.senderUin,
|
|
56169
56227
|
time: replyElement.replyMsgTime,
|
|
56170
|
-
attr: {
|
|
56228
|
+
attr: {
|
|
56229
|
+
senderUid: replyElement.senderUid,
|
|
56230
|
+
ntMsgSeq: replyElement.replyMsgClientSeq ? replyElement.replyMsgSeq : void 0
|
|
56231
|
+
},
|
|
56171
56232
|
srcMsg: replyElement.srcMsg
|
|
56172
56233
|
} });
|
|
56173
|
-
|
|
56174
|
-
|
|
56175
|
-
|
|
56176
|
-
|
|
56177
|
-
|
|
56178
|
-
|
|
56179
|
-
|
|
56180
|
-
|
|
56181
|
-
|
|
56182
|
-
|
|
56183
|
-
|
|
56184
|
-
|
|
56185
|
-
|
|
56234
|
+
if (this.chatType === ChatType.Group) {
|
|
56235
|
+
const attr6Buf = Buffer.alloc(20);
|
|
56236
|
+
attr6Buf.writeUInt16BE(1, 0);
|
|
56237
|
+
attr6Buf.writeUInt16BE(0, 2);
|
|
56238
|
+
attr6Buf.writeUInt16BE(1, 4);
|
|
56239
|
+
attr6Buf.writeUInt8(0, 6);
|
|
56240
|
+
attr6Buf.writeUInt32BE(replyElement.senderUin, 7);
|
|
56241
|
+
attr6Buf.writeUInt16BE(0, 11);
|
|
56242
|
+
const pbReserve = Msg.TextResvAttr.encode({
|
|
56243
|
+
atType: 2,
|
|
56244
|
+
atMemberUin: 0,
|
|
56245
|
+
atMemberUid: replyElement.senderUid
|
|
56246
|
+
});
|
|
56247
|
+
this.outputElems.push({ text: {
|
|
56248
|
+
str: "@",
|
|
56249
|
+
attr6Buf,
|
|
56250
|
+
pbReserve
|
|
56251
|
+
} }, { text: { str: " " } });
|
|
56252
|
+
}
|
|
56186
56253
|
}
|
|
56187
56254
|
async [ElementType.Pic](data) {
|
|
56188
56255
|
const { picElement: p } = data;
|
|
@@ -56242,7 +56309,7 @@ var MessageBuilding = class MessageBuilding {
|
|
|
56242
56309
|
}, "");
|
|
56243
56310
|
preview.push(`${node.senderName}: ${content}`);
|
|
56244
56311
|
}
|
|
56245
|
-
const elems = await new MessageBuilding(this.ctx, node.elements, this.chatType, this.peerUid, this.nestedForwardTrace).build();
|
|
56312
|
+
const { elems, content } = await new MessageBuilding(this.ctx, node.elements, this.chatType, this.peerUid, this.nestedForwardTrace).build();
|
|
56246
56313
|
messages.push({
|
|
56247
56314
|
routingHead: {
|
|
56248
56315
|
fromUin: node.senderUin,
|
|
@@ -56269,7 +56336,10 @@ var MessageBuilding = class MessageBuilding {
|
|
|
56269
56336
|
avatar: ""
|
|
56270
56337
|
}
|
|
56271
56338
|
},
|
|
56272
|
-
body: {
|
|
56339
|
+
body: {
|
|
56340
|
+
richText: { elems },
|
|
56341
|
+
msgContent: content
|
|
56342
|
+
}
|
|
56273
56343
|
});
|
|
56274
56344
|
seq++;
|
|
56275
56345
|
}
|
|
@@ -56312,9 +56382,53 @@ var MessageBuilding = class MessageBuilding {
|
|
|
56312
56382
|
});
|
|
56313
56383
|
this.outputElems.push({ lightApp: { data: Buffer.concat([Buffer.from([1]), deflateSync(Buffer.from(content, "utf-8"))]) } });
|
|
56314
56384
|
}
|
|
56385
|
+
async [ElementType.File](data) {
|
|
56386
|
+
const fileName = data.fileElement.fileName;
|
|
56387
|
+
if (this.chatType === ChatType.Group) {
|
|
56388
|
+
const uploaded = await this.ctx.ntFileApi.uploadGroupFile(+this.peerUid, data.fileElement.filePath, fileName);
|
|
56389
|
+
const extra = Msg.GroupFileExtra.encode({
|
|
56390
|
+
field1: 6,
|
|
56391
|
+
fileName,
|
|
56392
|
+
inner: { info: {
|
|
56393
|
+
busId: 102,
|
|
56394
|
+
fileId: uploaded.fileId,
|
|
56395
|
+
fileSize: uploaded.fileSize,
|
|
56396
|
+
fileName,
|
|
56397
|
+
fileMd5: uploaded.fileMd5
|
|
56398
|
+
} }
|
|
56399
|
+
});
|
|
56400
|
+
const lenBuf = Buffer.alloc(2);
|
|
56401
|
+
lenBuf.writeUInt16BE(extra.length);
|
|
56402
|
+
this.outputElems.push({ transElemInfo: {
|
|
56403
|
+
elemType: 24,
|
|
56404
|
+
elemValue: Buffer.concat([
|
|
56405
|
+
Buffer.from([1]),
|
|
56406
|
+
lenBuf,
|
|
56407
|
+
extra
|
|
56408
|
+
])
|
|
56409
|
+
} });
|
|
56410
|
+
} else {
|
|
56411
|
+
const uploaded = await this.ctx.ntFileApi.uploadPrivateFile(this.peerUid, data.fileElement.filePath, fileName);
|
|
56412
|
+
const extra = Msg.FileExtra.encode({ file: {
|
|
56413
|
+
fileType: 0,
|
|
56414
|
+
fileUuid: uploaded.fileId,
|
|
56415
|
+
fileMd5: uploaded.file10MMd5,
|
|
56416
|
+
fileName,
|
|
56417
|
+
fileSize: uploaded.fileSize,
|
|
56418
|
+
subCmd: 1,
|
|
56419
|
+
dangerLevel: 0,
|
|
56420
|
+
expireTime: Math.floor(Date.now() / 1e3 + 10080 * 60),
|
|
56421
|
+
fileIdCrcMedia: uploaded.crcMedia
|
|
56422
|
+
} });
|
|
56423
|
+
this.content = extra;
|
|
56424
|
+
}
|
|
56425
|
+
}
|
|
56315
56426
|
async build() {
|
|
56316
56427
|
for (const element of this.inputElems) await this[element.elementType].call(this, element);
|
|
56317
|
-
return
|
|
56428
|
+
return {
|
|
56429
|
+
elems: this.outputElems,
|
|
56430
|
+
content: this.content
|
|
56431
|
+
};
|
|
56318
56432
|
}
|
|
56319
56433
|
};
|
|
56320
56434
|
//#endregion
|
|
@@ -56373,7 +56487,7 @@ var NTMsgApi = class extends Service {
|
|
|
56373
56487
|
* 加重试是因为 server 入库 c2c 历史流稍滞后(~50-200ms)。
|
|
56374
56488
|
*/
|
|
56375
56489
|
async sendMsg(peer, msgElements) {
|
|
56376
|
-
const elems = await new MessageBuilding(this.ctx, msgElements, peer.chatType, peer.peerUid).build();
|
|
56490
|
+
const { elems, content } = await new MessageBuilding(this.ctx, msgElements, peer.chatType, peer.peerUid).build();
|
|
56377
56491
|
let chatType = peer.chatType;
|
|
56378
56492
|
let groupCode;
|
|
56379
56493
|
if (peer.chatType === ChatType.Group) groupCode = +peer.peerUid;
|
|
@@ -56385,12 +56499,21 @@ var NTMsgApi = class extends Service {
|
|
|
56385
56499
|
const random = randomBytes(4).readUInt32BE(0);
|
|
56386
56500
|
const echoP = peer.chatType === ChatType.Group ? this.waitForSelfEcho(peer, random, 7e3) : null;
|
|
56387
56501
|
echoP?.catch(() => {});
|
|
56502
|
+
const fileElem = elems.find((e) => e.transElemInfo?.elemType === 24);
|
|
56503
|
+
if (fileElem) {
|
|
56504
|
+
const buf = fileElem.transElemInfo.elemValue.subarray(3);
|
|
56505
|
+
const extra = Msg.GroupFileExtra.decode(buf);
|
|
56506
|
+
const ret = await this.ctx.qqProtocol.feedGroupFile(groupCode, extra.inner.info.fileId, random);
|
|
56507
|
+
if (ret.feedsInfoRsp.retCode !== 0n) throw new Error(`发送文件失败 (code=${ret.feedsInfoRsp.retCode}): ${ret.feedsInfoRsp.clientWording}`);
|
|
56508
|
+
return await echoP;
|
|
56509
|
+
}
|
|
56388
56510
|
const ret = await this.ctx.qqProtocol.sendMessage({
|
|
56389
56511
|
chatType,
|
|
56390
56512
|
groupCode,
|
|
56391
56513
|
toUid: peer.chatType !== ChatType.Group ? peer.peerUid : void 0,
|
|
56392
56514
|
elems,
|
|
56393
|
-
random
|
|
56515
|
+
random,
|
|
56516
|
+
content
|
|
56394
56517
|
});
|
|
56395
56518
|
if (ret.resultCode !== 0) throw new Error(`发送消息失败 (code=${ret.resultCode}): ${ret.errMsg}`);
|
|
56396
56519
|
return (echoP ? await echoP : void 0) ?? {
|
|
@@ -56743,6 +56866,7 @@ var NTUserApi = class extends Service {
|
|
|
56743
56866
|
school: bytes.get(20021)?.toString() ?? "",
|
|
56744
56867
|
remark: bytes.get(103)?.toString() ?? "",
|
|
56745
56868
|
isVip: !!vipInfo,
|
|
56869
|
+
isSvip: !!vipInfo?.isPro,
|
|
56746
56870
|
isYearsVip: !!vipInfo?.isYear,
|
|
56747
56871
|
vipLevel: vipInfo?.level ?? 0
|
|
56748
56872
|
};
|
|
@@ -56770,6 +56894,7 @@ var NTUserApi = class extends Service {
|
|
|
56770
56894
|
school: bytes.get(20021)?.toString() ?? "",
|
|
56771
56895
|
remark: bytes.get(103)?.toString() ?? "",
|
|
56772
56896
|
isVip: !!vipInfo,
|
|
56897
|
+
isSvip: !!vipInfo?.isPro,
|
|
56773
56898
|
isYearsVip: !!vipInfo?.isYear,
|
|
56774
56899
|
vipLevel: vipInfo?.level ?? 0
|
|
56775
56900
|
};
|
|
@@ -56809,6 +56934,9 @@ var NTUserApi = class extends Service {
|
|
|
56809
56934
|
async getProfileLikeMe(uid, limit = 20) {
|
|
56810
56935
|
return await this.ctx.qqProtocol.fetchProfileLikes(uid, 1, limit);
|
|
56811
56936
|
}
|
|
56937
|
+
async getProfileLikeCount(uid) {
|
|
56938
|
+
return await this.ctx.qqProtocol.fetchProfileLikeCount(uid);
|
|
56939
|
+
}
|
|
56812
56940
|
async modifySelfProfile(profile) {
|
|
56813
56941
|
return await this.ctx.qqProtocol.modifySelfProfile({
|
|
56814
56942
|
nick: profile.nick,
|
|
@@ -59504,6 +59632,7 @@ function createMessagesRoutes(ctx, createPicElement) {
|
|
|
59504
59632
|
replyMsgSeq: Number(item.msgSeq),
|
|
59505
59633
|
replyMsgTime: 0,
|
|
59506
59634
|
senderUin: Number(item.uin ?? 0),
|
|
59635
|
+
senderUid: item.uid ?? "",
|
|
59507
59636
|
replyMsgClientSeq: 0
|
|
59508
59637
|
}
|
|
59509
59638
|
});
|
|
@@ -60116,6 +60245,24 @@ function createProxyRoutes(ctx) {
|
|
|
60116
60245
|
}, 500);
|
|
60117
60246
|
}
|
|
60118
60247
|
});
|
|
60248
|
+
router.get("/rkey", async (c) => {
|
|
60249
|
+
try {
|
|
60250
|
+
const rkeyData = await ctx.ntFileApi.rkeyManager.getRkey();
|
|
60251
|
+
return c.json({
|
|
60252
|
+
success: true,
|
|
60253
|
+
data: {
|
|
60254
|
+
private_rkey: rkeyData.private_rkey || "",
|
|
60255
|
+
group_rkey: rkeyData.group_rkey || ""
|
|
60256
|
+
}
|
|
60257
|
+
});
|
|
60258
|
+
} catch (e) {
|
|
60259
|
+
ctx.logger.warn("获取 rkey 失败:", e);
|
|
60260
|
+
return c.json({
|
|
60261
|
+
success: false,
|
|
60262
|
+
message: "获取 rkey 失败"
|
|
60263
|
+
}, 500);
|
|
60264
|
+
}
|
|
60265
|
+
});
|
|
60119
60266
|
router.get("/audio-proxy", async (c) => {
|
|
60120
60267
|
try {
|
|
60121
60268
|
const fileUuid = c.req.query("fileUuid");
|
|
@@ -73478,17 +73625,22 @@ var DirectProtocolClient = class extends EventEmitter {
|
|
|
73478
73625
|
await this.ensureSignTokenFresh(uin);
|
|
73479
73626
|
}
|
|
73480
73627
|
/**
|
|
73481
|
-
* sendCommand 前调.
|
|
73628
|
+
* sendCommand 前调. 按服务端下发的 TTL 续期:
|
|
73482
73629
|
* 1. 没 session / 没 uin -> noop
|
|
73483
|
-
* 2. 从没拉过 (expiresAt undefined) ->
|
|
73484
|
-
* 3.
|
|
73630
|
+
* 2. 从没拉过 (expiresAt undefined) -> 首拉一次
|
|
73631
|
+
* 3. 有非空 token 且未过期 -> 复用不刷
|
|
73632
|
+
* 4. 有非空 token 但已过期 -> 重新 acquire 续期 (续期失败按 lastFetchAt 限最小重试间隔)
|
|
73633
|
+
* 5. 空 token (403 软降级) -> 不刷, 免得 403 情况每次发包都去重试 acquire
|
|
73485
73634
|
* signToken12B/expiresAt 不落盘 (见 session.ts), 每次启动/恢复都从 undefined 起,
|
|
73486
73635
|
* 故登录后 tryAcquireSignToken 必首拉一次。in-flight lock 防并发雪崩。
|
|
73487
|
-
* 代价: 12B token 服务端有 TTL, 过期后本地不续 -> sign 失败, 需重启 bot 重新登录。
|
|
73488
73636
|
*/
|
|
73489
73637
|
async ensureSignTokenFresh(uin) {
|
|
73490
73638
|
if (!this.session || !uin || !this.config.authToken) return;
|
|
73491
|
-
if (this.session.signTokenExpiresAt)
|
|
73639
|
+
if (this.session.signTokenExpiresAt) {
|
|
73640
|
+
const expired = Date.now() >= this.session.signTokenExpiresAt;
|
|
73641
|
+
if (!this.session.signToken12B || !expired) return;
|
|
73642
|
+
if (Date.now() - this.signTokenLastFetchAt < 3e4) return;
|
|
73643
|
+
}
|
|
73492
73644
|
if (this.signTokenRefreshInflight) return;
|
|
73493
73645
|
this.signTokenRefreshInflight = (async () => {
|
|
73494
73646
|
try {
|
|
@@ -77166,7 +77318,11 @@ function MessageMixin(Base) {
|
|
|
77166
77318
|
const random = opts.random ?? randomBytes(4).readUInt32BE(0);
|
|
77167
77319
|
const clientSequence = 1e4 + Math.floor(Math.random() * 9e4);
|
|
77168
77320
|
const data = Msg.PbSendMsg.encode({
|
|
77169
|
-
routingHead: {
|
|
77321
|
+
routingHead: opts.content ? { trans0X211: {
|
|
77322
|
+
toUin: opts.toUin,
|
|
77323
|
+
ccCmd: 4,
|
|
77324
|
+
uid: opts.toUid
|
|
77325
|
+
} } : {
|
|
77170
77326
|
1: { c2c: {
|
|
77171
77327
|
toUin: opts.toUin,
|
|
77172
77328
|
toUid: opts.toUid
|
|
@@ -77183,7 +77339,10 @@ function MessageMixin(Base) {
|
|
|
77183
77339
|
divSeq: 0,
|
|
77184
77340
|
autoReply: 0
|
|
77185
77341
|
},
|
|
77186
|
-
body: {
|
|
77342
|
+
body: {
|
|
77343
|
+
richText: { elems: opts.elems },
|
|
77344
|
+
msgContent: opts.content
|
|
77345
|
+
},
|
|
77187
77346
|
clientSequence,
|
|
77188
77347
|
random
|
|
77189
77348
|
});
|
|
@@ -77217,7 +77376,7 @@ function MessageMixin(Base) {
|
|
|
77217
77376
|
} });
|
|
77218
77377
|
const data = Msg.PbSendMsg.encode({
|
|
77219
77378
|
routingHead: { trans0X211: {
|
|
77220
|
-
toUin:
|
|
77379
|
+
toUin: opts.toUin,
|
|
77221
77380
|
ccCmd: 4,
|
|
77222
77381
|
uid: opts.toUid
|
|
77223
77382
|
} },
|
|
@@ -77417,9 +77576,9 @@ function UserMixin(Base) {
|
|
|
77417
77576
|
return Oidb.FetchCookiesResp.decode(decoded.body);
|
|
77418
77577
|
}
|
|
77419
77578
|
/** 获取赞过我或我赞过的列表。direction: 0=我赞过的, 1=赞过我的。OidbSvcTrpcTcp.0x7ed_13 */
|
|
77420
|
-
async fetchProfileLikes(
|
|
77579
|
+
async fetchProfileLikes(selfUid, direction, count) {
|
|
77421
77580
|
const body = Oidb.FetchProfileLikeReq.encode({
|
|
77422
|
-
|
|
77581
|
+
selfUid,
|
|
77423
77582
|
field2: 1,
|
|
77424
77583
|
direction,
|
|
77425
77584
|
field4: direction === 0 ? 1 : 0,
|
|
@@ -77436,6 +77595,17 @@ function UserMixin(Base) {
|
|
|
77436
77595
|
const decoded = Oidb.Base.decode(Buffer.from(res.pb, "hex"));
|
|
77437
77596
|
return Oidb.FetchProfileLikeResp.decode(decoded.body);
|
|
77438
77597
|
}
|
|
77598
|
+
async fetchProfileLikeCount(uid) {
|
|
77599
|
+
const body = Oidb.FetchProfileLikeCountReq.encode({ uid });
|
|
77600
|
+
const data = Oidb.Base.encode({
|
|
77601
|
+
command: 2029,
|
|
77602
|
+
subCommand: 12,
|
|
77603
|
+
body
|
|
77604
|
+
});
|
|
77605
|
+
const res = await this.sendPB("OidbSvcTrpcTcp.0x7ed_12", data);
|
|
77606
|
+
const decoded = Oidb.Base.decode(Buffer.from(res.pb, "hex"));
|
|
77607
|
+
return Oidb.FetchProfileLikeCountResp.decode(decoded.body);
|
|
77608
|
+
}
|
|
77439
77609
|
/** 修改自己的资料 (OidbSvcTrpcTcp.0x112a_2) */
|
|
77440
77610
|
async modifySelfProfile(profile) {
|
|
77441
77611
|
const bytesProperties = [];
|