llonebot-dist 7.9.3 → 7.10.0
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 +217 -279
- package/llbot.js.map +1 -1
- package/package.json +1 -1
- package/webui/assets/index-B_Uq6EWC.js +453 -0
- package/webui/assets/index-DjbQE67X.css +1 -0
- package/webui/index.html +2 -2
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +14 -0
- package/webui/assets/index-8ZzieuAA.js +0 -453
- package/webui/assets/index-CM1j26Ke.css +0 -1
package/llbot.js
CHANGED
|
@@ -11797,7 +11797,7 @@ class WebUITokenUtil {
|
|
|
11797
11797
|
}
|
|
11798
11798
|
const webuiTokenUtil = new WebUITokenUtil(path__default.join(DATA_DIR, "webui_token.txt"));
|
|
11799
11799
|
const logFileName = `llbot-${(/* @__PURE__ */ new Date()).toLocaleString("zh-CN")}.log`.replace(/\//g, "-").replace(/:/g, "-");
|
|
11800
|
-
const version$3 = "7.
|
|
11800
|
+
const version$3 = "7.10.0";
|
|
11801
11801
|
var utils$4 = { exports: {} };
|
|
11802
11802
|
var windows;
|
|
11803
11803
|
var hasRequiredWindows;
|
|
@@ -16506,26 +16506,18 @@ class Core extends Service2 {
|
|
|
16506
16506
|
sentMsgIds.set(payload.msgId, true);
|
|
16507
16507
|
});
|
|
16508
16508
|
const groupNotifyIgnore = [];
|
|
16509
|
-
registerReceiveHook(
|
|
16510
|
-
const [doubt,
|
|
16511
|
-
|
|
16512
|
-
|
|
16513
|
-
|
|
16514
|
-
|
|
16515
|
-
} catch (e) {
|
|
16516
|
-
return;
|
|
16509
|
+
registerReceiveHook("nodeIKernelGroupListener/onGroupNotifiesUpdated", async (payload) => {
|
|
16510
|
+
const [doubt, notifies] = payload;
|
|
16511
|
+
for (const notify of notifies) {
|
|
16512
|
+
const notifyTime = Math.trunc(+notify.seq / 1e3 / 1e3);
|
|
16513
|
+
if (groupNotifyIgnore.includes(notify.seq) || notifyTime < this.startupTime) {
|
|
16514
|
+
continue;
|
|
16517
16515
|
}
|
|
16518
|
-
|
|
16519
|
-
|
|
16520
|
-
|
|
16521
|
-
continue;
|
|
16522
|
-
}
|
|
16523
|
-
groupNotifyIgnore.push(notify.seq);
|
|
16524
|
-
if (groupNotifyIgnore.length > 1e3) {
|
|
16525
|
-
groupNotifyIgnore.shift();
|
|
16526
|
-
}
|
|
16527
|
-
this.ctx.parallel("nt/group-notify", { notify, doubt });
|
|
16516
|
+
groupNotifyIgnore.push(notify.seq);
|
|
16517
|
+
if (groupNotifyIgnore.length > 1e3) {
|
|
16518
|
+
groupNotifyIgnore.shift();
|
|
16528
16519
|
}
|
|
16520
|
+
this.ctx.parallel("nt/group-notify", { notify, doubt });
|
|
16529
16521
|
}
|
|
16530
16522
|
});
|
|
16531
16523
|
registerReceiveHook(ReceiveCmdS.FRIEND_REQUEST, (payload) => {
|
|
@@ -17522,16 +17514,17 @@ var OB11Entities;
|
|
|
17522
17514
|
})(OB11Entities || (OB11Entities = {}));
|
|
17523
17515
|
class OB11FriendRequestEvent extends OB11BaseNoticeEvent {
|
|
17524
17516
|
post_type = EventType.REQUEST;
|
|
17517
|
+
request_type = "friend";
|
|
17525
17518
|
user_id;
|
|
17526
|
-
request_type;
|
|
17527
17519
|
comment;
|
|
17528
17520
|
flag;
|
|
17529
|
-
|
|
17521
|
+
via;
|
|
17522
|
+
constructor(userId, comment, flag, via) {
|
|
17530
17523
|
super();
|
|
17531
17524
|
this.user_id = userId;
|
|
17532
17525
|
this.comment = comment;
|
|
17533
17526
|
this.flag = flag;
|
|
17534
|
-
this.
|
|
17527
|
+
this.via = via;
|
|
17535
17528
|
}
|
|
17536
17529
|
}
|
|
17537
17530
|
class OB11Response {
|
|
@@ -38270,19 +38263,13 @@ class OneBot11Adapter extends Service2 {
|
|
|
38270
38263
|
}).catch((e) => this.ctx.logger.error("handling recall events", e));
|
|
38271
38264
|
}
|
|
38272
38265
|
async handleFriendRequest(req) {
|
|
38273
|
-
|
|
38274
|
-
try {
|
|
38275
|
-
const requesterUin = await this.ctx.ntUserApi.getUinByUid(req.friendUid);
|
|
38276
|
-
userId = +requesterUin;
|
|
38277
|
-
} catch (e) {
|
|
38278
|
-
this.ctx.logger.error("获取加好友者QQ号失败", e);
|
|
38279
|
-
}
|
|
38266
|
+
const uin = await this.ctx.ntUserApi.getUinByUid(req.friendUid);
|
|
38280
38267
|
const flag = req.friendUid + "|" + req.reqTime;
|
|
38281
|
-
const comment = req.extWords;
|
|
38282
38268
|
const friendRequestEvent = new OB11FriendRequestEvent(
|
|
38283
|
-
|
|
38284
|
-
|
|
38285
|
-
flag
|
|
38269
|
+
+uin,
|
|
38270
|
+
req.extWords,
|
|
38271
|
+
flag,
|
|
38272
|
+
req.addSource ?? ""
|
|
38286
38273
|
);
|
|
38287
38274
|
this.dispatch(friendRequestEvent);
|
|
38288
38275
|
}
|
|
@@ -38554,7 +38541,7 @@ class OneBot11Adapter extends Service2 {
|
|
|
38554
38541
|
if (msgType === 732 && subType === 16) {
|
|
38555
38542
|
const notify = Msg.NotifyMessageBody.decode(pushMsg.message.body.msgContent.subarray(7));
|
|
38556
38543
|
if (notify.field13 === 35) {
|
|
38557
|
-
this.ctx.logger.info("群表情回应", notify.reaction.data.body);
|
|
38544
|
+
this.ctx.logger.info("群表情回应", notify.groupCode, notify.reaction.data.body);
|
|
38558
38545
|
const info = notify.reaction.data.body.info;
|
|
38559
38546
|
const target = notify.reaction.data.body.target;
|
|
38560
38547
|
const userId = Number(await this.ctx.ntUserApi.getUinByUid(info.operatorUid));
|
|
@@ -39048,6 +39035,7 @@ var require_index = __commonJS({
|
|
|
39048
39035
|
Element2.at = createFactory("at", "id");
|
|
39049
39036
|
Element2.sharp = createFactory("sharp", "id");
|
|
39050
39037
|
Element2.quote = createFactory("quote", "id");
|
|
39038
|
+
Element2.emoji = createFactory("emoji", "id");
|
|
39051
39039
|
Element2.image = createAssetFactory("img");
|
|
39052
39040
|
Element2.img = createAssetFactory("img");
|
|
39053
39041
|
Element2.video = createAssetFactory("video");
|
|
@@ -39085,10 +39073,10 @@ var Methods = {
|
|
|
39085
39073
|
"message.delete": Method("deleteMessage", ["channel_id", "message_id"]),
|
|
39086
39074
|
"message.get": Method("getMessage", ["channel_id", "message_id"]),
|
|
39087
39075
|
"message.list": Method("getMessageList", ["channel_id", "next", "direction", "limit", "order"]),
|
|
39088
|
-
"reaction.create": Method("createReaction", ["channel_id", "message_id", "
|
|
39089
|
-
"reaction.delete": Method("deleteReaction", ["channel_id", "message_id", "
|
|
39090
|
-
"reaction.clear": Method("clearReaction", ["channel_id", "message_id", "
|
|
39091
|
-
"reaction.list": Method("getReactionList", ["channel_id", "message_id", "
|
|
39076
|
+
"reaction.create": Method("createReaction", ["channel_id", "message_id", "emoji_id"]),
|
|
39077
|
+
"reaction.delete": Method("deleteReaction", ["channel_id", "message_id", "emoji_id", "user_id"]),
|
|
39078
|
+
"reaction.clear": Method("clearReaction", ["channel_id", "message_id", "emoji_id"]),
|
|
39079
|
+
"reaction.list": Method("getReactionList", ["channel_id", "message_id", "emoji_id", "next"]),
|
|
39092
39080
|
"upload.create": Method("createUpload", [], true),
|
|
39093
39081
|
"guild.get": Method("getGuild", ["guild_id"]),
|
|
39094
39082
|
"guild.list": Method("getGuildList", ["next"]),
|
|
@@ -39244,13 +39232,34 @@ const createDirectChannel = async (ctx, payload) => {
|
|
|
39244
39232
|
type: Channel.Type.DIRECT
|
|
39245
39233
|
};
|
|
39246
39234
|
};
|
|
39235
|
+
const robotUinRanges = [
|
|
39236
|
+
{
|
|
39237
|
+
minUin: "3328144510",
|
|
39238
|
+
maxUin: "3328144510"
|
|
39239
|
+
},
|
|
39240
|
+
{
|
|
39241
|
+
minUin: "2854196301",
|
|
39242
|
+
maxUin: "2854216399"
|
|
39243
|
+
},
|
|
39244
|
+
{
|
|
39245
|
+
minUin: "66600000",
|
|
39246
|
+
maxUin: "66600000"
|
|
39247
|
+
},
|
|
39248
|
+
{
|
|
39249
|
+
minUin: "3889000000",
|
|
39250
|
+
maxUin: "3889999999"
|
|
39251
|
+
},
|
|
39252
|
+
{
|
|
39253
|
+
minUin: "4010000000",
|
|
39254
|
+
maxUin: "4019999999"
|
|
39255
|
+
}
|
|
39256
|
+
];
|
|
39247
39257
|
function decodeUser(user) {
|
|
39248
39258
|
return {
|
|
39249
39259
|
id: user.uin,
|
|
39250
39260
|
name: user.nick,
|
|
39251
|
-
nick: user.remark || user.nick,
|
|
39252
39261
|
avatar: `http://q.qlogo.cn/headimg_dl?dst_uin=${user.uin}&spec=640`,
|
|
39253
|
-
is_bot:
|
|
39262
|
+
is_bot: robotUinRanges.some((e) => user.uin >= e.minUin && user.uin <= e.maxUin)
|
|
39254
39263
|
};
|
|
39255
39264
|
}
|
|
39256
39265
|
function decodeGuildChannelId(data) {
|
|
@@ -39260,14 +39269,6 @@ function decodeGuildChannelId(data) {
|
|
|
39260
39269
|
return [void 0, "private:" + data.peerUin];
|
|
39261
39270
|
}
|
|
39262
39271
|
}
|
|
39263
|
-
function decodeMessageUser(data) {
|
|
39264
|
-
return {
|
|
39265
|
-
id: data.senderUin,
|
|
39266
|
-
name: data.sendNickName,
|
|
39267
|
-
nick: data.sendRemarkName || data.sendNickName,
|
|
39268
|
-
avatar: `http://q.qlogo.cn/headimg_dl?dst_uin=${data.senderUin}&spec=640`
|
|
39269
|
-
};
|
|
39270
|
-
}
|
|
39271
39272
|
async function decodeElement(ctx, data, quoted = false) {
|
|
39272
39273
|
const buffer2 = [];
|
|
39273
39274
|
for (const v of data.elements) {
|
|
@@ -39369,15 +39370,20 @@ async function decodeMessage(ctx, data, message = {}) {
|
|
|
39369
39370
|
name: data.peerName,
|
|
39370
39371
|
type: guildId ? Channel.Type.TEXT : Channel.Type.DIRECT
|
|
39371
39372
|
};
|
|
39372
|
-
message.user =
|
|
39373
|
+
message.user = {
|
|
39374
|
+
id: data.senderUin,
|
|
39375
|
+
name: data.sendNickName,
|
|
39376
|
+
avatar: `http://q.qlogo.cn/headimg_dl?dst_uin=${data.senderUin}&spec=640`,
|
|
39377
|
+
is_bot: robotUinRanges.some((e) => data.senderUin >= e.minUin && data.senderUin <= e.maxUin)
|
|
39378
|
+
};
|
|
39373
39379
|
message.created_at = +data.msgTime * 1e3;
|
|
39374
39380
|
if (!message.user.name) {
|
|
39375
|
-
const
|
|
39376
|
-
message.user.name =
|
|
39377
|
-
|
|
39378
|
-
|
|
39379
|
-
|
|
39380
|
-
|
|
39381
|
+
const { coreInfo } = await ctx.ntUserApi.getUserSimpleInfo(data.senderUid);
|
|
39382
|
+
message.user.name = coreInfo.nick;
|
|
39383
|
+
}
|
|
39384
|
+
if (!message.channel.name && message.channel.type === Channel.Type.DIRECT) {
|
|
39385
|
+
const { coreInfo } = await ctx.ntUserApi.getUserSimpleInfo(data.peerUid);
|
|
39386
|
+
message.channel.name = coreInfo.nick;
|
|
39381
39387
|
}
|
|
39382
39388
|
if (guildId) {
|
|
39383
39389
|
message.guild = {
|
|
@@ -39387,20 +39393,25 @@ async function decodeMessage(ctx, data, message = {}) {
|
|
|
39387
39393
|
};
|
|
39388
39394
|
message.member = {
|
|
39389
39395
|
user: message.user,
|
|
39390
|
-
nick: data.sendMemberName
|
|
39396
|
+
nick: data.sendMemberName
|
|
39391
39397
|
};
|
|
39392
39398
|
}
|
|
39393
39399
|
return message;
|
|
39394
39400
|
}
|
|
39395
39401
|
function decodeGuildMember(data) {
|
|
39396
39402
|
return {
|
|
39397
|
-
user:
|
|
39398
|
-
...decodeUser(data),
|
|
39399
|
-
is_bot: data.isRobot
|
|
39400
|
-
},
|
|
39403
|
+
user: decodeUser(data),
|
|
39401
39404
|
nick: data.cardName || data.nick,
|
|
39402
39405
|
avatar: `http://q.qlogo.cn/headimg_dl?dst_uin=${data.uin}&spec=640`,
|
|
39403
|
-
joined_at: data.joinTime * 1e3
|
|
39406
|
+
joined_at: data.joinTime * 1e3,
|
|
39407
|
+
roles: [{
|
|
39408
|
+
id: data.role.toString(),
|
|
39409
|
+
name: {
|
|
39410
|
+
4: "owner",
|
|
39411
|
+
3: "admin",
|
|
39412
|
+
2: "member"
|
|
39413
|
+
}[data.role]
|
|
39414
|
+
}]
|
|
39404
39415
|
};
|
|
39405
39416
|
}
|
|
39406
39417
|
function decodeGuild(data) {
|
|
@@ -39891,7 +39902,7 @@ const createReaction = async (ctx, payload) => {
|
|
|
39891
39902
|
if (!msgList.length) {
|
|
39892
39903
|
throw new Error("无法获取该消息");
|
|
39893
39904
|
}
|
|
39894
|
-
const res = await ctx.ntMsgApi.setEmojiLike(peer, msgList[0].msgSeq, payload.
|
|
39905
|
+
const res = await ctx.ntMsgApi.setEmojiLike(peer, msgList[0].msgSeq, payload.emoji_id, true);
|
|
39895
39906
|
if (res.result !== 0) {
|
|
39896
39907
|
throw new Error(res.errMsg);
|
|
39897
39908
|
}
|
|
@@ -39903,8 +39914,7 @@ const deleteReaction = async (ctx, payload) => {
|
|
|
39903
39914
|
if (!msgList.length) {
|
|
39904
39915
|
throw new Error("无法获取该消息");
|
|
39905
39916
|
}
|
|
39906
|
-
await ctx.ntMsgApi.setEmojiLike(peer, msgList[0].msgSeq, payload.
|
|
39907
|
-
const res = await ctx.ntMsgApi.setEmojiLike(peer, msgList[0].msgSeq, payload.emoji, false);
|
|
39917
|
+
const res = await ctx.ntMsgApi.setEmojiLike(peer, msgList[0].msgSeq, payload.emoji_id, false);
|
|
39908
39918
|
if (res.result !== 0) {
|
|
39909
39919
|
throw new Error(res.errMsg);
|
|
39910
39920
|
}
|
|
@@ -39916,8 +39926,8 @@ const getReactionList = async (ctx, payload) => {
|
|
|
39916
39926
|
if (!msgList.length) {
|
|
39917
39927
|
throw new Error("无法获取该消息");
|
|
39918
39928
|
}
|
|
39919
|
-
const count = msgList[0].emojiLikesList.find((e) => e.emojiId === payload.
|
|
39920
|
-
const data = await ctx.ntMsgApi.getMsgEmojiLikesList(peer, msgList[0].msgSeq, payload.
|
|
39929
|
+
const count = msgList[0].emojiLikesList.find((e) => e.emojiId === payload.emoji_id)?.likesCnt ?? "50";
|
|
39930
|
+
const data = await ctx.ntMsgApi.getMsgEmojiLikesList(peer, msgList[0].msgSeq, payload.emoji_id, +count);
|
|
39921
39931
|
if (data.result !== 0) {
|
|
39922
39932
|
throw new Error(data.errMsg);
|
|
39923
39933
|
}
|
|
@@ -39964,19 +39974,15 @@ const getUser = async (ctx, payload) => {
|
|
|
39964
39974
|
const uid = await ctx.ntUserApi.getUidByUin(uin);
|
|
39965
39975
|
if (!uid) throw new Error("无法获取用户信息");
|
|
39966
39976
|
const data = await ctx.ntUserApi.getUserSimpleInfo(uid, true);
|
|
39967
|
-
|
|
39968
|
-
if (range2.result !== 0) {
|
|
39969
|
-
throw new Error(range2.errMsg);
|
|
39970
|
-
}
|
|
39971
|
-
return {
|
|
39972
|
-
...decodeUser(data.coreInfo),
|
|
39973
|
-
is_bot: range2.response.robotUinRanges.some((e) => uin >= e.minUin && uin <= e.maxUin)
|
|
39974
|
-
};
|
|
39977
|
+
return decodeUser(data.coreInfo);
|
|
39975
39978
|
};
|
|
39976
39979
|
const getFriendList = async (ctx) => {
|
|
39977
39980
|
const friends = await ctx.ntFriendApi.getBuddyList();
|
|
39978
39981
|
return {
|
|
39979
|
-
data: friends.map((e) =>
|
|
39982
|
+
data: friends.map((e) => ({
|
|
39983
|
+
user: decodeUser(e.coreInfo),
|
|
39984
|
+
nick: e.coreInfo.remark
|
|
39985
|
+
}))
|
|
39980
39986
|
};
|
|
39981
39987
|
};
|
|
39982
39988
|
const handleFriendRequest = async (ctx, payload) => {
|
|
@@ -39992,6 +39998,15 @@ const handleFriendRequest = async (ctx, payload) => {
|
|
|
39992
39998
|
}
|
|
39993
39999
|
return {};
|
|
39994
40000
|
};
|
|
40001
|
+
const deleteFriend = async (ctx, payload) => {
|
|
40002
|
+
const uid = await ctx.ntUserApi.getUidByUin(payload.user_id);
|
|
40003
|
+
if (!uid) throw new Error("无法获取用户信息");
|
|
40004
|
+
const res = await ctx.ntFriendApi.delBuddy(uid);
|
|
40005
|
+
if (res.result !== 0) {
|
|
40006
|
+
throw new Error(res.errMsg);
|
|
40007
|
+
}
|
|
40008
|
+
return {};
|
|
40009
|
+
};
|
|
39995
40010
|
const handlers = {
|
|
39996
40011
|
// 频道 (Channel)
|
|
39997
40012
|
getChannel,
|
|
@@ -40026,8 +40041,10 @@ const handlers = {
|
|
|
40026
40041
|
getGuildRoleList,
|
|
40027
40042
|
// 用户 (User)
|
|
40028
40043
|
getUser,
|
|
40044
|
+
// 好友 (Friend)
|
|
40029
40045
|
getFriendList,
|
|
40030
|
-
handleFriendRequest
|
|
40046
|
+
handleFriendRequest,
|
|
40047
|
+
deleteFriend
|
|
40031
40048
|
};
|
|
40032
40049
|
class SatoriServer {
|
|
40033
40050
|
constructor(ctx, config2) {
|
|
@@ -40243,7 +40260,7 @@ async function parseGuildRequest(bot, notify) {
|
|
|
40243
40260
|
}
|
|
40244
40261
|
});
|
|
40245
40262
|
}
|
|
40246
|
-
async function parseGuildMemberAdded(bot, input
|
|
40263
|
+
async function parseGuildMemberAdded(bot, input) {
|
|
40247
40264
|
const groupAll = await bot.ctx.ntGroupApi.getGroupAllInfo(input.peerUid);
|
|
40248
40265
|
let memberUid;
|
|
40249
40266
|
if (input.elements[0].grayTipElement?.groupElement) {
|
|
@@ -40260,13 +40277,12 @@ async function parseGuildMemberAdded(bot, input, isBot = false) {
|
|
|
40260
40277
|
}
|
|
40261
40278
|
if (!memberUid) return;
|
|
40262
40279
|
const user = decodeUser((await bot.ctx.ntUserApi.getUserSimpleInfo(memberUid)).coreInfo);
|
|
40263
|
-
user.is_bot = isBot;
|
|
40264
40280
|
return bot.event("guild-member-added", {
|
|
40265
40281
|
guild: decodeGuild(groupAll),
|
|
40266
40282
|
user,
|
|
40267
40283
|
member: {
|
|
40268
40284
|
user,
|
|
40269
|
-
nick:
|
|
40285
|
+
nick: ""
|
|
40270
40286
|
}
|
|
40271
40287
|
});
|
|
40272
40288
|
}
|
|
@@ -40277,7 +40293,7 @@ async function parseGuildMemberRemoved(bot, input) {
|
|
|
40277
40293
|
user,
|
|
40278
40294
|
member: {
|
|
40279
40295
|
user,
|
|
40280
|
-
nick:
|
|
40296
|
+
nick: ""
|
|
40281
40297
|
}
|
|
40282
40298
|
});
|
|
40283
40299
|
}
|
|
@@ -40303,7 +40319,7 @@ async function parseFriendRequest(bot, input) {
|
|
|
40303
40319
|
}
|
|
40304
40320
|
});
|
|
40305
40321
|
}
|
|
40306
|
-
async function parseReactionAdded(bot, input
|
|
40322
|
+
async function parseReactionAdded(bot, input) {
|
|
40307
40323
|
const { info, target } = input.reaction.data.body;
|
|
40308
40324
|
const peer = {
|
|
40309
40325
|
chatType: ChatType.Group,
|
|
@@ -40319,9 +40335,7 @@ async function parseReactionAdded(bot, input, time2) {
|
|
|
40319
40335
|
const groupAll = await bot.ctx.ntGroupApi.getGroupAllInfo(input.groupCode.toString());
|
|
40320
40336
|
return bot.event("reaction-added", {
|
|
40321
40337
|
message: {
|
|
40322
|
-
id: targetMsg.msgList[0].msgId
|
|
40323
|
-
content: info.code,
|
|
40324
|
-
timestamp: time2 * 1e3
|
|
40338
|
+
id: targetMsg.msgList[0].msgId
|
|
40325
40339
|
},
|
|
40326
40340
|
user: decodeUser(user.coreInfo),
|
|
40327
40341
|
channel: {
|
|
@@ -40329,10 +40343,13 @@ async function parseReactionAdded(bot, input, time2) {
|
|
|
40329
40343
|
name: groupAll.groupName,
|
|
40330
40344
|
type: Channel.Type.TEXT
|
|
40331
40345
|
},
|
|
40332
|
-
guild: decodeGuild(groupAll)
|
|
40346
|
+
guild: decodeGuild(groupAll),
|
|
40347
|
+
emoji: {
|
|
40348
|
+
id: info.code
|
|
40349
|
+
}
|
|
40333
40350
|
});
|
|
40334
40351
|
}
|
|
40335
|
-
async function parseReactionRemoved(bot, input
|
|
40352
|
+
async function parseReactionRemoved(bot, input) {
|
|
40336
40353
|
const { info, target } = input.reaction.data.body;
|
|
40337
40354
|
const peer = {
|
|
40338
40355
|
chatType: ChatType.Group,
|
|
@@ -40348,9 +40365,7 @@ async function parseReactionRemoved(bot, input, time2) {
|
|
|
40348
40365
|
const groupAll = await bot.ctx.ntGroupApi.getGroupAllInfo(input.groupCode.toString());
|
|
40349
40366
|
return bot.event("reaction-removed", {
|
|
40350
40367
|
message: {
|
|
40351
|
-
id: targetMsg.msgList[0].msgId
|
|
40352
|
-
content: info.code,
|
|
40353
|
-
timestamp: time2 * 1e3
|
|
40368
|
+
id: targetMsg.msgList[0].msgId
|
|
40354
40369
|
},
|
|
40355
40370
|
user: decodeUser(user.coreInfo),
|
|
40356
40371
|
channel: {
|
|
@@ -40358,7 +40373,10 @@ async function parseReactionRemoved(bot, input, time2) {
|
|
|
40358
40373
|
name: groupAll.groupName,
|
|
40359
40374
|
type: Channel.Type.TEXT
|
|
40360
40375
|
},
|
|
40361
|
-
guild: decodeGuild(groupAll)
|
|
40376
|
+
guild: decodeGuild(groupAll),
|
|
40377
|
+
emoji: {
|
|
40378
|
+
id: info.code
|
|
40379
|
+
}
|
|
40362
40380
|
});
|
|
40363
40381
|
}
|
|
40364
40382
|
class SatoriAdapter extends Service2 {
|
|
@@ -40399,7 +40417,7 @@ class SatoriAdapter extends Service2 {
|
|
|
40399
40417
|
} else if (input.msgType === 5 && input.subMsgType === 12 && input.elements[0]?.grayTipElement?.xmlElement?.templId === "10179") {
|
|
40400
40418
|
return await parseGuildMemberAdded(this, input);
|
|
40401
40419
|
} else if (input.msgType === 5 && input.subMsgType === 12 && input.elements[0]?.grayTipElement?.jsonGrayTipElement?.busiId === "19217") {
|
|
40402
|
-
return await parseGuildMemberAdded(this, input
|
|
40420
|
+
return await parseGuildMemberAdded(this, input);
|
|
40403
40421
|
} else if (input.msgType === 5 && input.subMsgType === 12 && input.elements[0]?.grayTipElement?.xmlElement?.templId === "10382") ;
|
|
40404
40422
|
else {
|
|
40405
40423
|
return await parseMessageCreated(this, input);
|
|
@@ -40471,17 +40489,17 @@ class SatoriAdapter extends Service2 {
|
|
|
40471
40489
|
if (!pushMsg.message.body) {
|
|
40472
40490
|
return;
|
|
40473
40491
|
}
|
|
40474
|
-
const {
|
|
40492
|
+
const { msgType, subType } = pushMsg.message.contentHead;
|
|
40475
40493
|
if (msgType === 732 && subType === 16) {
|
|
40476
40494
|
const notify = Msg.NotifyMessageBody.decode(pushMsg.message.body.msgContent.subarray(7));
|
|
40477
40495
|
if (notify.field13 === 35) {
|
|
40478
40496
|
if (notify.reaction.data.body.info.actionType === 1) {
|
|
40479
|
-
const event = await parseReactionAdded(this, notify
|
|
40497
|
+
const event = await parseReactionAdded(this, notify).catch((e) => this.ctx.logger.error(e));
|
|
40480
40498
|
if (event) {
|
|
40481
40499
|
this.server.dispatch(event);
|
|
40482
40500
|
}
|
|
40483
40501
|
} else {
|
|
40484
|
-
const event = await parseReactionRemoved(this, notify
|
|
40502
|
+
const event = await parseReactionRemoved(this, notify).catch((e) => this.ctx.logger.error(e));
|
|
40485
40503
|
if (event) {
|
|
40486
40504
|
this.server.dispatch(event);
|
|
40487
40505
|
}
|
|
@@ -56426,7 +56444,7 @@ function validateAttributeString(attrStr, options) {
|
|
|
56426
56444
|
if (!validateAttrName(attrName)) {
|
|
56427
56445
|
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i]));
|
|
56428
56446
|
}
|
|
56429
|
-
if (!
|
|
56447
|
+
if (!Object.prototype.hasOwnProperty.call(attrNames, attrName)) {
|
|
56430
56448
|
attrNames[attrName] = 1;
|
|
56431
56449
|
} else {
|
|
56432
56450
|
return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i]));
|
|
@@ -56536,7 +56554,9 @@ const defaultOptions = {
|
|
|
56536
56554
|
return tagName;
|
|
56537
56555
|
},
|
|
56538
56556
|
// skipEmptyListItem: false
|
|
56539
|
-
captureMetaData: false
|
|
56557
|
+
captureMetaData: false,
|
|
56558
|
+
maxNestedTags: 100,
|
|
56559
|
+
strictReservedNames: true
|
|
56540
56560
|
};
|
|
56541
56561
|
function normalizeProcessEntities(value) {
|
|
56542
56562
|
if (typeof value === "boolean") {
|
|
@@ -56580,7 +56600,7 @@ class XmlNode {
|
|
|
56580
56600
|
constructor(tagname) {
|
|
56581
56601
|
this.tagname = tagname;
|
|
56582
56602
|
this.child = [];
|
|
56583
|
-
this[":@"] =
|
|
56603
|
+
this[":@"] = /* @__PURE__ */ Object.create(null);
|
|
56584
56604
|
}
|
|
56585
56605
|
add(key2, val) {
|
|
56586
56606
|
if (key2 === "__proto__") key2 = "#__proto__";
|
|
@@ -56608,7 +56628,7 @@ class DocTypeReader {
|
|
|
56608
56628
|
this.options = options;
|
|
56609
56629
|
}
|
|
56610
56630
|
readDocType(xmlData, i) {
|
|
56611
|
-
const entities =
|
|
56631
|
+
const entities = /* @__PURE__ */ Object.create(null);
|
|
56612
56632
|
if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") {
|
|
56613
56633
|
i = i + 9;
|
|
56614
56634
|
let angleBracketsCount = 1;
|
|
@@ -56877,8 +56897,10 @@ const consider = {
|
|
|
56877
56897
|
// oct: false,
|
|
56878
56898
|
leadingZeros: true,
|
|
56879
56899
|
decimalPoint: ".",
|
|
56880
|
-
eNotation: true
|
|
56881
|
-
//skipLike: /regex
|
|
56900
|
+
eNotation: true,
|
|
56901
|
+
//skipLike: /regex/,
|
|
56902
|
+
infinity: "original"
|
|
56903
|
+
// "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
|
|
56882
56904
|
};
|
|
56883
56905
|
function toNumber(str, options = {}) {
|
|
56884
56906
|
options = Object.assign({}, consider, options);
|
|
@@ -56888,6 +56910,8 @@ function toNumber(str, options = {}) {
|
|
|
56888
56910
|
else if (str === "0") return 0;
|
|
56889
56911
|
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
56890
56912
|
return parse_int(trimmedStr, 16);
|
|
56913
|
+
} else if (!isFinite(trimmedStr)) {
|
|
56914
|
+
return handleInfinity(str, Number(trimmedStr), options);
|
|
56891
56915
|
} else if (trimmedStr.includes("e") || trimmedStr.includes("E")) {
|
|
56892
56916
|
return resolveEnotation(str, trimmedStr, options);
|
|
56893
56917
|
} else {
|
|
@@ -56966,6 +56990,21 @@ function parse_int(numStr, base) {
|
|
|
56966
56990
|
else if (window && window.parseInt) return window.parseInt(numStr, base);
|
|
56967
56991
|
else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
56968
56992
|
}
|
|
56993
|
+
function handleInfinity(str, num, options) {
|
|
56994
|
+
const isPositive = num === Infinity;
|
|
56995
|
+
switch (options.infinity.toLowerCase()) {
|
|
56996
|
+
case "null":
|
|
56997
|
+
return null;
|
|
56998
|
+
case "infinity":
|
|
56999
|
+
return num;
|
|
57000
|
+
// Return Infinity or -Infinity
|
|
57001
|
+
case "string":
|
|
57002
|
+
return isPositive ? "Infinity" : "-Infinity";
|
|
57003
|
+
case "original":
|
|
57004
|
+
default:
|
|
57005
|
+
return str;
|
|
57006
|
+
}
|
|
57007
|
+
}
|
|
56969
57008
|
function getIgnoreAttributesFn(ignoreAttributes) {
|
|
56970
57009
|
if (typeof ignoreAttributes === "function") {
|
|
56971
57010
|
return ignoreAttributes;
|
|
@@ -57236,6 +57275,9 @@ const parseXml = function(xmlData) {
|
|
|
57236
57275
|
}
|
|
57237
57276
|
tagName = newTagName;
|
|
57238
57277
|
}
|
|
57278
|
+
if (this.options.strictReservedNames && (tagName === this.options.commentPropName || tagName === this.options.cdataPropName)) {
|
|
57279
|
+
throw new Error(`Invalid tag name: ${tagName}`);
|
|
57280
|
+
}
|
|
57239
57281
|
if (currentNode && textData) {
|
|
57240
57282
|
if (currentNode.tagname !== "!xml") {
|
|
57241
57283
|
textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
|
|
@@ -57301,8 +57343,20 @@ const parseXml = function(xmlData) {
|
|
|
57301
57343
|
}
|
|
57302
57344
|
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
57303
57345
|
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
57346
|
+
} else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
|
|
57347
|
+
const childNode = new XmlNode(tagName);
|
|
57348
|
+
if (tagName !== tagExp && attrExpPresent) {
|
|
57349
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
|
57350
|
+
}
|
|
57351
|
+
this.addChild(currentNode, childNode, jPath, startIndex);
|
|
57352
|
+
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
57353
|
+
i = result.closeIndex;
|
|
57354
|
+
continue;
|
|
57304
57355
|
} else {
|
|
57305
57356
|
const childNode = new XmlNode(tagName);
|
|
57357
|
+
if (this.tagsNodeStack.length > this.options.maxNestedTags) {
|
|
57358
|
+
throw new Error("Maximum nested tags exceeded");
|
|
57359
|
+
}
|
|
57306
57360
|
this.tagsNodeStack.push(currentNode);
|
|
57307
57361
|
if (tagName !== tagExp && attrExpPresent) {
|
|
57308
57362
|
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
@@ -57386,19 +57440,19 @@ const replaceEntitiesValue = function(val, tagName, jPath) {
|
|
|
57386
57440
|
val = val.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
57387
57441
|
return val;
|
|
57388
57442
|
};
|
|
57389
|
-
function saveTextToParentTag(textData,
|
|
57443
|
+
function saveTextToParentTag(textData, parentNode, jPath, isLeafNode) {
|
|
57390
57444
|
if (textData) {
|
|
57391
|
-
if (isLeafNode === void 0) isLeafNode =
|
|
57445
|
+
if (isLeafNode === void 0) isLeafNode = parentNode.child.length === 0;
|
|
57392
57446
|
textData = this.parseTextData(
|
|
57393
57447
|
textData,
|
|
57394
|
-
|
|
57448
|
+
parentNode.tagname,
|
|
57395
57449
|
jPath,
|
|
57396
57450
|
false,
|
|
57397
|
-
|
|
57451
|
+
parentNode[":@"] ? Object.keys(parentNode[":@"]).length !== 0 : false,
|
|
57398
57452
|
isLeafNode
|
|
57399
57453
|
);
|
|
57400
57454
|
if (textData !== void 0 && textData !== "")
|
|
57401
|
-
|
|
57455
|
+
parentNode.add(this.options.textNodeName, textData);
|
|
57402
57456
|
textData = "";
|
|
57403
57457
|
}
|
|
57404
57458
|
return textData;
|
|
@@ -57556,9 +57610,6 @@ function compress(arr, options, jPath) {
|
|
|
57556
57610
|
} else if (tagObj[property]) {
|
|
57557
57611
|
let val = compress(tagObj[property], options, newJpath);
|
|
57558
57612
|
const isLeaf = isLeafTag(val, options);
|
|
57559
|
-
if (tagObj[METADATA_SYMBOL] !== void 0) {
|
|
57560
|
-
val[METADATA_SYMBOL] = tagObj[METADATA_SYMBOL];
|
|
57561
|
-
}
|
|
57562
57613
|
if (tagObj[":@"]) {
|
|
57563
57614
|
assignAttributes(val, tagObj[":@"], newJpath, options);
|
|
57564
57615
|
} else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
|
|
@@ -57567,7 +57618,10 @@ function compress(arr, options, jPath) {
|
|
|
57567
57618
|
if (options.alwaysCreateTextNode) val[options.textNodeName] = "";
|
|
57568
57619
|
else val = "";
|
|
57569
57620
|
}
|
|
57570
|
-
if (
|
|
57621
|
+
if (tagObj[METADATA_SYMBOL] !== void 0 && typeof val === "object" && val !== null) {
|
|
57622
|
+
val[METADATA_SYMBOL] = tagObj[METADATA_SYMBOL];
|
|
57623
|
+
}
|
|
57624
|
+
if (compressedObj[property] !== void 0 && Object.prototype.hasOwnProperty.call(compressedObj, property)) {
|
|
57571
57625
|
if (!Array.isArray(compressedObj[property])) {
|
|
57572
57626
|
compressedObj[property] = [compressedObj[property]];
|
|
57573
57627
|
}
|
|
@@ -58170,21 +58224,21 @@ const GetMessage = defineApi(
|
|
|
58170
58224
|
async (ctx, payload) => {
|
|
58171
58225
|
const peer = {
|
|
58172
58226
|
chatType: {
|
|
58173
|
-
friend:
|
|
58174
|
-
group:
|
|
58175
|
-
temp:
|
|
58227
|
+
friend: ChatType.C2C,
|
|
58228
|
+
group: ChatType.Group,
|
|
58229
|
+
temp: ChatType.TempC2CFromGroup
|
|
58176
58230
|
}[payload.message_scene],
|
|
58177
58231
|
peerUid: payload.peer_id.toString(),
|
|
58178
58232
|
guildId: ""
|
|
58179
58233
|
};
|
|
58180
|
-
if (peer.chatType ===
|
|
58234
|
+
if (peer.chatType === ChatType.C2C || peer.chatType === ChatType.TempC2CFromGroup) {
|
|
58181
58235
|
const uid = await ctx.ntUserApi.getUidByUin(peer.peerUid);
|
|
58182
58236
|
if (!uid) {
|
|
58183
58237
|
return Failed(-404, "User not found");
|
|
58184
58238
|
}
|
|
58185
58239
|
peer.peerUid = uid;
|
|
58186
58240
|
}
|
|
58187
|
-
const msgResult = await ctx.ntMsgApi.
|
|
58241
|
+
const msgResult = await ctx.ntMsgApi.getSingleMsg(peer, payload.message_seq.toString());
|
|
58188
58242
|
if (msgResult.msgList.length === 0) {
|
|
58189
58243
|
return Failed(-404, "Message not found");
|
|
58190
58244
|
}
|
|
@@ -58431,21 +58485,6 @@ const GetFriendRequests = defineApi(
|
|
|
58431
58485
|
requests: await Promise.all(buddyReqs.map(async (e) => {
|
|
58432
58486
|
const friendId = Number(await ctx.ntUserApi.getUinByUid(e.friendUid));
|
|
58433
58487
|
const selfId = Number(selfInfo.uin);
|
|
58434
|
-
let via = "";
|
|
58435
|
-
if (e.sourceId === 3020) {
|
|
58436
|
-
via = "QQ号查找";
|
|
58437
|
-
} else if (e.sourceId === 3004) {
|
|
58438
|
-
const groupAll = await ctx.ntGroupApi.getGroupAllInfo(e.groupCode);
|
|
58439
|
-
via = `QQ群-${groupAll.groupName}`;
|
|
58440
|
-
} else if (e.sourceId === 3014) {
|
|
58441
|
-
via = "手机号码查找";
|
|
58442
|
-
} else if (e.sourceId === 3999) {
|
|
58443
|
-
via = "搜索好友";
|
|
58444
|
-
} else if (e.sourceId === 3022) {
|
|
58445
|
-
via = "推荐联系人";
|
|
58446
|
-
} else if (e.sourceId > 10) {
|
|
58447
|
-
ctx.logger.info(`via 获取失败, 请反馈, friendId: ${friendId}, sourceId: ${e.sourceId}`);
|
|
58448
|
-
}
|
|
58449
58488
|
return {
|
|
58450
58489
|
time: Number(e.reqTime),
|
|
58451
58490
|
initiator_id: e.isInitiator ? selfId : friendId,
|
|
@@ -58461,7 +58500,7 @@ const GetFriendRequests = defineApi(
|
|
|
58461
58500
|
[BuddyReqType.MeRefused]: "rejected"
|
|
58462
58501
|
}[e.reqType] ?? "pending",
|
|
58463
58502
|
comment: e.extWords,
|
|
58464
|
-
via,
|
|
58503
|
+
via: e.addSource ?? "",
|
|
58465
58504
|
is_filtered: e.isDoubt
|
|
58466
58505
|
};
|
|
58467
58506
|
}))
|
|
@@ -59321,26 +59360,11 @@ async function transformGroupMessageDeleted(ctx, message) {
|
|
|
59321
59360
|
async function transformFriendRequestEvent(ctx, request2) {
|
|
59322
59361
|
try {
|
|
59323
59362
|
const initiatorId = Number(await ctx.ntUserApi.getUinByUid(request2.friendUid));
|
|
59324
|
-
let via = "";
|
|
59325
|
-
if (request2.sourceId === 3020) {
|
|
59326
|
-
via = "QQ号查找";
|
|
59327
|
-
} else if (request2.sourceId === 3004) {
|
|
59328
|
-
const groupAll = await ctx.ntGroupApi.getGroupAllInfo(request2.groupCode);
|
|
59329
|
-
via = `QQ群-${groupAll.groupName}`;
|
|
59330
|
-
} else if (request2.sourceId === 3014) {
|
|
59331
|
-
via = "手机号码查找";
|
|
59332
|
-
} else if (request2.sourceId === 3999) {
|
|
59333
|
-
via = "搜索好友";
|
|
59334
|
-
} else if (request2.sourceId === 3022) {
|
|
59335
|
-
via = "推荐联系人";
|
|
59336
|
-
} else if (request2.sourceId > 10) {
|
|
59337
|
-
ctx.logger.info(`via 获取失败, 请反馈, friendId: ${initiatorId}, sourceId: ${request2.sourceId}`);
|
|
59338
|
-
}
|
|
59339
59363
|
return {
|
|
59340
59364
|
initiator_id: initiatorId,
|
|
59341
59365
|
initiator_uid: request2.friendUid,
|
|
59342
59366
|
comment: request2.extWords,
|
|
59343
|
-
via
|
|
59367
|
+
via: request2.addSource ?? ""
|
|
59344
59368
|
};
|
|
59345
59369
|
} catch (error2) {
|
|
59346
59370
|
ctx.logger.error("Failed to transform friend request event:", error2);
|
|
@@ -72004,27 +72028,6 @@ function requireLib() {
|
|
|
72004
72028
|
};
|
|
72005
72029
|
return lib;
|
|
72006
72030
|
}
|
|
72007
|
-
var immutable;
|
|
72008
|
-
var hasRequiredImmutable;
|
|
72009
|
-
function requireImmutable() {
|
|
72010
|
-
if (hasRequiredImmutable) return immutable;
|
|
72011
|
-
hasRequiredImmutable = 1;
|
|
72012
|
-
immutable = extend2;
|
|
72013
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
72014
|
-
function extend2() {
|
|
72015
|
-
var target = {};
|
|
72016
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
72017
|
-
var source2 = arguments[i];
|
|
72018
|
-
for (var key2 in source2) {
|
|
72019
|
-
if (hasOwnProperty.call(source2, key2)) {
|
|
72020
|
-
target[key2] = source2[key2];
|
|
72021
|
-
}
|
|
72022
|
-
}
|
|
72023
|
-
}
|
|
72024
|
-
return target;
|
|
72025
|
-
}
|
|
72026
|
-
return immutable;
|
|
72027
|
-
}
|
|
72028
72031
|
var parsePath_1;
|
|
72029
72032
|
var hasRequiredParsePath;
|
|
72030
72033
|
function requireParsePath() {
|
|
@@ -72214,7 +72217,6 @@ var hasRequiredFileAppender;
|
|
|
72214
72217
|
function requireFileAppender() {
|
|
72215
72218
|
if (hasRequiredFileAppender) return fileAppender;
|
|
72216
72219
|
hasRequiredFileAppender = 1;
|
|
72217
|
-
var objectAssign2 = requireObjectAssign();
|
|
72218
72220
|
function arrayRemove(arr, item) {
|
|
72219
72221
|
var idx = arr.indexOf(item);
|
|
72220
72222
|
if (~idx) arr.splice(idx, 1);
|
|
@@ -72283,7 +72285,7 @@ function requireFileAppender() {
|
|
|
72283
72285
|
return;
|
|
72284
72286
|
}
|
|
72285
72287
|
delete placeholder.fieldname;
|
|
72286
|
-
|
|
72288
|
+
Object.assign(placeholder, file2);
|
|
72287
72289
|
};
|
|
72288
72290
|
fileAppender = FileAppender;
|
|
72289
72291
|
return fileAppender;
|
|
@@ -72324,7 +72326,6 @@ function requireMakeMiddleware() {
|
|
|
72324
72326
|
hasRequiredMakeMiddleware = 1;
|
|
72325
72327
|
var is2 = requireTypeIs();
|
|
72326
72328
|
var Busboy = requireLib();
|
|
72327
|
-
var extend2 = requireImmutable();
|
|
72328
72329
|
var appendField = requireAppendField();
|
|
72329
72330
|
var Counter = requireCounter();
|
|
72330
72331
|
var MulterError = requireMulterError();
|
|
@@ -72345,17 +72346,10 @@ function requireMakeMiddleware() {
|
|
|
72345
72346
|
var fileFilter = options.fileFilter;
|
|
72346
72347
|
var fileStrategy = options.fileStrategy;
|
|
72347
72348
|
var preservePath = options.preservePath;
|
|
72349
|
+
var defParamCharset = options.defParamCharset;
|
|
72348
72350
|
req.body = /* @__PURE__ */ Object.create(null);
|
|
72349
|
-
req.on("error", function(err) {
|
|
72350
|
-
abortWithError(err);
|
|
72351
|
-
});
|
|
72352
72351
|
var busboy;
|
|
72353
|
-
|
|
72354
|
-
busboy = Busboy({ headers: req.headers, limits, preservePath });
|
|
72355
|
-
} catch (err) {
|
|
72356
|
-
return next(err);
|
|
72357
|
-
}
|
|
72358
|
-
var appender = new FileAppender(fileStrategy, req);
|
|
72352
|
+
var appender = null;
|
|
72359
72353
|
var isDone = false;
|
|
72360
72354
|
var readFinished = false;
|
|
72361
72355
|
var errorOccured = false;
|
|
@@ -72364,12 +72358,14 @@ function requireMakeMiddleware() {
|
|
|
72364
72358
|
function done(err) {
|
|
72365
72359
|
if (isDone) return;
|
|
72366
72360
|
isDone = true;
|
|
72367
|
-
|
|
72361
|
+
if (busboy) {
|
|
72362
|
+
req.unpipe(busboy);
|
|
72363
|
+
setImmediate(() => {
|
|
72364
|
+
busboy.removeAllListeners();
|
|
72365
|
+
});
|
|
72366
|
+
}
|
|
72368
72367
|
drainStream(req);
|
|
72369
72368
|
req.resume();
|
|
72370
|
-
setImmediate(() => {
|
|
72371
|
-
busboy.removeAllListeners();
|
|
72372
|
-
});
|
|
72373
72369
|
next(err);
|
|
72374
72370
|
}
|
|
72375
72371
|
function indicateDone() {
|
|
@@ -72392,6 +72388,32 @@ function requireMakeMiddleware() {
|
|
|
72392
72388
|
function abortWithCode(code, optionalField) {
|
|
72393
72389
|
abortWithError(new MulterError(code, optionalField));
|
|
72394
72390
|
}
|
|
72391
|
+
function handleRequestFailure(err) {
|
|
72392
|
+
if (isDone) return;
|
|
72393
|
+
if (busboy) busboy.destroy(err);
|
|
72394
|
+
abortWithError(err);
|
|
72395
|
+
}
|
|
72396
|
+
req.on("error", function(err) {
|
|
72397
|
+
handleRequestFailure(err || new Error("Request error"));
|
|
72398
|
+
});
|
|
72399
|
+
req.on("aborted", function() {
|
|
72400
|
+
handleRequestFailure(new Error("Request aborted"));
|
|
72401
|
+
});
|
|
72402
|
+
req.on("close", function() {
|
|
72403
|
+
if (req.readableEnded) return;
|
|
72404
|
+
handleRequestFailure(new Error("Request closed"));
|
|
72405
|
+
});
|
|
72406
|
+
try {
|
|
72407
|
+
busboy = Busboy({
|
|
72408
|
+
headers: req.headers,
|
|
72409
|
+
limits,
|
|
72410
|
+
preservePath,
|
|
72411
|
+
defParamCharset
|
|
72412
|
+
});
|
|
72413
|
+
} catch (err) {
|
|
72414
|
+
return next(err);
|
|
72415
|
+
}
|
|
72416
|
+
appender = new FileAppender(fileStrategy, req);
|
|
72395
72417
|
busboy.on("field", function(fieldname, value, { nameTruncated, valueTruncated }) {
|
|
72396
72418
|
if (fieldname == null) return abortWithCode("MISSING_FIELD_NAME");
|
|
72397
72419
|
if (nameTruncated) return abortWithCode("LIMIT_FIELD_KEY");
|
|
@@ -72422,6 +72444,10 @@ function requireMakeMiddleware() {
|
|
|
72422
72444
|
};
|
|
72423
72445
|
var placeholder = appender.insertPlaceholder(file2);
|
|
72424
72446
|
fileFilter(req, file2, function(err, includeFile) {
|
|
72447
|
+
if (errorOccured) {
|
|
72448
|
+
appender.removePlaceholder(placeholder);
|
|
72449
|
+
return fileStream.resume();
|
|
72450
|
+
}
|
|
72425
72451
|
if (err) {
|
|
72426
72452
|
appender.removePlaceholder(placeholder);
|
|
72427
72453
|
return abortWithError(err);
|
|
@@ -72445,7 +72471,7 @@ function requireMakeMiddleware() {
|
|
|
72445
72471
|
storage._handleFile(req, file2, function(err2, info) {
|
|
72446
72472
|
if (aborting) {
|
|
72447
72473
|
appender.removePlaceholder(placeholder);
|
|
72448
|
-
uploadedFiles.push(
|
|
72474
|
+
uploadedFiles.push({ ...file2, ...info });
|
|
72449
72475
|
return pendingWrites.decrement();
|
|
72450
72476
|
}
|
|
72451
72477
|
if (err2) {
|
|
@@ -72453,7 +72479,7 @@ function requireMakeMiddleware() {
|
|
|
72453
72479
|
pendingWrites.decrement();
|
|
72454
72480
|
return abortWithError(err2);
|
|
72455
72481
|
}
|
|
72456
|
-
var fileInfo =
|
|
72482
|
+
var fileInfo = { ...file2, ...info };
|
|
72457
72483
|
appender.replacePlaceholder(placeholder, fileInfo);
|
|
72458
72484
|
uploadedFiles.push(fileInfo);
|
|
72459
72485
|
pendingWrites.decrement();
|
|
@@ -72483,95 +72509,6 @@ function requireMakeMiddleware() {
|
|
|
72483
72509
|
makeMiddleware_1 = makeMiddleware;
|
|
72484
72510
|
return makeMiddleware_1;
|
|
72485
72511
|
}
|
|
72486
|
-
var mkdirp;
|
|
72487
|
-
var hasRequiredMkdirp;
|
|
72488
|
-
function requireMkdirp() {
|
|
72489
|
-
if (hasRequiredMkdirp) return mkdirp;
|
|
72490
|
-
hasRequiredMkdirp = 1;
|
|
72491
|
-
var path2 = path$1;
|
|
72492
|
-
var fs2 = require$$0$9;
|
|
72493
|
-
var _0777 = parseInt("0777", 8);
|
|
72494
|
-
mkdirp = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
|
|
72495
|
-
function mkdirP(p, opts, f, made) {
|
|
72496
|
-
if (typeof opts === "function") {
|
|
72497
|
-
f = opts;
|
|
72498
|
-
opts = {};
|
|
72499
|
-
} else if (!opts || typeof opts !== "object") {
|
|
72500
|
-
opts = { mode: opts };
|
|
72501
|
-
}
|
|
72502
|
-
var mode2 = opts.mode;
|
|
72503
|
-
var xfs = opts.fs || fs2;
|
|
72504
|
-
if (mode2 === void 0) {
|
|
72505
|
-
mode2 = _0777;
|
|
72506
|
-
}
|
|
72507
|
-
if (!made) made = null;
|
|
72508
|
-
var cb = f || /* istanbul ignore next */
|
|
72509
|
-
function() {
|
|
72510
|
-
};
|
|
72511
|
-
p = path2.resolve(p);
|
|
72512
|
-
xfs.mkdir(p, mode2, function(er) {
|
|
72513
|
-
if (!er) {
|
|
72514
|
-
made = made || p;
|
|
72515
|
-
return cb(null, made);
|
|
72516
|
-
}
|
|
72517
|
-
switch (er.code) {
|
|
72518
|
-
case "ENOENT":
|
|
72519
|
-
if (path2.dirname(p) === p) return cb(er);
|
|
72520
|
-
mkdirP(path2.dirname(p), opts, function(er2, made2) {
|
|
72521
|
-
if (er2) cb(er2, made2);
|
|
72522
|
-
else mkdirP(p, opts, cb, made2);
|
|
72523
|
-
});
|
|
72524
|
-
break;
|
|
72525
|
-
// In the case of any other error, just see if there's a dir
|
|
72526
|
-
// there already. If so, then hooray! If not, then something
|
|
72527
|
-
// is borked.
|
|
72528
|
-
default:
|
|
72529
|
-
xfs.stat(p, function(er2, stat2) {
|
|
72530
|
-
if (er2 || !stat2.isDirectory()) cb(er, made);
|
|
72531
|
-
else cb(null, made);
|
|
72532
|
-
});
|
|
72533
|
-
break;
|
|
72534
|
-
}
|
|
72535
|
-
});
|
|
72536
|
-
}
|
|
72537
|
-
mkdirP.sync = function sync(p, opts, made) {
|
|
72538
|
-
if (!opts || typeof opts !== "object") {
|
|
72539
|
-
opts = { mode: opts };
|
|
72540
|
-
}
|
|
72541
|
-
var mode2 = opts.mode;
|
|
72542
|
-
var xfs = opts.fs || fs2;
|
|
72543
|
-
if (mode2 === void 0) {
|
|
72544
|
-
mode2 = _0777;
|
|
72545
|
-
}
|
|
72546
|
-
if (!made) made = null;
|
|
72547
|
-
p = path2.resolve(p);
|
|
72548
|
-
try {
|
|
72549
|
-
xfs.mkdirSync(p, mode2);
|
|
72550
|
-
made = made || p;
|
|
72551
|
-
} catch (err0) {
|
|
72552
|
-
switch (err0.code) {
|
|
72553
|
-
case "ENOENT":
|
|
72554
|
-
made = sync(path2.dirname(p), opts, made);
|
|
72555
|
-
sync(p, opts, made);
|
|
72556
|
-
break;
|
|
72557
|
-
// In the case of any other error, just see if there's a dir
|
|
72558
|
-
// there already. If so, then hooray! If not, then something
|
|
72559
|
-
// is borked.
|
|
72560
|
-
default:
|
|
72561
|
-
var stat2;
|
|
72562
|
-
try {
|
|
72563
|
-
stat2 = xfs.statSync(p);
|
|
72564
|
-
} catch (err1) {
|
|
72565
|
-
throw err0;
|
|
72566
|
-
}
|
|
72567
|
-
if (!stat2.isDirectory()) throw err0;
|
|
72568
|
-
break;
|
|
72569
|
-
}
|
|
72570
|
-
}
|
|
72571
|
-
return made;
|
|
72572
|
-
};
|
|
72573
|
-
return mkdirp;
|
|
72574
|
-
}
|
|
72575
72512
|
var disk;
|
|
72576
72513
|
var hasRequiredDisk;
|
|
72577
72514
|
function requireDisk() {
|
|
@@ -72581,7 +72518,6 @@ function requireDisk() {
|
|
|
72581
72518
|
var os2 = require$$1$2;
|
|
72582
72519
|
var path2 = path$1;
|
|
72583
72520
|
var crypto2 = require$$0$e;
|
|
72584
|
-
var mkdirp2 = requireMkdirp();
|
|
72585
72521
|
function getFilename(req, file2, cb) {
|
|
72586
72522
|
crypto2.randomBytes(16, function(err, raw) {
|
|
72587
72523
|
cb(err, err ? void 0 : raw.toString("hex"));
|
|
@@ -72593,7 +72529,7 @@ function requireDisk() {
|
|
|
72593
72529
|
function DiskStorage(opts) {
|
|
72594
72530
|
this.getFilename = opts.filename || getFilename;
|
|
72595
72531
|
if (typeof opts.destination === "string") {
|
|
72596
|
-
|
|
72532
|
+
fs2.mkdirSync(opts.destination, { recursive: true });
|
|
72597
72533
|
this.getDestination = function($0, $1, cb) {
|
|
72598
72534
|
cb(null, opts.destination);
|
|
72599
72535
|
};
|
|
@@ -75972,6 +75908,7 @@ function requireMulter() {
|
|
|
75972
75908
|
}
|
|
75973
75909
|
this.limits = options.limits;
|
|
75974
75910
|
this.preservePath = options.preservePath;
|
|
75911
|
+
this.defParamCharset = options.defParamCharset || "latin1";
|
|
75975
75912
|
this.fileFilter = options.fileFilter || allowAll;
|
|
75976
75913
|
}
|
|
75977
75914
|
Multer.prototype._makeMiddleware = function(fields, fileStrategy) {
|
|
@@ -75995,6 +75932,7 @@ function requireMulter() {
|
|
|
75995
75932
|
return {
|
|
75996
75933
|
limits: this.limits,
|
|
75997
75934
|
preservePath: this.preservePath,
|
|
75935
|
+
defParamCharset: this.defParamCharset,
|
|
75998
75936
|
storage: this.storage,
|
|
75999
75937
|
fileFilter: wrappedFileFilter,
|
|
76000
75938
|
fileStrategy
|
|
@@ -76019,6 +75957,7 @@ function requireMulter() {
|
|
|
76019
75957
|
return {
|
|
76020
75958
|
limits: this.limits,
|
|
76021
75959
|
preservePath: this.preservePath,
|
|
75960
|
+
defParamCharset: this.defParamCharset,
|
|
76022
75961
|
storage: this.storage,
|
|
76023
75962
|
fileFilter: this.fileFilter,
|
|
76024
75963
|
fileStrategy: "ARRAY"
|
|
@@ -76636,7 +76575,6 @@ function createProxyRoutes(ctx) {
|
|
|
76636
76575
|
return;
|
|
76637
76576
|
}
|
|
76638
76577
|
let url2 = decodeURIComponent(urlParam);
|
|
76639
|
-
ctx.logger.info("图片代理请求:", url2);
|
|
76640
76578
|
let parsedUrl;
|
|
76641
76579
|
try {
|
|
76642
76580
|
parsedUrl = new URL(url2);
|
|
@@ -76657,7 +76595,6 @@ function createProxyRoutes(ctx) {
|
|
|
76657
76595
|
const rkey = appid === "1406" ? rkeyData.private_rkey : rkeyData.group_rkey;
|
|
76658
76596
|
if (rkey) {
|
|
76659
76597
|
url2 = url2 + rkey;
|
|
76660
|
-
ctx.logger.info("已添加 rkey 到图片 URL");
|
|
76661
76598
|
}
|
|
76662
76599
|
}
|
|
76663
76600
|
} catch (e) {
|
|
@@ -77206,6 +77143,7 @@ data: ${JSON.stringify(serializedData)}
|
|
|
77206
77143
|
const target = notify.reaction.data.body.target;
|
|
77207
77144
|
const groupCode = String(notify.groupCode);
|
|
77208
77145
|
const userId = await this.ctx.ntUserApi.getUinByUid(info.operatorUid);
|
|
77146
|
+
const actionType = typeof info.actionType === "number" ? info.actionType : info.type;
|
|
77209
77147
|
let userName = userId;
|
|
77210
77148
|
try {
|
|
77211
77149
|
const membersResult = await this.ctx.ntGroupApi.getGroupMembers(groupCode);
|
|
@@ -77227,7 +77165,7 @@ data: ${JSON.stringify(serializedData)}
|
|
|
77227
77165
|
emojiId: info.code,
|
|
77228
77166
|
userId,
|
|
77229
77167
|
userName,
|
|
77230
|
-
isAdd:
|
|
77168
|
+
isAdd: actionType === 1
|
|
77231
77169
|
}
|
|
77232
77170
|
});
|
|
77233
77171
|
}
|