llonebot-dist 7.11.2 → 7.11.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/llbot.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import * as path$9 from "node:path";
|
|
3
3
|
import path, { dirname, resolve } from "node:path";
|
|
4
|
-
import
|
|
5
|
-
import fs, { createReadStream, existsSync, statSync } from "fs";
|
|
4
|
+
import fs, { access, copyFile, mkdir, readFile, stat, unlink, writeFile } from "node:fs/promises";
|
|
5
|
+
import fs$1, { createReadStream, existsSync, statSync } from "fs";
|
|
6
6
|
import { Readable } from "stream";
|
|
7
7
|
import { Binary, Time, camelize, clone, deduplicate, deepEqual, defineProperty, difference, filterKeys, hyphenate, is, isNonNullable, isNullable, isPlainObject, makeArray, mapValues, noop, omit, pick, remove, valueMap } from "cosmokit";
|
|
8
8
|
import Logger from "reggol";
|
|
9
|
-
import * as fs$
|
|
10
|
-
import fs$
|
|
9
|
+
import * as fs$10 from "node:fs";
|
|
10
|
+
import fs$2, { appendFile, appendFileSync, createReadStream as createReadStream$1, existsSync as existsSync$1, mkdirSync, promises, stat as stat$1, watch } from "node:fs";
|
|
11
11
|
import os from "node:os";
|
|
12
12
|
import crypto$1, { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
|
|
13
13
|
import * as fileType from "file-type";
|
|
@@ -16,7 +16,7 @@ import { inspect, isDeepStrictEqual } from "node:util";
|
|
|
16
16
|
import path$1, { join } from "path";
|
|
17
17
|
import { networkInterfaces } from "os";
|
|
18
18
|
import { decode, encode, getDuration, getWavFileInfo, isSilk, isWav } from "silk-wasm";
|
|
19
|
-
import fsPromise
|
|
19
|
+
import fsPromise, { stat as stat$2, unlink as unlink$1 } from "fs/promises";
|
|
20
20
|
import { deflateSync, gunzipSync, gzipSync, inflateSync } from "node:zlib";
|
|
21
21
|
import { WebSocket as WebSocket$1, WebSocketServer } from "ws";
|
|
22
22
|
import { constants } from "node:buffer";
|
|
@@ -3964,7 +3964,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3964
3964
|
//#endregion
|
|
3965
3965
|
//#region node_modules/qrcode/lib/renderer/png.js
|
|
3966
3966
|
var require_png = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3967
|
-
var fs$
|
|
3967
|
+
var fs$11 = __require("fs");
|
|
3968
3968
|
var PNG = require_png$1().PNG;
|
|
3969
3969
|
var Utils = require_utils$1();
|
|
3970
3970
|
exports.render = function render(qrData, options) {
|
|
@@ -4016,7 +4016,7 @@ var require_png = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4016
4016
|
called = true;
|
|
4017
4017
|
cb.apply(null, args);
|
|
4018
4018
|
};
|
|
4019
|
-
const stream = fs$
|
|
4019
|
+
const stream = fs$11.createWriteStream(path);
|
|
4020
4020
|
stream.on("error", done);
|
|
4021
4021
|
stream.on("close", done);
|
|
4022
4022
|
exports.renderToFileStream(stream, qrData, options);
|
|
@@ -6370,7 +6370,7 @@ var Log = class {
|
|
|
6370
6370
|
record: (record) => {
|
|
6371
6371
|
const dateTime = new Date(record.timestamp);
|
|
6372
6372
|
const dateTimeStr = `${dateTime.getFullYear()}-${(dateTime.getMonth() + 1).toString().padStart(2, "0")}-${dateTime.getDate().toString().padStart(2, "0")} ${dateTime.getHours().toString().padStart(2, "0")}:${dateTime.getMinutes().toString().padStart(2, "0")}:${dateTime.getSeconds().toString().padStart(2, "0")}`;
|
|
6373
|
-
let content = `${dateTimeStr} | ${record.content}\n
|
|
6373
|
+
let content = `${dateTimeStr} | ${record.content}\n`;
|
|
6374
6374
|
console.log(content);
|
|
6375
6375
|
const logRecord = {
|
|
6376
6376
|
timestamp: record.timestamp,
|
|
@@ -6382,7 +6382,7 @@ var Log = class {
|
|
|
6382
6382
|
if (logCache.length > LOG_CACHE_SIZE) logCache.shift();
|
|
6383
6383
|
ctx.parallel("llob/log", logRecord);
|
|
6384
6384
|
if (!enable) return;
|
|
6385
|
-
content = `[${record.type}] | ${content}`;
|
|
6385
|
+
content = `[${record.type}] | ${content}\n`;
|
|
6386
6386
|
if (currentSize >= MAX_FILE_SIZE || currentEntries >= MAX_ENTRIES) rotate();
|
|
6387
6387
|
appendFile(currentFile, content, noop);
|
|
6388
6388
|
currentEntries++;
|
|
@@ -8499,10 +8499,10 @@ var Misc;
|
|
|
8499
8499
|
//#region src/ntqqapi/native/pmhq/mixins/friend.ts
|
|
8500
8500
|
function FriendMixin(Base) {
|
|
8501
8501
|
return class extends Base {
|
|
8502
|
-
async sendFriendPoke(
|
|
8502
|
+
async sendFriendPoke(friendUin, toUin) {
|
|
8503
8503
|
const body = Oidb.SendPokeReq.encode({
|
|
8504
|
-
toUin
|
|
8505
|
-
friendUin
|
|
8504
|
+
toUin,
|
|
8505
|
+
friendUin
|
|
8506
8506
|
});
|
|
8507
8507
|
const data = Oidb.Base.encode({
|
|
8508
8508
|
command: 3795,
|
|
@@ -9576,7 +9576,7 @@ var processQueue = async () => {
|
|
|
9576
9576
|
const promises = queue.splice(0, concurrency).map(async ({ filePath, resolve, reject }) => {
|
|
9577
9577
|
let handle;
|
|
9578
9578
|
try {
|
|
9579
|
-
handle = await fs$
|
|
9579
|
+
handle = await fs$10.promises.open(path$9.resolve(filePath), "r");
|
|
9580
9580
|
} catch (err) {
|
|
9581
9581
|
return reject(err);
|
|
9582
9582
|
}
|
|
@@ -9623,7 +9623,7 @@ function checkUriType(uri) {
|
|
|
9623
9623
|
if (uri.startsWith("data:")) return { type: FileUriType.DataURL };
|
|
9624
9624
|
if (uri.startsWith("http://") || uri.startsWith("https://")) return { type: FileUriType.RemoteURL };
|
|
9625
9625
|
if (uri.startsWith("file://")) return { type: FileUriType.FileURL };
|
|
9626
|
-
if (fs$
|
|
9626
|
+
if (fs$2.existsSync(uri)) return { type: FileUriType.Path };
|
|
9627
9627
|
return { type: FileUriType.Unknown };
|
|
9628
9628
|
}
|
|
9629
9629
|
async function fetchFile(url, headersInit) {
|
|
@@ -9653,7 +9653,7 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
9653
9653
|
const { type } = checkUriType(uri);
|
|
9654
9654
|
if (type === FileUriType.FileURL) {
|
|
9655
9655
|
const filePath = fileURLToPath(uri);
|
|
9656
|
-
if (!fs$
|
|
9656
|
+
if (!fs$2.existsSync(filePath)) return {
|
|
9657
9657
|
success: false,
|
|
9658
9658
|
errMsg: "路径不存在",
|
|
9659
9659
|
fileName: "",
|
|
@@ -9679,12 +9679,12 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
9679
9679
|
const res = await fetchFile(uri);
|
|
9680
9680
|
let fileName = randomUUID();
|
|
9681
9681
|
let filePath = path.join(TEMP_DIR, fileName);
|
|
9682
|
-
await
|
|
9682
|
+
await fs.writeFile(filePath, res.data);
|
|
9683
9683
|
if (needExt) {
|
|
9684
9684
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
9685
9685
|
fileName += `.${ext}`;
|
|
9686
9686
|
const newPath = `${filePath}.${ext}`;
|
|
9687
|
-
await
|
|
9687
|
+
await fs.rename(filePath, newPath);
|
|
9688
9688
|
filePath = newPath;
|
|
9689
9689
|
}
|
|
9690
9690
|
return {
|
|
@@ -9707,11 +9707,11 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
9707
9707
|
let filename = randomUUID();
|
|
9708
9708
|
let filePath = path.join(TEMP_DIR, filename);
|
|
9709
9709
|
const base64 = uri.replace(/^base64:\/\//, "");
|
|
9710
|
-
await
|
|
9710
|
+
await fs.writeFile(filePath, base64, "base64");
|
|
9711
9711
|
if (needExt) {
|
|
9712
9712
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
9713
9713
|
filename += `.${ext}`;
|
|
9714
|
-
await
|
|
9714
|
+
await fs.rename(filePath, `${filePath}.${ext}`);
|
|
9715
9715
|
filePath = `${filePath}.${ext}`;
|
|
9716
9716
|
}
|
|
9717
9717
|
return {
|
|
@@ -9728,11 +9728,11 @@ async function uri2local(ctx, uri, needExt) {
|
|
|
9728
9728
|
let filename = randomUUID();
|
|
9729
9729
|
const [, _type, base64] = capture;
|
|
9730
9730
|
let filePath = path.join(TEMP_DIR, filename);
|
|
9731
|
-
await
|
|
9731
|
+
await fs.writeFile(filePath, base64, "base64");
|
|
9732
9732
|
if (needExt) {
|
|
9733
9733
|
const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
|
|
9734
9734
|
filename += `.${ext}`;
|
|
9735
|
-
await
|
|
9735
|
+
await fs.rename(filePath, `${filePath}.${ext}`);
|
|
9736
9736
|
filePath = `${filePath}.${ext}`;
|
|
9737
9737
|
}
|
|
9738
9738
|
return {
|
|
@@ -9790,13 +9790,13 @@ async function getImageSize(path) {
|
|
|
9790
9790
|
}
|
|
9791
9791
|
async function getMd5HexFromFile(filePath) {
|
|
9792
9792
|
const hash = createHash("md5");
|
|
9793
|
-
const stream = fs$
|
|
9793
|
+
const stream = fs$2.createReadStream(filePath);
|
|
9794
9794
|
for await (const chunk of stream) hash.update(chunk);
|
|
9795
9795
|
return hash.digest("hex");
|
|
9796
9796
|
}
|
|
9797
9797
|
async function getSha1HexFromFile(filePath) {
|
|
9798
9798
|
const hash = createHash("sha1");
|
|
9799
|
-
const stream = fs$
|
|
9799
|
+
const stream = fs$2.createReadStream(filePath);
|
|
9800
9800
|
for await (const chunk of stream) hash.update(chunk);
|
|
9801
9801
|
return hash.digest("hex");
|
|
9802
9802
|
}
|
|
@@ -9805,13 +9805,13 @@ function getMd5BufferFromBuffer(buf) {
|
|
|
9805
9805
|
}
|
|
9806
9806
|
async function getMd5BufferFromFile(filePath) {
|
|
9807
9807
|
const hash = createHash("md5");
|
|
9808
|
-
const stream = fs$
|
|
9808
|
+
const stream = fs$2.createReadStream(filePath);
|
|
9809
9809
|
for await (const chunk of stream) hash.update(chunk);
|
|
9810
9810
|
return hash.digest();
|
|
9811
9811
|
}
|
|
9812
9812
|
async function getSha1BufferFromFile(filePath) {
|
|
9813
9813
|
const hash = createHash("sha1");
|
|
9814
|
-
const stream = fs$
|
|
9814
|
+
const stream = fs$2.createReadStream(filePath);
|
|
9815
9815
|
for await (const chunk of stream) hash.update(chunk);
|
|
9816
9816
|
return hash.digest();
|
|
9817
9817
|
}
|
|
@@ -10047,7 +10047,7 @@ async function calculateSha1StreamBytes(filePath) {
|
|
|
10047
10047
|
let bytesRead = 0;
|
|
10048
10048
|
let nextBlockBoundary = blockSize;
|
|
10049
10049
|
const byteArrayList = [];
|
|
10050
|
-
const readable = fs$
|
|
10050
|
+
const readable = fs$2.createReadStream(filePath);
|
|
10051
10051
|
for await (const chunk of readable) {
|
|
10052
10052
|
let buf;
|
|
10053
10053
|
if (tail.length > 0) {
|
|
@@ -10072,7 +10072,7 @@ async function calculateSha1StreamBytes(filePath) {
|
|
|
10072
10072
|
}
|
|
10073
10073
|
async function readAndHash10M(filePath) {
|
|
10074
10074
|
const maxSize = 10002432;
|
|
10075
|
-
const fd = await
|
|
10075
|
+
const fd = await fs.open(filePath, "r");
|
|
10076
10076
|
const buffer = Buffer.allocUnsafe(maxSize);
|
|
10077
10077
|
const { bytesRead } = await fd.read(buffer, 0, maxSize, 0);
|
|
10078
10078
|
await fd.close();
|
|
@@ -10114,7 +10114,7 @@ var TriSha1 = class {
|
|
|
10114
10114
|
};
|
|
10115
10115
|
async function calculateTriSha1(filePath, fileSize) {
|
|
10116
10116
|
const hash = new TriSha1(fileSize);
|
|
10117
|
-
const stream = fs$
|
|
10117
|
+
const stream = fs$2.createReadStream(filePath);
|
|
10118
10118
|
for await (const chunk of stream) hash.update(chunk);
|
|
10119
10119
|
return hash.finalize();
|
|
10120
10120
|
}
|
|
@@ -11378,7 +11378,7 @@ var ConfigUtil = class {
|
|
|
11378
11378
|
console.log("配置文件位于", this.configPath);
|
|
11379
11379
|
this.config = this.getConfig();
|
|
11380
11380
|
if (this.configPath) {
|
|
11381
|
-
fs$
|
|
11381
|
+
fs$2.watchFile(this.configPath, {
|
|
11382
11382
|
persistent: true,
|
|
11383
11383
|
interval: 1e3
|
|
11384
11384
|
}, () => {
|
|
@@ -11395,7 +11395,7 @@ var ConfigUtil = class {
|
|
|
11395
11395
|
}
|
|
11396
11396
|
getDefaultConfig() {
|
|
11397
11397
|
const _defaultConfig = { ...defaultConfig };
|
|
11398
|
-
const defaultConfigFromFile = fs$
|
|
11398
|
+
const defaultConfigFromFile = fs$2.readFileSync(this.defaultConfigPath, "utf-8");
|
|
11399
11399
|
try {
|
|
11400
11400
|
const parsedDefaultConfig = import_dist.default.parse(defaultConfigFromFile);
|
|
11401
11401
|
Object.assign(_defaultConfig, parsedDefaultConfig);
|
|
@@ -11406,12 +11406,12 @@ var ConfigUtil = class {
|
|
|
11406
11406
|
}
|
|
11407
11407
|
reloadConfig() {
|
|
11408
11408
|
if (!this.configPath) return this.getDefaultConfig();
|
|
11409
|
-
if (!fs$
|
|
11409
|
+
if (!fs$2.existsSync(this.configPath)) {
|
|
11410
11410
|
this.config = this.getDefaultConfig();
|
|
11411
11411
|
this.setConfig(this.config);
|
|
11412
11412
|
return this.config;
|
|
11413
11413
|
} else {
|
|
11414
|
-
const data = fs$
|
|
11414
|
+
const data = fs$2.readFileSync(this.configPath, "utf-8");
|
|
11415
11415
|
let jsonData = defaultConfig;
|
|
11416
11416
|
try {
|
|
11417
11417
|
jsonData = import_dist.default.parse(data);
|
|
@@ -11437,7 +11437,7 @@ var ConfigUtil = class {
|
|
|
11437
11437
|
writeConfig(config) {
|
|
11438
11438
|
if (!this.configPath) return;
|
|
11439
11439
|
this.watch = false;
|
|
11440
|
-
fs$
|
|
11440
|
+
fs$2.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
11441
11441
|
setTimeout(() => {
|
|
11442
11442
|
this.watch = true;
|
|
11443
11443
|
}, 1500);
|
|
@@ -11549,13 +11549,13 @@ var WebUITokenUtil = class {
|
|
|
11549
11549
|
}
|
|
11550
11550
|
getToken() {
|
|
11551
11551
|
if (!this.token) {
|
|
11552
|
-
if (fs$
|
|
11552
|
+
if (fs$2.existsSync(this.tokenPath)) this.token = fs$2.readFileSync(this.tokenPath, "utf-8").trim();
|
|
11553
11553
|
}
|
|
11554
11554
|
return this.token;
|
|
11555
11555
|
}
|
|
11556
11556
|
setToken(token) {
|
|
11557
11557
|
this.token = token.trim();
|
|
11558
|
-
fs$
|
|
11558
|
+
fs$2.writeFileSync(this.tokenPath, token, "utf-8");
|
|
11559
11559
|
}
|
|
11560
11560
|
};
|
|
11561
11561
|
var webuiTokenUtil = new WebUITokenUtil(path.join(DATA_DIR, "webui_token.txt"));
|
|
@@ -11564,13 +11564,13 @@ var webuiTokenUtil = new WebUITokenUtil(path.join(DATA_DIR, "webui_token.txt"));
|
|
|
11564
11564
|
var logFileName = `llbot-${(/* @__PURE__ */ new Date()).toLocaleString("zh-CN")}.log`.replace(/\//g, "-").replace(/:/g, "-");
|
|
11565
11565
|
//#endregion
|
|
11566
11566
|
//#region src/version.ts
|
|
11567
|
-
var version$2 = "7.11.
|
|
11567
|
+
var version$2 = "7.11.4";
|
|
11568
11568
|
//#endregion
|
|
11569
11569
|
//#region node_modules/isexe/windows.js
|
|
11570
11570
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11571
11571
|
module.exports = isexe;
|
|
11572
11572
|
isexe.sync = sync;
|
|
11573
|
-
var fs$
|
|
11573
|
+
var fs$9 = __require("fs");
|
|
11574
11574
|
function checkPathExt(path, options) {
|
|
11575
11575
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
11576
11576
|
if (!pathext) return true;
|
|
@@ -11587,12 +11587,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11587
11587
|
return checkPathExt(path, options);
|
|
11588
11588
|
}
|
|
11589
11589
|
function isexe(path, options, cb) {
|
|
11590
|
-
fs$
|
|
11590
|
+
fs$9.stat(path, function(er, stat) {
|
|
11591
11591
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
11592
11592
|
});
|
|
11593
11593
|
}
|
|
11594
11594
|
function sync(path, options) {
|
|
11595
|
-
return checkStat(fs$
|
|
11595
|
+
return checkStat(fs$9.statSync(path), path, options);
|
|
11596
11596
|
}
|
|
11597
11597
|
}));
|
|
11598
11598
|
//#endregion
|
|
@@ -11600,14 +11600,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11600
11600
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11601
11601
|
module.exports = isexe;
|
|
11602
11602
|
isexe.sync = sync;
|
|
11603
|
-
var fs$
|
|
11603
|
+
var fs$8 = __require("fs");
|
|
11604
11604
|
function isexe(path, options, cb) {
|
|
11605
|
-
fs$
|
|
11605
|
+
fs$8.stat(path, function(er, stat) {
|
|
11606
11606
|
cb(er, er ? false : checkStat(stat, options));
|
|
11607
11607
|
});
|
|
11608
11608
|
}
|
|
11609
11609
|
function sync(path, options) {
|
|
11610
|
-
return checkStat(fs$
|
|
11610
|
+
return checkStat(fs$8.statSync(path), options);
|
|
11611
11611
|
}
|
|
11612
11612
|
function checkStat(stat, options) {
|
|
11613
11613
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -14017,7 +14017,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14017
14017
|
//#endregion
|
|
14018
14018
|
//#region node_modules/fluent-ffmpeg/lib/capabilities.js
|
|
14019
14019
|
var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14020
|
-
var fs$
|
|
14020
|
+
var fs$7 = __require("fs");
|
|
14021
14021
|
var path$6 = __require("path");
|
|
14022
14022
|
var async = require_async();
|
|
14023
14023
|
var utils = require_utils();
|
|
@@ -14093,7 +14093,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14093
14093
|
proto._getFfmpegPath = function(callback) {
|
|
14094
14094
|
if ("ffmpegPath" in cache) return callback(null, cache.ffmpegPath);
|
|
14095
14095
|
async.waterfall([function(cb) {
|
|
14096
|
-
if (process.env.FFMPEG_PATH) fs$
|
|
14096
|
+
if (process.env.FFMPEG_PATH) fs$7.exists(process.env.FFMPEG_PATH, function(exists) {
|
|
14097
14097
|
if (exists) cb(null, process.env.FFMPEG_PATH);
|
|
14098
14098
|
else cb(null, "");
|
|
14099
14099
|
});
|
|
@@ -14124,7 +14124,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14124
14124
|
if ("ffprobePath" in cache) return callback(null, cache.ffprobePath);
|
|
14125
14125
|
async.waterfall([
|
|
14126
14126
|
function(cb) {
|
|
14127
|
-
if (process.env.FFPROBE_PATH) fs$
|
|
14127
|
+
if (process.env.FFPROBE_PATH) fs$7.exists(process.env.FFPROBE_PATH, function(exists) {
|
|
14128
14128
|
cb(null, exists ? process.env.FFPROBE_PATH : "");
|
|
14129
14129
|
});
|
|
14130
14130
|
else cb(null, "");
|
|
@@ -14142,7 +14142,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14142
14142
|
else if (ffmpeg.length) {
|
|
14143
14143
|
var name = utils.isWindows ? "ffprobe.exe" : "ffprobe";
|
|
14144
14144
|
var ffprobe = path$6.join(path$6.dirname(ffmpeg), name);
|
|
14145
|
-
fs$
|
|
14145
|
+
fs$7.exists(ffprobe, function(exists) {
|
|
14146
14146
|
cb(null, exists ? ffprobe : "");
|
|
14147
14147
|
});
|
|
14148
14148
|
} else cb(null, "");
|
|
@@ -14167,14 +14167,14 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14167
14167
|
if ("flvtoolPath" in cache) return callback(null, cache.flvtoolPath);
|
|
14168
14168
|
async.waterfall([
|
|
14169
14169
|
function(cb) {
|
|
14170
|
-
if (process.env.FLVMETA_PATH) fs$
|
|
14170
|
+
if (process.env.FLVMETA_PATH) fs$7.exists(process.env.FLVMETA_PATH, function(exists) {
|
|
14171
14171
|
cb(null, exists ? process.env.FLVMETA_PATH : "");
|
|
14172
14172
|
});
|
|
14173
14173
|
else cb(null, "");
|
|
14174
14174
|
},
|
|
14175
14175
|
function(flvtool, cb) {
|
|
14176
14176
|
if (flvtool.length) return cb(null, flvtool);
|
|
14177
|
-
if (process.env.FLVTOOL2_PATH) fs$
|
|
14177
|
+
if (process.env.FLVTOOL2_PATH) fs$7.exists(process.env.FLVTOOL2_PATH, function(exists) {
|
|
14178
14178
|
cb(null, exists ? process.env.FLVTOOL2_PATH : "");
|
|
14179
14179
|
});
|
|
14180
14180
|
else cb(null, "");
|
|
@@ -14679,7 +14679,7 @@ var require_ffprobe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14679
14679
|
//#endregion
|
|
14680
14680
|
//#region node_modules/fluent-ffmpeg/lib/recipes.js
|
|
14681
14681
|
var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14682
|
-
var fs$
|
|
14682
|
+
var fs$6 = __require("fs");
|
|
14683
14683
|
var path$5 = __require("path");
|
|
14684
14684
|
var PassThrough$4 = __require("stream").PassThrough;
|
|
14685
14685
|
var async = require_async();
|
|
@@ -14885,8 +14885,8 @@ var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14885
14885
|
next(null, filenames);
|
|
14886
14886
|
},
|
|
14887
14887
|
function createDirectory(filenames, next) {
|
|
14888
|
-
fs$
|
|
14889
|
-
if (!exists) fs$
|
|
14888
|
+
fs$6.exists(config.folder, function(exists) {
|
|
14889
|
+
if (!exists) fs$6.mkdir(config.folder, function(err) {
|
|
14890
14890
|
if (err) next(err);
|
|
14891
14891
|
else next(null, filenames);
|
|
14892
14892
|
});
|
|
@@ -15130,7 +15130,7 @@ var import_fluent_ffmpeg = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
15130
15130
|
})))(), 1);
|
|
15131
15131
|
var defaultVideoThumb = Buffer.from("/9j/4AAQSkZJRgABAQAAAQABAAD//gAXR2VuZXJhdGVkIGJ5IFNuaXBhc3Rl/9sAhAAKBwcIBwYKCAgICwoKCw4YEA4NDQ4dFRYRGCMfJSQiHyIhJis3LyYpNCkhIjBBMTQ5Oz4+PiUuRElDPEg3PT47AQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAF/APADAREAAhEBAxEB/8QBogAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoLEAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+foBAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKCxEAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDiAayNxwagBwNAC5oAM0xBmgBM0ANJoAjY0AQsaBkTGgCM0DEpAFAC0AFMBaACgAoEJTASgQlACUwCgQ4UAOFADhQA4UAOFADxQIkBqDQUGgBwagBQaBC5pgGaAELUAMLUARs1AETGgBhNAxhoASkAUALQIKYxaBBQAUwEoAQ0CEoASmAUAOoEKKAHCgBwoAeKAHigQ7NZmoZpgLmgBd1Ahd1ABupgNLUAMLUAMY0AMJoAYaAENACUCCgAoAWgAoAWgBKYCUAJQISgApgLQAooEOFACigB4oAeKBDxQAVmaiZpgGaAFzQAbqAE3UAIWpgNJoAYTQIaaAEoAQ0CEoASgBaACgBaACmAUAJQAlAgoAKYC0AKKBCigB4FADgKBDwKAHigBuazNRM0DEzTAM0AJmgAzQAhNAhpNACGmA2gQlACUCEoAKACgBaAFpgFACUAJQAUCCmAUALQIcBQA4CgB4FADgKBDhQA4UAMzWZqNzTGJQAZoATNABmgBKAEoEIaYCUCEoASgQlABQAtABQAtMBKACgAoEFABimAYoEKBQA4CgB4FADwKBDgKAFFADhQBCazNhKAEpgFACUAFACUAFAhDTAbQISgAoEJQAUALQAtMAoAKADFABigQYoAMUALimIUCgBwFAh4FADgKAHUALQAtAENZmwlACUwEoAKAEoAKACgQlMBpoEJQAUCCgBcUAFABTAXFAC4oAMUAGKBBigAxQIKYCigQ8UAOFADhQAtAC0ALQBDWZqJQMSgBKYBQAlABQISgBKYCGgQlAC0CCgBcUAFABTAUCkA7FMAxQAYoEJQAUCCmAooEOFADxQA4UAFAC0ALQBDWZqJQAlACUxhQAlABQIKAEoASmISgBcUCCgBaACgBcUAKBQAuKYC0CEoAQ0AJQISmAooEPFADhQA4UALQAtAC0AQ1maiUAFACUAJTAKAEoAKAEoAMUxBigAxQIWgAoAKAFAoAWgBaYBQIQ0ANNACUCCmIUUAOFADxQA4UALQAtABQBFWZqFACUAFACYpgFACUAFACUAFAgxTEFABQAUALQAooAWgAoAKYDTQIaaAEpiCgQ4UAOFAh4oGOFAC0ALSAKYEdZmglABQAUDDFACUwEoASgAoAKBBQIKYBQAUALQAtAC0AJQAhpgNJoENJoATNMQCgQ8UCHigB4oAWgYtABQAUAMrM0CgAoAKADFACUxiUAJQAlAgoAKYgoAKACgYtAC0AFAhDTAQmgBhNAhpNACZpiFBoEPFAEi0CHigB1ABQAUDEoAbWZoFABQAtABTAQ0ANNAxDQAlAhaAEpiCgAoGFAC0AFABmgBCaYhpNADCaBDSaBBmgABpiJFNAEimgB4NADqAFzQAlACE0AJWZoFAC0AFAC0wEIoAaaAG0AJQAUCCgApjCgAoAKADNABmgBpNMQ0mgBpNAhhNAgzQAoNADwaAHqaAJAaBDgaYC5oATNACZoAWszQKACgBaBDqYCGgBpoAYaBiUCCgBKYBQMKACgAoAM0AITQIaTQA0mmA0mgQ3NAhKAHCgBwNADwaAHg0AOBpiFzQAZoATNAD6zNAoAKAFoEOpgBoAaaAGGmAw0AJmgAzQMM0AGaADNABmgBM0AITQIaTQAhNMQw0AJQIKAFFADhQA4GgBwNADs0xC5oAM0CDNAEtZmoUCCgBaAHUwCgBppgRtQAw0ANzQAZoAM0AGaADNABmgBKAEoAQ0ANNMQhoEJQAlMBaQDgaAFBoAcDTAdmgQuaADNAgzQBPWZqFAgoAWgBaYC0CGmmBG1AyM0ANJoATNACZoAXNABmgAzQAUAJQAhoAQ0xDTQISmAUALQAUgHA0AKDTAdmgQuaBBQAtAFiszQKACgBaAFFMAoEIaYEbUDI2oAYaAEoASgAzQAuaACgAoAKAENMQ00AJTEFAhKACgAoAXNACg0AOBoAWgQtAC0AWazNAoAKACgBaYBQIQ0AMNMYw0AMIoAbQAlMAoAKACgAzSAKYhKAENACUxBQIKACgBKACgBaAHCgQ4UALQAUAWqzNAoAKACgApgFACGgQ00xjTQAwigBCKAG4pgJQAlABQAUCCgBKACgBKYgoEFABQISgAoAWgBRQA4UALQAUCLdZmoUAFABQAlMAoASgBDQA00wENACYoATFMBpFADSKAEoEJQAUAFABQAlMQtAgoASgQUAJQAUAKKAHCgBaBBQBbrM1CgAoAKACmAUAJQAlADaYBQAlACYpgIRQA0igBpFAhtABQAUAFMAoEFABQIKAEoASgQUALQAooAWgQUAW81mbC0CCgApgFACUAIaAEpgJQAUAFABQAhFMBpFADSKAGkUCExQAYoAMUAGKADFMQYoAMUCExSATFABQIKYBQAtABQIt5qDYM0ALmgQtIApgIaAENADaACmAlAC0ALQAUwGkUANIoAaRQAmKBBigAxQAYoAMUAGKBBigBMUAJigQmKAExTAKBC0AFAFnNQaig0AKDQAtAgoASgBDQAlMBKACgAFADhQAtMBCKAGkUAIRQAmKADFABigQmKADFACYoAXFABigQmKAExQAmKBCYpgJigAoAnzUGgZoAcDQAuaBC0AJQAhoASmAlABQAtADhQAtMAoATFACEUAJigAxQAYoATFAhMUAFABQAuKADFABigBpWgBCKBCYpgJigB+ag0DNADgaBDgaAFzQITNACUAJTAKACgBRQAopgOoAWgBKAEoAKACgAoASgBpoEJQAooAWgBaBhigBMUCEIoAQigBMUAJSLCgBQaBDgaQC5oEFACUwCgBKACmAtADhQA4UALQAUAJQAUAJQAUAJQAhoENoAWgBRQAooGLQAUAGKAGkUAIRQIZSKEoGKKBDhQAUCCgAoAKBBQAUwFoGKKAHCgBaACgAoASgAoASgBCaAEoEJmgAoAUGgBQaAHZoGFABQAUANoAjpDEoAWgBaAFoEFACUALQAUCCmAUAOFAxRQAtAC0AJQAUAJQAmaBDSaAEzQAmaYBmgBQaAHA0gFzQAuaBhmgAzQAlAEdIYUALQAtAgoAKAEoEFAC0AFMAoAUUDFFAC0ALQAUAJQAhoENNACE0wEoATNABmgBc0ALmgBc0gDNAC5oATNABmgBKRQlACigB1AgoASgQlABTAWgBKACgBaBi0ALQAZoAM0AFACGgQ00wENACUAJQAUCFzQMM0ALmgAzQAZoAM0AGaQC0igoAUUALQIWgBDQISmAUAFACUAFABQAuaBi5oAM0AGaBBmgBKAEpgIaAG0AJQAUCFoAM0DDNAC5oATNABmgAzQBJUlBQAooAWgQtACGmIaaACgAoASgBKACgBc0DCgQUAGaADNABTASgBDQAlACUAFAgoAKBhQAUAFABQAlAE1SUFAxRQIWgQtMBDQIQ0AJQAlAhKBiUAFABmgBc0AGaADNABTAKACgBKAEoASgQlABQAUAFAC0AFACUAFAE1SaBQAUCHCgQtMBKBCUAJQISgBDQA00DEzQAuaADNMBc0AGaADNABQAUAJQAlABQISgAoAKACgBaACgBKAEoAnqTQSgBRQIcKBC0xCUAJQISgBKAENADDQAmaYwzQAuaADNAC0AFABQAUAFAhKACgBKACgAoAWgAoELQAlAxKAJqk0EoAWgQooELTEFADaBCUABoENNMY00ANNAwzQAZoAXNAC0AFAC0CFoASgAoASgBKACgAoAWgQtABQAUANNAyWpNAoAKBCimIWgQUCEoASmIQ0ANNADTQMaaAEoGLmgAzQAtADhQIWgBaACgQhoASgYlACUALQIWgBaACgBKAENAyWpNBKYBQIcKBC0CEoEJTAKBCUANNADDQMQ0ANoGFAC5oAUGgBwNAhRQIWgBaAENACGgBtAwoAKAFzQIXNABmgAoAQ0DJKRoJQAtAhRQSLQIKYCUCCgBDQA00AMNAxpoGNoAM0AGaAFBoAcDQIcKBDqACgBDQAhoAQ0DEoAKADNAC5oEGaBhmgAoAkpGgUCCgQooELQIKYhKACgBKAGmgBpoGMNAxDQAlAwzQIUUAOFAhwoAcKBC0AJQAhoGNNACUAFABQAZoAXNABQAUAS0ixKACgQoNAhaYgoEFACUABoAaaAGmgYw0DENAxtABQAooEOFADhQIcKAFoASgBDQAhoGJQAUAFACUALQIKBi0CJDSLEoATNAhc0CHZpiCgQUAJQIKBjTQAhoGNNAxpoATFABigBQKAHCgBwoAWgAoAKACgBKAEoASgAoASgBaAAUAOoEONIoaTQAZoAUGmIUGgQtAgzQISgAoAQ0DGmgYlAxKACgAxQAtACigBRQAtAxaACgAoATFABigBCKAG0CEoAWgBRTAUUAf//Z", "base64");
|
|
15132
15132
|
async function getVideoInfo(filePath) {
|
|
15133
|
-
const size = fs$
|
|
15133
|
+
const size = fs$2.statSync(filePath).size;
|
|
15134
15134
|
return new Promise((resolve, reject) => {
|
|
15135
15135
|
(0, import_fluent_ffmpeg.default)(filePath).ffprobe((err, metadata) => {
|
|
15136
15136
|
if (err) reject(err);
|
|
@@ -15207,7 +15207,7 @@ function convert(ctx, input, options, outputPath) {
|
|
|
15207
15207
|
});
|
|
15208
15208
|
}
|
|
15209
15209
|
async function encodeSilk(ctx, filePath) {
|
|
15210
|
-
const file = await
|
|
15210
|
+
const file = await fs.readFile(filePath);
|
|
15211
15211
|
if (!isSilk(file)) {
|
|
15212
15212
|
ctx.logger.info(`语音文件${filePath}需要转换成silk`);
|
|
15213
15213
|
let result;
|
|
@@ -15226,7 +15226,7 @@ async function encodeSilk(ctx, filePath) {
|
|
|
15226
15226
|
"-f s16le"
|
|
15227
15227
|
] }), 24e3);
|
|
15228
15228
|
const pttPath = path.join(TEMP_DIR, randomUUID());
|
|
15229
|
-
await
|
|
15229
|
+
await fs.writeFile(pttPath, result.data);
|
|
15230
15230
|
ctx.logger.info(`语音文件${filePath}转换成功!`, pttPath, `时长:`, result.duration);
|
|
15231
15231
|
return {
|
|
15232
15232
|
converted: true,
|
|
@@ -15249,11 +15249,11 @@ async function encodeSilk(ctx, filePath) {
|
|
|
15249
15249
|
}
|
|
15250
15250
|
}
|
|
15251
15251
|
async function decodeSilk(ctx, inputFilePath, outFormat) {
|
|
15252
|
-
const { data } = await decode(await
|
|
15252
|
+
const { data } = await decode(await fs.readFile(inputFilePath), 24e3);
|
|
15253
15253
|
const tmpPath = path.join(TEMP_DIR, path.basename(inputFilePath));
|
|
15254
15254
|
const outFilePath = tmpPath + `.${outFormat}`;
|
|
15255
15255
|
const pcmFilePath = tmpPath + ".pcm";
|
|
15256
|
-
await
|
|
15256
|
+
await fs.writeFile(pcmFilePath, data);
|
|
15257
15257
|
return convert(ctx, pcmFilePath, { input: [
|
|
15258
15258
|
"-f s16le",
|
|
15259
15259
|
"-ar 24000",
|
|
@@ -16437,7 +16437,7 @@ function setFFMpegPath(ffmpegPath) {
|
|
|
16437
16437
|
path.join(import.meta.dirname, "ffmpeg.exe"),
|
|
16438
16438
|
process.env["FFMPEG_PATH"] || ""
|
|
16439
16439
|
];
|
|
16440
|
-
for (const p of paths) if (fs$
|
|
16440
|
+
for (const p of paths) if (fs$2.existsSync(p)) {
|
|
16441
16441
|
import_fluent_ffmpeg.default.setFfmpegPath(p);
|
|
16442
16442
|
console.log("set ffmpeg successfully", p);
|
|
16443
16443
|
break;
|
|
@@ -17003,7 +17003,7 @@ async function transformIncomingSegments$1(ctx, message, rootMsgID, peer) {
|
|
|
17003
17003
|
try {
|
|
17004
17004
|
const { replayMsgSeq, replyMsgTime, sourceMsgIdInRecords, senderUidStr } = replyElement;
|
|
17005
17005
|
const record = message.records.find((msgRecord) => msgRecord.msgId === sourceMsgIdInRecords);
|
|
17006
|
-
const { msgList } = await ctx.ntMsgApi.queryMsgsWithFilterExBySeq(peer, replayMsgSeq, replyMsgTime, [senderUidStr]);
|
|
17006
|
+
const { msgList } = await ctx.ntMsgApi.queryMsgsWithFilterExBySeq(peer, replayMsgSeq, replyMsgTime, senderUidStr ? [senderUidStr] : []);
|
|
17007
17007
|
let replyMsg;
|
|
17008
17008
|
if (record && record.msgRandom !== "0") replyMsg = msgList.find((msg) => msg.msgRandom === record.msgRandom);
|
|
17009
17009
|
else if (msgList.length > 0) replyMsg = msgList[0];
|
|
@@ -24804,7 +24804,10 @@ var OB11Http = class {
|
|
|
24804
24804
|
async handleRequest(c, next) {
|
|
24805
24805
|
let payload;
|
|
24806
24806
|
if (c.req.method === "POST") if (c.req.header("Content-Type")?.includes("application/x-www-form-urlencoded")) payload = await c.req.parseBody();
|
|
24807
|
-
else
|
|
24807
|
+
else {
|
|
24808
|
+
const text = await c.req.text();
|
|
24809
|
+
payload = text ? JSON.parse(text) : {};
|
|
24810
|
+
}
|
|
24808
24811
|
else payload = c.req.query();
|
|
24809
24812
|
this.ctx.logger.info("收到 HTTP 请求", c.req.url, payload);
|
|
24810
24813
|
const actionName = c.req.param("endpoint");
|
|
@@ -24980,6 +24983,7 @@ var ActionName = /* @__PURE__ */ function(ActionName) {
|
|
|
24980
24983
|
ActionName["GetDoubtFriendsAddRequest"] = "get_doubt_friends_add_request";
|
|
24981
24984
|
ActionName["SetDoubtFriendsAddRequest"] = "set_doubt_friends_add_request";
|
|
24982
24985
|
ActionName["DeleteGroupNotice"] = "_delete_group_notice";
|
|
24986
|
+
ActionName["SendPoke"] = "send_poke";
|
|
24983
24987
|
ActionName["SendLike"] = "send_like";
|
|
24984
24988
|
ActionName["GetLoginInfo"] = "get_login_info";
|
|
24985
24989
|
ActionName["GetFriendList"] = "get_friend_list";
|
|
@@ -26267,17 +26271,17 @@ var DownloadFile = class extends BaseAction {
|
|
|
26267
26271
|
const isRandomName = !payload.name;
|
|
26268
26272
|
const name = payload.name ? path.basename(payload.name) : randomUUID();
|
|
26269
26273
|
const filePath = path.join(TEMP_DIR, name);
|
|
26270
|
-
if (payload.base64) await fsPromise
|
|
26274
|
+
if (payload.base64) await fsPromise.writeFile(filePath, payload.base64, "base64");
|
|
26271
26275
|
else if (payload.url) {
|
|
26272
26276
|
const headers = this.getHeaders(payload.headers);
|
|
26273
26277
|
const res = await fetchFile(payload.url, headers);
|
|
26274
|
-
await fsPromise
|
|
26278
|
+
await fsPromise.writeFile(filePath, res.data);
|
|
26275
26279
|
} else throw new Error("不存在任何文件, 无法下载");
|
|
26276
|
-
if (fs.existsSync(filePath)) {
|
|
26280
|
+
if (fs$1.existsSync(filePath)) {
|
|
26277
26281
|
if (isRandomName) {
|
|
26278
26282
|
const md5 = await getMd5HexFromFile(filePath);
|
|
26279
26283
|
const newPath = path.join(TEMP_DIR, md5);
|
|
26280
|
-
await fsPromise
|
|
26284
|
+
await fsPromise.rename(filePath, newPath);
|
|
26281
26285
|
return { file: newPath };
|
|
26282
26286
|
}
|
|
26283
26287
|
return { file: filePath };
|
|
@@ -27176,9 +27180,12 @@ var GroupPoke = class extends BaseAction {
|
|
|
27176
27180
|
//#region src/onebot11/action/llbot/user/FriendPoke.ts
|
|
27177
27181
|
var FriendPoke = class extends BaseAction {
|
|
27178
27182
|
actionName = ActionName.FriendPoke;
|
|
27179
|
-
payloadSchema = lib_default$1.object({
|
|
27183
|
+
payloadSchema = lib_default$1.object({
|
|
27184
|
+
user_id: lib_default$1.union([Number, String]).required(),
|
|
27185
|
+
target_id: lib_default$1.union([Number, String])
|
|
27186
|
+
});
|
|
27180
27187
|
async _handle(payload) {
|
|
27181
|
-
await this.ctx.app.pmhq.sendFriendPoke(+payload.user_id);
|
|
27188
|
+
await this.ctx.app.pmhq.sendFriendPoke(+payload.user_id, payload.target_id ? +payload.target_id : +payload.user_id);
|
|
27182
27189
|
return null;
|
|
27183
27190
|
}
|
|
27184
27191
|
};
|
|
@@ -27916,6 +27923,21 @@ var ScanQRCode = class extends BaseAction {
|
|
|
27916
27923
|
}
|
|
27917
27924
|
};
|
|
27918
27925
|
//#endregion
|
|
27926
|
+
//#region src/onebot11/action/llbot/msg/SendPoke.ts
|
|
27927
|
+
var SendPoke = class extends BaseAction {
|
|
27928
|
+
actionName = ActionName.SendPoke;
|
|
27929
|
+
payloadSchema = lib_default$1.object({
|
|
27930
|
+
group_id: lib_default$1.union([Number, String]),
|
|
27931
|
+
user_id: lib_default$1.union([Number, String]).required(),
|
|
27932
|
+
target_id: lib_default$1.union([Number, String])
|
|
27933
|
+
});
|
|
27934
|
+
async _handle(payload) {
|
|
27935
|
+
if (payload.group_id) await this.ctx.app.pmhq.sendGroupPoke(+payload.group_id, +payload.user_id);
|
|
27936
|
+
else await this.ctx.app.pmhq.sendFriendPoke(+payload.user_id, payload.target_id ? +payload.target_id : +payload.user_id);
|
|
27937
|
+
return null;
|
|
27938
|
+
}
|
|
27939
|
+
};
|
|
27940
|
+
//#endregion
|
|
27919
27941
|
//#region src/onebot11/action/index.ts
|
|
27920
27942
|
function initActionMap(adapter) {
|
|
27921
27943
|
const actionHandlers = [
|
|
@@ -27968,6 +27990,7 @@ function initActionMap(adapter) {
|
|
|
27968
27990
|
new GetDoubtFriendsAddRequest(adapter),
|
|
27969
27991
|
new SetDoubtFriendsAddRequest(adapter),
|
|
27970
27992
|
new DeleteGroupNotice(adapter),
|
|
27993
|
+
new SendPoke(adapter),
|
|
27971
27994
|
new SendLike(adapter),
|
|
27972
27995
|
new GetMsg(adapter),
|
|
27973
27996
|
new GetLoginInfo$1(adapter),
|
|
@@ -29313,7 +29336,7 @@ async function decodeElement(ctx, data, quoted = false) {
|
|
|
29313
29336
|
try {
|
|
29314
29337
|
const { replayMsgSeq, replyMsgTime, sourceMsgIdInRecords, senderUidStr } = v.replyElement;
|
|
29315
29338
|
const record = data.records.find((msgRecord) => msgRecord.msgId === sourceMsgIdInRecords);
|
|
29316
|
-
const { msgList } = await ctx.ntMsgApi.queryMsgsWithFilterExBySeq(peer, replayMsgSeq, replyMsgTime, [senderUidStr]);
|
|
29339
|
+
const { msgList } = await ctx.ntMsgApi.queryMsgsWithFilterExBySeq(peer, replayMsgSeq, replyMsgTime, senderUidStr ? [senderUidStr] : []);
|
|
29317
29340
|
let replyMsg;
|
|
29318
29341
|
if (record && record.msgRandom !== "0") replyMsg = msgList.find((msg) => msg.msgRandom === record.msgRandom);
|
|
29319
29342
|
else replyMsg = msgList[0];
|
|
@@ -43910,628 +43933,656 @@ function transformProtocolOsType(type) {
|
|
|
43910
43933
|
}
|
|
43911
43934
|
//#endregion
|
|
43912
43935
|
//#region node_modules/@saltify/milky-types/dist/index.mjs
|
|
43913
|
-
var
|
|
43914
|
-
|
|
43915
|
-
|
|
43916
|
-
|
|
43917
|
-
var
|
|
43918
|
-
var
|
|
43919
|
-
|
|
43920
|
-
|
|
43921
|
-
|
|
43922
|
-
|
|
43923
|
-
|
|
43924
|
-
|
|
43936
|
+
var zUin = number$1().int().min(10001).max(4294967295);
|
|
43937
|
+
function zDropBadElementArray(element) {
|
|
43938
|
+
return array(element.catch(null)).transform((val) => val.filter((item) => item !== null));
|
|
43939
|
+
}
|
|
43940
|
+
var BotOfflineEventData = object({ reason: string$1().describe("下线原因") }).describe("机器人离线事件");
|
|
43941
|
+
var MessageRecallEventData = object({
|
|
43942
|
+
message_scene: _enum([
|
|
43943
|
+
"friend",
|
|
43944
|
+
"group",
|
|
43945
|
+
"temp"
|
|
43946
|
+
]).describe("消息场景"),
|
|
43947
|
+
peer_id: zUin.describe("好友 QQ 号或群号"),
|
|
43948
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
43949
|
+
sender_id: zUin.describe("被撤回的消息的发送者 QQ 号"),
|
|
43950
|
+
operator_id: zUin.describe("操作者 QQ 号"),
|
|
43951
|
+
display_suffix: string$1().describe("撤回提示的后缀文本")
|
|
43952
|
+
}).describe("消息撤回事件");
|
|
43953
|
+
var PeerPinChangeEventData = object({
|
|
43954
|
+
message_scene: _enum([
|
|
43955
|
+
"friend",
|
|
43956
|
+
"group",
|
|
43957
|
+
"temp"
|
|
43958
|
+
]).describe("发生改变的会话的消息场景"),
|
|
43959
|
+
peer_id: zUin.describe("发生改变的好友 QQ 号或群号"),
|
|
43960
|
+
is_pinned: boolean$1().describe("是否被置顶, `false` 表示取消置顶")
|
|
43961
|
+
}).describe("会话置顶变更事件");
|
|
43962
|
+
var FriendRequestEventData = object({
|
|
43963
|
+
initiator_id: zUin.describe("申请好友的用户 QQ 号"),
|
|
43964
|
+
initiator_uid: string$1().describe("用户 UID"),
|
|
43965
|
+
comment: string$1().describe("申请附加信息"),
|
|
43966
|
+
via: string$1().describe("申请来源")
|
|
43967
|
+
}).describe("好友请求事件");
|
|
43968
|
+
var GroupJoinRequestEventData = object({
|
|
43969
|
+
group_id: zUin.describe("群号"),
|
|
43970
|
+
notification_seq: number$1().int().nonnegative().describe("请求对应的通知序列号"),
|
|
43971
|
+
is_filtered: boolean$1().describe("请求是否被过滤(发起自风险账户)"),
|
|
43972
|
+
initiator_id: zUin.describe("申请入群的用户 QQ 号"),
|
|
43973
|
+
comment: string$1().describe("申请附加信息")
|
|
43974
|
+
}).describe("入群请求事件");
|
|
43975
|
+
var GroupInvitedJoinRequestEventData = object({
|
|
43976
|
+
group_id: zUin.describe("群号"),
|
|
43977
|
+
notification_seq: number$1().int().nonnegative().describe("请求对应的通知序列号"),
|
|
43978
|
+
initiator_id: zUin.describe("邀请者 QQ 号"),
|
|
43979
|
+
target_user_id: zUin.describe("被邀请者 QQ 号")
|
|
43980
|
+
}).describe("群成员邀请他人入群请求事件");
|
|
43981
|
+
var GroupInvitationEventData = object({
|
|
43982
|
+
group_id: zUin.describe("群号"),
|
|
43983
|
+
invitation_seq: number$1().int().nonnegative().describe("邀请序列号"),
|
|
43984
|
+
initiator_id: zUin.describe("邀请者 QQ 号"),
|
|
43985
|
+
source_group_id: number$1().int().nonnegative().nullish().describe("来源群号,如果是通过 QQ 群邀请")
|
|
43986
|
+
}).describe("他人邀请自身入群事件");
|
|
43987
|
+
var FriendNudgeEventData = object({
|
|
43988
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
43989
|
+
is_self_send: boolean$1().describe("是否是自己发送的戳一戳"),
|
|
43990
|
+
is_self_receive: boolean$1().describe("是否是自己接收的戳一戳"),
|
|
43991
|
+
display_action: string$1().describe("戳一戳提示的动作文本"),
|
|
43992
|
+
display_suffix: string$1().describe("戳一戳提示的后缀文本"),
|
|
43993
|
+
display_action_img_url: string$1().describe("戳一戳提示的动作图片 URL,用于取代动作提示文本")
|
|
43994
|
+
}).describe("好友戳一戳事件");
|
|
43995
|
+
var FriendFileUploadEventData = object({
|
|
43996
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
43997
|
+
file_id: string$1().describe("文件 ID"),
|
|
43998
|
+
file_name: string$1().describe("文件名称"),
|
|
43999
|
+
file_size: number$1().int().nonnegative().describe("文件大小(字节)"),
|
|
44000
|
+
file_hash: string$1().describe("文件的 TriSHA1 哈希值"),
|
|
44001
|
+
is_self: boolean$1().describe("是否是自己发送的文件")
|
|
44002
|
+
}).describe("好友文件上传事件");
|
|
44003
|
+
var GroupAdminChangeEventData = object({
|
|
44004
|
+
group_id: zUin.describe("群号"),
|
|
44005
|
+
user_id: zUin.describe("发生变更的用户 QQ 号"),
|
|
44006
|
+
operator_id: zUin.describe("操作者 QQ 号"),
|
|
44007
|
+
is_set: boolean$1().describe("是否被设置为管理员,`false` 表示被取消管理员")
|
|
44008
|
+
}).describe("群管理员变更事件");
|
|
44009
|
+
var GroupEssenceMessageChangeEventData = object({
|
|
44010
|
+
group_id: zUin.describe("群号"),
|
|
44011
|
+
message_seq: number$1().int().nonnegative().describe("发生变更的消息序列号"),
|
|
44012
|
+
operator_id: zUin.describe("操作者 QQ 号"),
|
|
44013
|
+
is_set: boolean$1().describe("是否被设置为精华,`false` 表示被取消精华")
|
|
44014
|
+
}).describe("群精华消息变更事件");
|
|
44015
|
+
var GroupMemberIncreaseEventData = object({
|
|
44016
|
+
group_id: zUin.describe("群号"),
|
|
44017
|
+
user_id: zUin.describe("发生变更的用户 QQ 号"),
|
|
44018
|
+
operator_id: number$1().int().nonnegative().nullish().describe("管理员 QQ 号,如果是管理员同意入群"),
|
|
44019
|
+
invitor_id: number$1().int().nonnegative().nullish().describe("邀请者 QQ 号,如果是邀请入群")
|
|
44020
|
+
}).describe("群成员增加事件");
|
|
44021
|
+
var GroupMemberDecreaseEventData = object({
|
|
44022
|
+
group_id: zUin.describe("群号"),
|
|
44023
|
+
user_id: zUin.describe("发生变更的用户 QQ 号"),
|
|
44024
|
+
operator_id: number$1().int().nonnegative().nullish().describe("管理员 QQ 号,如果是管理员踢出")
|
|
44025
|
+
}).describe("群成员减少事件");
|
|
44026
|
+
var GroupNameChangeEventData = object({
|
|
44027
|
+
group_id: zUin.describe("群号"),
|
|
44028
|
+
new_group_name: string$1().describe("新的群名称"),
|
|
44029
|
+
operator_id: zUin.describe("操作者 QQ 号")
|
|
44030
|
+
}).describe("群名称变更事件");
|
|
44031
|
+
var GroupMessageReactionEventData = object({
|
|
44032
|
+
group_id: zUin.describe("群号"),
|
|
44033
|
+
user_id: zUin.describe("发送回应者 QQ 号"),
|
|
44034
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44035
|
+
face_id: string$1().describe("表情 ID"),
|
|
44036
|
+
reaction_type: _enum(["face", "emoji"]).describe("收到的回应类型"),
|
|
44037
|
+
is_add: boolean$1().describe("是否为添加,`false` 表示取消回应")
|
|
44038
|
+
}).describe("群消息表情回应事件");
|
|
44039
|
+
var GroupMuteEventData = object({
|
|
44040
|
+
group_id: zUin.describe("群号"),
|
|
44041
|
+
user_id: zUin.describe("发生变更的用户 QQ 号"),
|
|
44042
|
+
operator_id: zUin.describe("操作者 QQ 号"),
|
|
44043
|
+
duration: number$1().int().nonnegative().describe("禁言时长(秒),为 0 表示取消禁言")
|
|
44044
|
+
}).describe("群禁言事件");
|
|
44045
|
+
var GroupWholeMuteEventData = object({
|
|
44046
|
+
group_id: zUin.describe("群号"),
|
|
44047
|
+
operator_id: zUin.describe("操作者 QQ 号"),
|
|
44048
|
+
is_mute: boolean$1().describe("是否全员禁言,`false` 表示取消全员禁言")
|
|
44049
|
+
}).describe("群全体禁言事件");
|
|
44050
|
+
var GroupNudgeEventData = object({
|
|
44051
|
+
group_id: zUin.describe("群号"),
|
|
44052
|
+
sender_id: zUin.describe("发送者 QQ 号"),
|
|
44053
|
+
receiver_id: zUin.describe("接收者 QQ 号"),
|
|
44054
|
+
display_action: string$1().describe("戳一戳提示的动作文本"),
|
|
44055
|
+
display_suffix: string$1().describe("戳一戳提示的后缀文本"),
|
|
44056
|
+
display_action_img_url: string$1().describe("戳一戳提示的动作图片 URL,用于取代动作提示文本")
|
|
44057
|
+
}).describe("群戳一戳事件");
|
|
44058
|
+
var GroupFileUploadEventData = object({
|
|
44059
|
+
group_id: zUin.describe("群号"),
|
|
44060
|
+
user_id: zUin.describe("发送者 QQ 号"),
|
|
44061
|
+
file_id: string$1().describe("文件 ID"),
|
|
44062
|
+
file_name: string$1().describe("文件名称"),
|
|
44063
|
+
file_size: number$1().int().nonnegative().describe("文件大小(字节)")
|
|
44064
|
+
}).describe("群文件上传事件");
|
|
44065
|
+
discriminatedUnion("event_type", [
|
|
44066
|
+
object({
|
|
44067
|
+
event_type: literal("bot_offline"),
|
|
44068
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44069
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44070
|
+
data: BotOfflineEventData.describe("机器人离线事件")
|
|
44071
|
+
}).describe("机器人离线事件"),
|
|
44072
|
+
object({
|
|
44073
|
+
event_type: literal("message_receive"),
|
|
44074
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44075
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44076
|
+
data: lazy(() => IncomingMessage).describe("消息接收事件")
|
|
44077
|
+
}).describe("消息接收事件"),
|
|
44078
|
+
object({
|
|
44079
|
+
event_type: literal("message_recall"),
|
|
44080
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44081
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44082
|
+
data: MessageRecallEventData.describe("消息撤回事件")
|
|
44083
|
+
}).describe("消息撤回事件"),
|
|
44084
|
+
object({
|
|
44085
|
+
event_type: literal("peer_pin_change"),
|
|
44086
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44087
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44088
|
+
data: PeerPinChangeEventData.describe("会话置顶变更事件")
|
|
44089
|
+
}).describe("会话置顶变更事件"),
|
|
44090
|
+
object({
|
|
44091
|
+
event_type: literal("friend_request"),
|
|
44092
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44093
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44094
|
+
data: FriendRequestEventData.describe("好友请求事件")
|
|
44095
|
+
}).describe("好友请求事件"),
|
|
44096
|
+
object({
|
|
44097
|
+
event_type: literal("group_join_request"),
|
|
44098
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44099
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44100
|
+
data: GroupJoinRequestEventData.describe("入群请求事件")
|
|
44101
|
+
}).describe("入群请求事件"),
|
|
44102
|
+
object({
|
|
44103
|
+
event_type: literal("group_invited_join_request"),
|
|
44104
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44105
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44106
|
+
data: GroupInvitedJoinRequestEventData.describe("群成员邀请他人入群请求事件")
|
|
44107
|
+
}).describe("群成员邀请他人入群请求事件"),
|
|
44108
|
+
object({
|
|
44109
|
+
event_type: literal("group_invitation"),
|
|
44110
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44111
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44112
|
+
data: GroupInvitationEventData.describe("他人邀请自身入群事件")
|
|
44113
|
+
}).describe("他人邀请自身入群事件"),
|
|
44114
|
+
object({
|
|
44115
|
+
event_type: literal("friend_nudge"),
|
|
44116
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44117
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44118
|
+
data: FriendNudgeEventData.describe("好友戳一戳事件")
|
|
44119
|
+
}).describe("好友戳一戳事件"),
|
|
44120
|
+
object({
|
|
44121
|
+
event_type: literal("friend_file_upload"),
|
|
44122
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44123
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44124
|
+
data: FriendFileUploadEventData.describe("好友文件上传事件")
|
|
44125
|
+
}).describe("好友文件上传事件"),
|
|
44126
|
+
object({
|
|
44127
|
+
event_type: literal("group_admin_change"),
|
|
44128
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44129
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44130
|
+
data: GroupAdminChangeEventData.describe("群管理员变更事件")
|
|
44131
|
+
}).describe("群管理员变更事件"),
|
|
44132
|
+
object({
|
|
44133
|
+
event_type: literal("group_essence_message_change"),
|
|
44134
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44135
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44136
|
+
data: GroupEssenceMessageChangeEventData.describe("群精华消息变更事件")
|
|
44137
|
+
}).describe("群精华消息变更事件"),
|
|
44138
|
+
object({
|
|
44139
|
+
event_type: literal("group_member_increase"),
|
|
44140
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44141
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44142
|
+
data: GroupMemberIncreaseEventData.describe("群成员增加事件")
|
|
44143
|
+
}).describe("群成员增加事件"),
|
|
44144
|
+
object({
|
|
44145
|
+
event_type: literal("group_member_decrease"),
|
|
44146
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44147
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44148
|
+
data: GroupMemberDecreaseEventData.describe("群成员减少事件")
|
|
44149
|
+
}).describe("群成员减少事件"),
|
|
44150
|
+
object({
|
|
44151
|
+
event_type: literal("group_name_change"),
|
|
44152
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44153
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44154
|
+
data: GroupNameChangeEventData.describe("群名称变更事件")
|
|
44155
|
+
}).describe("群名称变更事件"),
|
|
44156
|
+
object({
|
|
44157
|
+
event_type: literal("group_message_reaction"),
|
|
44158
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44159
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44160
|
+
data: GroupMessageReactionEventData.describe("群消息表情回应事件")
|
|
44161
|
+
}).describe("群消息表情回应事件"),
|
|
44162
|
+
object({
|
|
44163
|
+
event_type: literal("group_mute"),
|
|
44164
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44165
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44166
|
+
data: GroupMuteEventData.describe("群禁言事件")
|
|
44167
|
+
}).describe("群禁言事件"),
|
|
44168
|
+
object({
|
|
44169
|
+
event_type: literal("group_whole_mute"),
|
|
44170
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44171
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44172
|
+
data: GroupWholeMuteEventData.describe("群全体禁言事件")
|
|
44173
|
+
}).describe("群全体禁言事件"),
|
|
44174
|
+
object({
|
|
44175
|
+
event_type: literal("group_nudge"),
|
|
44176
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44177
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44178
|
+
data: GroupNudgeEventData.describe("群戳一戳事件")
|
|
44179
|
+
}).describe("群戳一戳事件"),
|
|
44180
|
+
object({
|
|
44181
|
+
event_type: literal("group_file_upload"),
|
|
44182
|
+
time: number$1().int().nonnegative().describe("事件 Unix 时间戳(秒)"),
|
|
44183
|
+
self_id: zUin.describe("机器人 QQ 号"),
|
|
44184
|
+
data: GroupFileUploadEventData.describe("群文件上传事件")
|
|
44185
|
+
}).describe("群文件上传事件")
|
|
44186
|
+
]).describe("事件");
|
|
44187
|
+
var FriendEntity = object({
|
|
44188
|
+
user_id: zUin.describe("用户 QQ 号"),
|
|
44189
|
+
nickname: string$1().describe("用户昵称"),
|
|
43925
44190
|
sex: _enum([
|
|
43926
44191
|
"male",
|
|
43927
44192
|
"female",
|
|
43928
44193
|
"unknown"
|
|
43929
|
-
]).describe("用户性别")
|
|
43930
|
-
|
|
43931
|
-
|
|
43932
|
-
category_id: ZInt32.describe("好友分组 ID"),
|
|
43933
|
-
category_name: ZString.describe("好友分组名称")
|
|
43934
|
-
}).describe("好友分组实体");
|
|
43935
|
-
var FriendEntity = UserEntityBase.extend({
|
|
43936
|
-
qid: ZString.describe("用户 QID"),
|
|
43937
|
-
remark: ZString.describe("好友备注"),
|
|
44194
|
+
]).describe("用户性别"),
|
|
44195
|
+
qid: string$1().describe("用户 QID"),
|
|
44196
|
+
remark: string$1().describe("好友备注"),
|
|
43938
44197
|
category: lazy(() => FriendCategoryEntity).describe("好友分组")
|
|
43939
44198
|
}).describe("好友实体");
|
|
44199
|
+
var FriendCategoryEntity = object({
|
|
44200
|
+
category_id: number$1().int().nonnegative().describe("好友分组 ID"),
|
|
44201
|
+
category_name: string$1().describe("好友分组名称")
|
|
44202
|
+
}).describe("好友分组实体");
|
|
43940
44203
|
var GroupEntity = object({
|
|
43941
|
-
group_id:
|
|
43942
|
-
group_name:
|
|
43943
|
-
member_count:
|
|
43944
|
-
max_member_count:
|
|
43945
|
-
remark:
|
|
43946
|
-
created_time:
|
|
43947
|
-
description:
|
|
43948
|
-
question:
|
|
43949
|
-
announcement:
|
|
44204
|
+
group_id: zUin.describe("群号"),
|
|
44205
|
+
group_name: string$1().describe("群名称"),
|
|
44206
|
+
member_count: number$1().int().nonnegative().describe("群成员数量"),
|
|
44207
|
+
max_member_count: number$1().int().nonnegative().describe("群容量"),
|
|
44208
|
+
remark: string$1().describe("群备注"),
|
|
44209
|
+
created_time: number$1().int().nonnegative().describe("群创建时间,Unix 时间戳(秒)"),
|
|
44210
|
+
description: string$1().describe("群简介"),
|
|
44211
|
+
question: string$1().describe("加群验证问题"),
|
|
44212
|
+
announcement: string$1().describe("群公告预览")
|
|
43950
44213
|
}).describe("群实体");
|
|
43951
|
-
var GroupMemberEntity =
|
|
43952
|
-
|
|
43953
|
-
|
|
43954
|
-
|
|
43955
|
-
|
|
44214
|
+
var GroupMemberEntity = object({
|
|
44215
|
+
user_id: zUin.describe("用户 QQ 号"),
|
|
44216
|
+
nickname: string$1().describe("用户昵称"),
|
|
44217
|
+
sex: _enum([
|
|
44218
|
+
"male",
|
|
44219
|
+
"female",
|
|
44220
|
+
"unknown"
|
|
44221
|
+
]).describe("用户性别"),
|
|
44222
|
+
group_id: zUin.describe("群号"),
|
|
44223
|
+
card: string$1().describe("成员备注"),
|
|
44224
|
+
title: string$1().describe("专属头衔"),
|
|
44225
|
+
level: number$1().int().nonnegative().describe("群等级,注意和 QQ 等级区分"),
|
|
43956
44226
|
role: _enum([
|
|
43957
44227
|
"owner",
|
|
43958
44228
|
"admin",
|
|
43959
44229
|
"member"
|
|
43960
44230
|
]).describe("权限等级"),
|
|
43961
|
-
join_time:
|
|
43962
|
-
last_sent_time:
|
|
43963
|
-
shut_up_end_time:
|
|
44231
|
+
join_time: number$1().int().nonnegative().describe("入群时间,Unix 时间戳(秒)"),
|
|
44232
|
+
last_sent_time: number$1().int().nonnegative().describe("最后发言时间,Unix 时间戳(秒)"),
|
|
44233
|
+
shut_up_end_time: number$1().int().nonnegative().nullish().describe("禁言结束时间,Unix 时间戳(秒)")
|
|
43964
44234
|
}).describe("群成员实体");
|
|
43965
44235
|
var GroupAnnouncementEntity = object({
|
|
43966
|
-
group_id:
|
|
43967
|
-
announcement_id:
|
|
43968
|
-
user_id:
|
|
43969
|
-
time:
|
|
43970
|
-
content:
|
|
43971
|
-
image_url:
|
|
44236
|
+
group_id: zUin.describe("群号"),
|
|
44237
|
+
announcement_id: string$1().describe("公告 ID"),
|
|
44238
|
+
user_id: zUin.describe("发送者 QQ 号"),
|
|
44239
|
+
time: number$1().int().nonnegative().describe("Unix 时间戳(秒)"),
|
|
44240
|
+
content: string$1().describe("公告内容"),
|
|
44241
|
+
image_url: string$1().nullish().describe("公告图片 URL")
|
|
43972
44242
|
}).describe("群公告实体");
|
|
43973
44243
|
var GroupFileEntity = object({
|
|
43974
|
-
group_id:
|
|
43975
|
-
file_id:
|
|
43976
|
-
file_name:
|
|
43977
|
-
parent_folder_id:
|
|
43978
|
-
file_size:
|
|
43979
|
-
uploaded_time:
|
|
43980
|
-
expire_time:
|
|
43981
|
-
uploader_id:
|
|
43982
|
-
downloaded_times:
|
|
44244
|
+
group_id: zUin.describe("群号"),
|
|
44245
|
+
file_id: string$1().describe("文件 ID"),
|
|
44246
|
+
file_name: string$1().describe("文件名称"),
|
|
44247
|
+
parent_folder_id: string$1().describe("父文件夹 ID"),
|
|
44248
|
+
file_size: number$1().int().nonnegative().describe("文件大小(字节)"),
|
|
44249
|
+
uploaded_time: number$1().int().nonnegative().describe("上传时的 Unix 时间戳(秒)"),
|
|
44250
|
+
expire_time: number$1().int().nonnegative().nullish().describe("过期时的 Unix 时间戳(秒)"),
|
|
44251
|
+
uploader_id: zUin.describe("上传者 QQ 号"),
|
|
44252
|
+
downloaded_times: number$1().int().nonnegative().describe("下载次数")
|
|
43983
44253
|
}).describe("群文件实体");
|
|
43984
44254
|
var GroupFolderEntity = object({
|
|
43985
|
-
group_id:
|
|
43986
|
-
folder_id:
|
|
43987
|
-
parent_folder_id:
|
|
43988
|
-
folder_name:
|
|
43989
|
-
created_time:
|
|
43990
|
-
last_modified_time:
|
|
43991
|
-
creator_id:
|
|
43992
|
-
file_count:
|
|
44255
|
+
group_id: zUin.describe("群号"),
|
|
44256
|
+
folder_id: string$1().describe("文件夹 ID"),
|
|
44257
|
+
parent_folder_id: string$1().describe("父文件夹 ID"),
|
|
44258
|
+
folder_name: string$1().describe("文件夹名称"),
|
|
44259
|
+
created_time: number$1().int().nonnegative().describe("创建时的 Unix 时间戳(秒)"),
|
|
44260
|
+
last_modified_time: number$1().int().nonnegative().describe("最后修改时的 Unix 时间戳(秒)"),
|
|
44261
|
+
creator_id: zUin.describe("创建者 QQ 号"),
|
|
44262
|
+
file_count: number$1().int().nonnegative().describe("文件数量")
|
|
43993
44263
|
}).describe("群文件夹实体");
|
|
43994
44264
|
var FriendRequest = object({
|
|
43995
|
-
time:
|
|
43996
|
-
initiator_id:
|
|
43997
|
-
initiator_uid:
|
|
43998
|
-
target_user_id:
|
|
43999
|
-
target_user_uid:
|
|
44265
|
+
time: number$1().int().nonnegative().describe("请求发起时的 Unix 时间戳(秒)"),
|
|
44266
|
+
initiator_id: zUin.describe("请求发起者 QQ 号"),
|
|
44267
|
+
initiator_uid: string$1().describe("请求发起者 UID"),
|
|
44268
|
+
target_user_id: zUin.describe("目标用户 QQ 号"),
|
|
44269
|
+
target_user_uid: string$1().describe("目标用户 UID"),
|
|
44000
44270
|
state: _enum([
|
|
44001
44271
|
"pending",
|
|
44002
44272
|
"accepted",
|
|
44003
44273
|
"rejected",
|
|
44004
44274
|
"ignored"
|
|
44005
44275
|
]).describe("请求状态"),
|
|
44006
|
-
comment:
|
|
44007
|
-
via:
|
|
44008
|
-
is_filtered:
|
|
44276
|
+
comment: string$1().describe("申请附加信息"),
|
|
44277
|
+
via: string$1().describe("申请来源"),
|
|
44278
|
+
is_filtered: boolean$1().describe("请求是否被过滤(发起自风险账户)")
|
|
44009
44279
|
}).describe("好友请求实体");
|
|
44010
44280
|
var GroupNotification = discriminatedUnion("type", [
|
|
44011
44281
|
object({
|
|
44012
44282
|
type: literal("join_request"),
|
|
44013
|
-
group_id:
|
|
44014
|
-
notification_seq:
|
|
44015
|
-
is_filtered:
|
|
44016
|
-
initiator_id:
|
|
44283
|
+
group_id: zUin.describe("群号"),
|
|
44284
|
+
notification_seq: number$1().int().nonnegative().describe("通知序列号"),
|
|
44285
|
+
is_filtered: boolean$1().describe("请求是否被过滤(发起自风险账户)"),
|
|
44286
|
+
initiator_id: zUin.describe("发起者 QQ 号"),
|
|
44017
44287
|
state: _enum([
|
|
44018
44288
|
"pending",
|
|
44019
44289
|
"accepted",
|
|
44020
44290
|
"rejected",
|
|
44021
44291
|
"ignored"
|
|
44022
44292
|
]).describe("请求状态"),
|
|
44023
|
-
operator_id:
|
|
44024
|
-
comment:
|
|
44293
|
+
operator_id: number$1().int().nonnegative().nullish().describe("处理请求的管理员 QQ 号"),
|
|
44294
|
+
comment: string$1().describe("入群请求附加信息")
|
|
44025
44295
|
}).describe("用户入群请求"),
|
|
44026
44296
|
object({
|
|
44027
44297
|
type: literal("admin_change"),
|
|
44028
|
-
group_id:
|
|
44029
|
-
notification_seq:
|
|
44030
|
-
target_user_id:
|
|
44031
|
-
is_set:
|
|
44032
|
-
operator_id:
|
|
44298
|
+
group_id: zUin.describe("群号"),
|
|
44299
|
+
notification_seq: number$1().int().nonnegative().describe("通知序列号"),
|
|
44300
|
+
target_user_id: zUin.describe("被设置/取消用户 QQ 号"),
|
|
44301
|
+
is_set: boolean$1().describe("是否被设置为管理员,`false` 表示被取消管理员"),
|
|
44302
|
+
operator_id: zUin.describe("操作者(群主)QQ 号")
|
|
44033
44303
|
}).describe("群管理员变更通知"),
|
|
44034
44304
|
object({
|
|
44035
44305
|
type: literal("kick"),
|
|
44036
|
-
group_id:
|
|
44037
|
-
notification_seq:
|
|
44038
|
-
target_user_id:
|
|
44039
|
-
operator_id:
|
|
44306
|
+
group_id: zUin.describe("群号"),
|
|
44307
|
+
notification_seq: number$1().int().nonnegative().describe("通知序列号"),
|
|
44308
|
+
target_user_id: zUin.describe("被移除用户 QQ 号"),
|
|
44309
|
+
operator_id: zUin.describe("移除用户的管理员 QQ 号")
|
|
44040
44310
|
}).describe("群成员被移除通知"),
|
|
44041
44311
|
object({
|
|
44042
44312
|
type: literal("quit"),
|
|
44043
|
-
group_id:
|
|
44044
|
-
notification_seq:
|
|
44045
|
-
target_user_id:
|
|
44313
|
+
group_id: zUin.describe("群号"),
|
|
44314
|
+
notification_seq: number$1().int().nonnegative().describe("通知序列号"),
|
|
44315
|
+
target_user_id: zUin.describe("退群用户 QQ 号")
|
|
44046
44316
|
}).describe("群成员退群通知"),
|
|
44047
44317
|
object({
|
|
44048
44318
|
type: literal("invited_join_request"),
|
|
44049
|
-
group_id:
|
|
44050
|
-
notification_seq:
|
|
44051
|
-
initiator_id:
|
|
44052
|
-
target_user_id:
|
|
44319
|
+
group_id: zUin.describe("群号"),
|
|
44320
|
+
notification_seq: number$1().int().nonnegative().describe("通知序列号"),
|
|
44321
|
+
initiator_id: zUin.describe("邀请者 QQ 号"),
|
|
44322
|
+
target_user_id: zUin.describe("被邀请用户 QQ 号"),
|
|
44053
44323
|
state: _enum([
|
|
44054
44324
|
"pending",
|
|
44055
44325
|
"accepted",
|
|
44056
44326
|
"rejected",
|
|
44057
44327
|
"ignored"
|
|
44058
44328
|
]).describe("请求状态"),
|
|
44059
|
-
operator_id:
|
|
44329
|
+
operator_id: number$1().int().nonnegative().nullish().describe("处理请求的管理员 QQ 号")
|
|
44060
44330
|
}).describe("群成员邀请他人入群请求")
|
|
44061
44331
|
]).describe("群通知实体");
|
|
44062
|
-
var
|
|
44063
|
-
|
|
44064
|
-
|
|
44065
|
-
|
|
44066
|
-
|
|
44332
|
+
var IncomingMessage = discriminatedUnion("message_scene", [
|
|
44333
|
+
object({
|
|
44334
|
+
message_scene: literal("friend"),
|
|
44335
|
+
peer_id: zUin.describe("好友 QQ 号或群号"),
|
|
44336
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44337
|
+
sender_id: zUin.describe("发送者 QQ 号"),
|
|
44338
|
+
time: number$1().int().nonnegative().describe("消息 Unix 时间戳(秒)"),
|
|
44339
|
+
segments: array(lazy(() => IncomingSegment)).describe("消息段列表"),
|
|
44340
|
+
friend: lazy(() => FriendEntity).describe("好友信息")
|
|
44341
|
+
}).describe("好友消息"),
|
|
44342
|
+
object({
|
|
44343
|
+
message_scene: literal("group"),
|
|
44344
|
+
peer_id: zUin.describe("好友 QQ 号或群号"),
|
|
44345
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44346
|
+
sender_id: zUin.describe("发送者 QQ 号"),
|
|
44347
|
+
time: number$1().int().nonnegative().describe("消息 Unix 时间戳(秒)"),
|
|
44348
|
+
segments: array(lazy(() => IncomingSegment)).describe("消息段列表"),
|
|
44349
|
+
group: lazy(() => GroupEntity).describe("群信息"),
|
|
44350
|
+
group_member: lazy(() => GroupMemberEntity).describe("群成员信息")
|
|
44351
|
+
}).describe("群消息"),
|
|
44352
|
+
object({
|
|
44353
|
+
message_scene: literal("temp"),
|
|
44354
|
+
peer_id: zUin.describe("好友 QQ 号或群号"),
|
|
44355
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44356
|
+
sender_id: zUin.describe("发送者 QQ 号"),
|
|
44357
|
+
time: number$1().int().nonnegative().describe("消息 Unix 时间戳(秒)"),
|
|
44358
|
+
segments: array(lazy(() => IncomingSegment)).describe("消息段列表"),
|
|
44359
|
+
group: lazy(() => GroupEntity).nullish().describe("临时会话发送者的所在的群信息")
|
|
44360
|
+
}).describe("临时会话消息")
|
|
44361
|
+
]).describe("接收消息");
|
|
44362
|
+
var IncomingForwardedMessage = object({
|
|
44363
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44364
|
+
sender_name: string$1().describe("发送者名称"),
|
|
44365
|
+
avatar_url: string$1().describe("发送者头像 URL"),
|
|
44366
|
+
time: number$1().int().nonnegative().describe("消息 Unix 时间戳(秒)"),
|
|
44367
|
+
segments: array(lazy(() => IncomingSegment)).describe("消息段列表")
|
|
44368
|
+
}).describe("接收转发消息");
|
|
44369
|
+
var GroupEssenceMessage = object({
|
|
44370
|
+
group_id: zUin.describe("群号"),
|
|
44371
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44372
|
+
message_time: number$1().int().nonnegative().describe("消息发送时的 Unix 时间戳(秒)"),
|
|
44373
|
+
sender_id: zUin.describe("发送者 QQ 号"),
|
|
44374
|
+
sender_name: string$1().describe("发送者名称"),
|
|
44375
|
+
operator_id: zUin.describe("设置精华的操作者 QQ 号"),
|
|
44376
|
+
operator_name: string$1().describe("设置精华的操作者名称"),
|
|
44377
|
+
operation_time: number$1().int().nonnegative().describe("消息被设置精华时的 Unix 时间戳(秒)"),
|
|
44378
|
+
segments: array(lazy(() => IncomingSegment)).describe("消息段列表")
|
|
44379
|
+
}).describe("群精华消息");
|
|
44380
|
+
var IncomingTextSegmentData = object({ text: string$1().describe("文本内容") }).describe("文本消息段");
|
|
44381
|
+
var IncomingMentionSegmentData = object({
|
|
44382
|
+
user_id: zUin.describe("提及的 QQ 号"),
|
|
44383
|
+
name: string$1().describe("去掉 `@` 前缀的提及的名称")
|
|
44384
|
+
}).describe("提及消息段");
|
|
44385
|
+
var IncomingMentionAllSegmentData = object({}).describe("提及全体消息段");
|
|
44386
|
+
var IncomingFaceSegmentData = object({
|
|
44387
|
+
face_id: string$1().describe("表情 ID"),
|
|
44388
|
+
is_large: boolean$1().describe("是否为超级表情")
|
|
44389
|
+
}).describe("表情消息段");
|
|
44390
|
+
var IncomingReplySegmentData = object({
|
|
44391
|
+
message_seq: number$1().int().nonnegative().describe("被引用的消息序列号"),
|
|
44392
|
+
sender_id: zUin.describe("被引用的消息发送者 QQ 号"),
|
|
44393
|
+
sender_name: string$1().nullish().describe("被引用的消息发送者名称,仅在合并转发中能够获取"),
|
|
44394
|
+
time: number$1().int().nonnegative().describe("被引用的消息的 Unix 时间戳(秒)"),
|
|
44395
|
+
get segments() {
|
|
44396
|
+
return array(lazy(() => IncomingSegment)).describe("回复消息内容");
|
|
44397
|
+
}
|
|
44398
|
+
}).describe("回复消息段");
|
|
44399
|
+
var IncomingImageSegmentData = object({
|
|
44400
|
+
resource_id: string$1().describe("资源 ID"),
|
|
44401
|
+
temp_url: string$1().describe("临时 URL"),
|
|
44402
|
+
width: number$1().int().nonnegative().describe("图片宽度"),
|
|
44403
|
+
height: number$1().int().nonnegative().describe("图片高度"),
|
|
44404
|
+
summary: string$1().describe("图片预览文本"),
|
|
44405
|
+
sub_type: _enum(["normal", "sticker"]).describe("图片类型")
|
|
44406
|
+
}).describe("图片消息段");
|
|
44407
|
+
var IncomingRecordSegmentData = object({
|
|
44408
|
+
resource_id: string$1().describe("资源 ID"),
|
|
44409
|
+
temp_url: string$1().describe("临时 URL"),
|
|
44410
|
+
duration: number$1().int().nonnegative().describe("语音时长(秒)")
|
|
44411
|
+
}).describe("语音消息段");
|
|
44412
|
+
var IncomingVideoSegmentData = object({
|
|
44413
|
+
resource_id: string$1().describe("资源 ID"),
|
|
44414
|
+
temp_url: string$1().describe("临时 URL"),
|
|
44415
|
+
width: number$1().int().nonnegative().describe("视频宽度"),
|
|
44416
|
+
height: number$1().int().nonnegative().describe("视频高度"),
|
|
44417
|
+
duration: number$1().int().nonnegative().describe("视频时长(秒)")
|
|
44418
|
+
}).describe("视频消息段");
|
|
44419
|
+
var IncomingFileSegmentData = object({
|
|
44420
|
+
file_id: string$1().describe("文件 ID"),
|
|
44421
|
+
file_name: string$1().describe("文件名称"),
|
|
44422
|
+
file_size: number$1().int().nonnegative().describe("文件大小(字节)"),
|
|
44423
|
+
file_hash: string$1().nullish().describe("文件的 TriSHA1 哈希值,仅在私聊文件中存在")
|
|
44424
|
+
}).describe("文件消息段");
|
|
44425
|
+
var IncomingForwardSegmentData = object({
|
|
44426
|
+
forward_id: string$1().describe("合并转发 ID"),
|
|
44427
|
+
title: string$1().describe("合并转发标题"),
|
|
44428
|
+
preview: array(string$1()).describe("合并转发预览文本"),
|
|
44429
|
+
summary: string$1().describe("合并转发摘要")
|
|
44430
|
+
}).describe("合并转发消息段");
|
|
44431
|
+
var IncomingMarketFaceSegmentData = object({
|
|
44432
|
+
emoji_package_id: number$1().int().nonnegative().describe("市场表情包 ID"),
|
|
44433
|
+
emoji_id: string$1().describe("市场表情 ID"),
|
|
44434
|
+
key: string$1().describe("市场表情 Key"),
|
|
44435
|
+
summary: string$1().describe("市场表情预览文本"),
|
|
44436
|
+
url: string$1().describe("市场表情 URL")
|
|
44437
|
+
}).describe("市场表情消息段");
|
|
44438
|
+
var IncomingLightAppSegmentData = object({
|
|
44439
|
+
app_name: string$1().describe("小程序名称"),
|
|
44440
|
+
json_payload: string$1().describe("小程序 JSON 数据")
|
|
44441
|
+
}).describe("小程序消息段");
|
|
44442
|
+
var IncomingXmlSegmentData = object({
|
|
44443
|
+
service_id: number$1().int().nonnegative().describe("服务 ID"),
|
|
44444
|
+
xml_payload: string$1().describe("XML 数据")
|
|
44445
|
+
}).describe("XML 消息段");
|
|
44067
44446
|
var IncomingSegment = discriminatedUnion("type", [
|
|
44068
44447
|
object({
|
|
44069
44448
|
type: literal("text"),
|
|
44070
|
-
data:
|
|
44449
|
+
data: IncomingTextSegmentData.describe("文本消息段")
|
|
44071
44450
|
}).describe("文本消息段"),
|
|
44072
44451
|
object({
|
|
44073
44452
|
type: literal("mention"),
|
|
44074
|
-
data:
|
|
44075
|
-
user_id: ZUin.describe("提及的 QQ 号"),
|
|
44076
|
-
name: ZString.describe("去掉 `@` 前缀的提及的名称")
|
|
44077
|
-
})
|
|
44453
|
+
data: IncomingMentionSegmentData.describe("提及消息段")
|
|
44078
44454
|
}).describe("提及消息段"),
|
|
44079
44455
|
object({
|
|
44080
44456
|
type: literal("mention_all"),
|
|
44081
|
-
data:
|
|
44457
|
+
data: IncomingMentionAllSegmentData.describe("提及全体消息段")
|
|
44082
44458
|
}).describe("提及全体消息段"),
|
|
44083
44459
|
object({
|
|
44084
44460
|
type: literal("face"),
|
|
44085
|
-
data:
|
|
44086
|
-
face_id: ZString.describe("表情 ID"),
|
|
44087
|
-
is_large: ZBoolean.describe("是否为超级表情")
|
|
44088
|
-
})
|
|
44461
|
+
data: IncomingFaceSegmentData.describe("表情消息段")
|
|
44089
44462
|
}).describe("表情消息段"),
|
|
44090
44463
|
object({
|
|
44091
44464
|
type: literal("reply"),
|
|
44092
|
-
data:
|
|
44093
|
-
message_seq: ZInt64.describe("被引用的消息序列号"),
|
|
44094
|
-
sender_id: ZUin.describe("被引用的消息发送者 QQ 号"),
|
|
44095
|
-
sender_name: ZString.nullish().describe("被引用的消息发送者名称,仅在合并转发中能够获取"),
|
|
44096
|
-
time: ZInt64.describe("被引用的消息的 Unix 时间戳(秒)"),
|
|
44097
|
-
get segments() {
|
|
44098
|
-
return array(lazy(() => IncomingSegment)).describe("被引用的消息内容");
|
|
44099
|
-
}
|
|
44100
|
-
})
|
|
44465
|
+
data: IncomingReplySegmentData.describe("回复消息段")
|
|
44101
44466
|
}).describe("回复消息段"),
|
|
44102
44467
|
object({
|
|
44103
44468
|
type: literal("image"),
|
|
44104
|
-
data:
|
|
44105
|
-
width: ZInt32.describe("图片宽度"),
|
|
44106
|
-
height: ZInt32.describe("图片高度"),
|
|
44107
|
-
summary: ZString.describe("图片预览文本"),
|
|
44108
|
-
sub_type: _enum(["normal", "sticker"]).describe("图片类型")
|
|
44109
|
-
})
|
|
44469
|
+
data: IncomingImageSegmentData.describe("图片消息段")
|
|
44110
44470
|
}).describe("图片消息段"),
|
|
44111
44471
|
object({
|
|
44112
44472
|
type: literal("record"),
|
|
44113
|
-
data:
|
|
44473
|
+
data: IncomingRecordSegmentData.describe("语音消息段")
|
|
44114
44474
|
}).describe("语音消息段"),
|
|
44115
44475
|
object({
|
|
44116
44476
|
type: literal("video"),
|
|
44117
|
-
data:
|
|
44118
|
-
width: ZInt32.describe("视频宽度"),
|
|
44119
|
-
height: ZInt32.describe("视频高度"),
|
|
44120
|
-
duration: ZInt32.describe("视频时长(秒)")
|
|
44121
|
-
})
|
|
44477
|
+
data: IncomingVideoSegmentData.describe("视频消息段")
|
|
44122
44478
|
}).describe("视频消息段"),
|
|
44123
44479
|
object({
|
|
44124
44480
|
type: literal("file"),
|
|
44125
|
-
data:
|
|
44126
|
-
file_id: ZString.describe("文件 ID"),
|
|
44127
|
-
file_name: ZString.describe("文件名称"),
|
|
44128
|
-
file_size: ZInt64.describe("文件大小(字节)"),
|
|
44129
|
-
file_hash: ZString.nullish().describe("文件的 TriSHA1 哈希值,仅在私聊文件中存在")
|
|
44130
|
-
})
|
|
44481
|
+
data: IncomingFileSegmentData.describe("文件消息段")
|
|
44131
44482
|
}).describe("文件消息段"),
|
|
44132
44483
|
object({
|
|
44133
44484
|
type: literal("forward"),
|
|
44134
|
-
data:
|
|
44135
|
-
forward_id: ZString.describe("合并转发 ID"),
|
|
44136
|
-
title: ZString.describe("合并转发标题"),
|
|
44137
|
-
preview: array(ZString).describe("合并转发预览文本"),
|
|
44138
|
-
summary: ZString.describe("合并转发摘要")
|
|
44139
|
-
})
|
|
44485
|
+
data: IncomingForwardSegmentData.describe("合并转发消息段")
|
|
44140
44486
|
}).describe("合并转发消息段"),
|
|
44141
44487
|
object({
|
|
44142
44488
|
type: literal("market_face"),
|
|
44143
|
-
data:
|
|
44144
|
-
emoji_package_id: ZInt32.describe("市场表情包 ID"),
|
|
44145
|
-
emoji_id: ZString.describe("市场表情 ID"),
|
|
44146
|
-
key: ZString.describe("市场表情 Key"),
|
|
44147
|
-
summary: ZString.describe("市场表情预览文本"),
|
|
44148
|
-
url: ZString.describe("市场表情 URL")
|
|
44149
|
-
})
|
|
44489
|
+
data: IncomingMarketFaceSegmentData.describe("市场表情消息段")
|
|
44150
44490
|
}).describe("市场表情消息段"),
|
|
44151
44491
|
object({
|
|
44152
44492
|
type: literal("light_app"),
|
|
44153
|
-
data:
|
|
44154
|
-
app_name: ZString.describe("小程序名称"),
|
|
44155
|
-
json_payload: ZString.describe("小程序 JSON 数据")
|
|
44156
|
-
})
|
|
44493
|
+
data: IncomingLightAppSegmentData.describe("小程序消息段")
|
|
44157
44494
|
}).describe("小程序消息段"),
|
|
44158
44495
|
object({
|
|
44159
44496
|
type: literal("xml"),
|
|
44160
|
-
data:
|
|
44161
|
-
service_id: ZInt32.describe("服务 ID"),
|
|
44162
|
-
xml_payload: ZString.describe("XML 数据")
|
|
44163
|
-
})
|
|
44497
|
+
data: IncomingXmlSegmentData.describe("XML 消息段")
|
|
44164
44498
|
}).describe("XML 消息段")
|
|
44165
44499
|
]).catch({
|
|
44166
44500
|
type: "text",
|
|
44167
44501
|
data: { text: "[unknown]" }
|
|
44168
44502
|
}).describe("接收消息段");
|
|
44169
|
-
var
|
|
44170
|
-
|
|
44171
|
-
sender_name:
|
|
44172
|
-
|
|
44173
|
-
|
|
44174
|
-
|
|
44175
|
-
}).describe("
|
|
44503
|
+
var OutgoingForwardedMessage = object({
|
|
44504
|
+
user_id: zUin.describe("发送者 QQ 号"),
|
|
44505
|
+
sender_name: string$1().describe("发送者名称"),
|
|
44506
|
+
segments: array(lazy(() => OutgoingSegment)).describe("消息段列表")
|
|
44507
|
+
}).describe("发送转发消息");
|
|
44508
|
+
var OutgoingTextSegmentData = object({ text: string$1().describe("文本内容") }).describe("文本消息段");
|
|
44509
|
+
var OutgoingMentionSegmentData = object({ user_id: zUin.describe("提及的 QQ 号") }).describe("提及消息段");
|
|
44510
|
+
var OutgoingMentionAllSegmentData = object({}).describe("提及全体消息段");
|
|
44511
|
+
var OutgoingFaceSegmentData = object({
|
|
44512
|
+
face_id: string$1().describe("表情 ID"),
|
|
44513
|
+
is_large: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否为超级表情")
|
|
44514
|
+
}).describe("表情消息段");
|
|
44515
|
+
var OutgoingReplySegmentData = object({ message_seq: number$1().int().nonnegative().describe("被引用的消息序列号") }).describe("回复消息段");
|
|
44516
|
+
var OutgoingImageSegmentData = object({
|
|
44517
|
+
uri: string$1().describe("文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式"),
|
|
44518
|
+
sub_type: _enum(["normal", "sticker"]).nullish().default("normal").transform((val) => val ?? "normal").describe("图片类型"),
|
|
44519
|
+
summary: string$1().nullish().describe("图片预览文本")
|
|
44520
|
+
}).describe("图片消息段");
|
|
44521
|
+
var OutgoingRecordSegmentData = object({ uri: string$1().describe("文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式") }).describe("语音消息段");
|
|
44522
|
+
var OutgoingVideoSegmentData = object({
|
|
44523
|
+
uri: string$1().describe("文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式"),
|
|
44524
|
+
thumb_uri: string$1().nullish().describe("封面图片 URI")
|
|
44525
|
+
}).describe("视频消息段");
|
|
44526
|
+
var OutgoingForwardSegmentData = object({
|
|
44527
|
+
get messages() {
|
|
44528
|
+
return array(lazy(() => OutgoingForwardedMessage)).describe("合并转发消息内容");
|
|
44529
|
+
},
|
|
44530
|
+
title: string$1().nullish().describe("合并转发标题"),
|
|
44531
|
+
preview: array(string$1()).nullish().describe("合并转发预览文本,若提供,至少 1 条,至多 4 条"),
|
|
44532
|
+
summary: string$1().nullish().describe("合并转发摘要"),
|
|
44533
|
+
prompt: string$1().nullish().describe("合并转发的预览外显文本,仅对移动端 QQ 有效")
|
|
44534
|
+
}).describe("合并转发消息段");
|
|
44535
|
+
var OutgoingLightAppSegmentData = object({ json_payload: string$1().describe("小程序 JSON 数据") }).describe("小程序消息段");
|
|
44176
44536
|
var OutgoingSegment = discriminatedUnion("type", [
|
|
44177
44537
|
object({
|
|
44178
44538
|
type: literal("text"),
|
|
44179
|
-
data:
|
|
44539
|
+
data: OutgoingTextSegmentData.describe("文本消息段")
|
|
44180
44540
|
}).describe("文本消息段"),
|
|
44181
44541
|
object({
|
|
44182
44542
|
type: literal("mention"),
|
|
44183
|
-
data:
|
|
44543
|
+
data: OutgoingMentionSegmentData.describe("提及消息段")
|
|
44184
44544
|
}).describe("提及消息段"),
|
|
44185
44545
|
object({
|
|
44186
44546
|
type: literal("mention_all"),
|
|
44187
|
-
data:
|
|
44547
|
+
data: OutgoingMentionAllSegmentData.describe("提及全体消息段")
|
|
44188
44548
|
}).describe("提及全体消息段"),
|
|
44189
44549
|
object({
|
|
44190
44550
|
type: literal("face"),
|
|
44191
|
-
data:
|
|
44192
|
-
face_id: ZString.describe("表情 ID"),
|
|
44193
|
-
is_large: ZBoolean.default(false).describe("是否为超级表情")
|
|
44194
|
-
})
|
|
44551
|
+
data: OutgoingFaceSegmentData.describe("表情消息段")
|
|
44195
44552
|
}).describe("表情消息段"),
|
|
44196
44553
|
object({
|
|
44197
44554
|
type: literal("reply"),
|
|
44198
|
-
data:
|
|
44555
|
+
data: OutgoingReplySegmentData.describe("回复消息段")
|
|
44199
44556
|
}).describe("回复消息段"),
|
|
44200
44557
|
object({
|
|
44201
44558
|
type: literal("image"),
|
|
44202
|
-
data:
|
|
44203
|
-
sub_type: _enum(["normal", "sticker"]).default("normal").describe("图片类型"),
|
|
44204
|
-
summary: ZString.nullish().describe("图片预览文本")
|
|
44205
|
-
})
|
|
44559
|
+
data: OutgoingImageSegmentData.describe("图片消息段")
|
|
44206
44560
|
}).describe("图片消息段"),
|
|
44207
44561
|
object({
|
|
44208
44562
|
type: literal("record"),
|
|
44209
|
-
data:
|
|
44563
|
+
data: OutgoingRecordSegmentData.describe("语音消息段")
|
|
44210
44564
|
}).describe("语音消息段"),
|
|
44211
44565
|
object({
|
|
44212
44566
|
type: literal("video"),
|
|
44213
|
-
data:
|
|
44567
|
+
data: OutgoingVideoSegmentData.describe("视频消息段")
|
|
44214
44568
|
}).describe("视频消息段"),
|
|
44215
44569
|
object({
|
|
44216
44570
|
type: literal("forward"),
|
|
44217
|
-
data:
|
|
44218
|
-
get messages() {
|
|
44219
|
-
return array(lazy(() => OutgoingForwardedMessage)).describe("合并转发消息内容");
|
|
44220
|
-
},
|
|
44221
|
-
title: ZString.nullish().describe("合并转发标题"),
|
|
44222
|
-
preview: array(ZString).min(1).max(4).nullish().describe("合并转发预览文本,若提供,至少 1 条,至多 4 条"),
|
|
44223
|
-
summary: ZString.nullish().describe("合并转发摘要"),
|
|
44224
|
-
prompt: ZString.nullish().describe("合并转发的预览外显文本,仅对移动端 QQ 有效")
|
|
44225
|
-
})
|
|
44571
|
+
data: OutgoingForwardSegmentData.describe("合并转发消息段")
|
|
44226
44572
|
}).describe("合并转发消息段"),
|
|
44227
44573
|
object({
|
|
44228
44574
|
type: literal("light_app"),
|
|
44229
|
-
data:
|
|
44575
|
+
data: OutgoingLightAppSegmentData.describe("小程序消息段")
|
|
44230
44576
|
}).describe("小程序消息段")
|
|
44231
44577
|
]).describe("发送消息段");
|
|
44232
|
-
var OutgoingForwardedMessage = object({
|
|
44233
|
-
user_id: ZUin.describe("发送者 QQ 号"),
|
|
44234
|
-
sender_name: ZString.describe("发送者名称"),
|
|
44235
|
-
segments: array(lazy(() => OutgoingSegment)).describe("消息段列表")
|
|
44236
|
-
}).describe("发送转发消息");
|
|
44237
|
-
var IncomingMessage = discriminatedUnion("message_scene", [
|
|
44238
|
-
object({
|
|
44239
|
-
message_scene: literal("friend"),
|
|
44240
|
-
peer_id: ZUin.describe("好友 QQ 号或群号"),
|
|
44241
|
-
message_seq: ZInt64.describe("消息序列号"),
|
|
44242
|
-
sender_id: ZUin.describe("发送者 QQ 号"),
|
|
44243
|
-
time: ZInt64.describe("消息 Unix 时间戳(秒)"),
|
|
44244
|
-
segments: array(lazy(() => IncomingSegment)).describe("消息段列表"),
|
|
44245
|
-
friend: lazy(() => FriendEntity).describe("好友信息")
|
|
44246
|
-
}).describe("好友消息"),
|
|
44247
|
-
object({
|
|
44248
|
-
message_scene: literal("group"),
|
|
44249
|
-
peer_id: ZUin.describe("好友 QQ 号或群号"),
|
|
44250
|
-
message_seq: ZInt64.describe("消息序列号"),
|
|
44251
|
-
sender_id: ZUin.describe("发送者 QQ 号"),
|
|
44252
|
-
time: ZInt64.describe("消息 Unix 时间戳(秒)"),
|
|
44253
|
-
segments: array(lazy(() => IncomingSegment)).describe("消息段列表"),
|
|
44254
|
-
group: lazy(() => GroupEntity).describe("群信息"),
|
|
44255
|
-
group_member: lazy(() => GroupMemberEntity).describe("群成员信息")
|
|
44256
|
-
}).describe("群消息"),
|
|
44257
|
-
object({
|
|
44258
|
-
message_scene: literal("temp"),
|
|
44259
|
-
peer_id: ZUin.describe("好友 QQ 号或群号"),
|
|
44260
|
-
message_seq: ZInt64.describe("消息序列号"),
|
|
44261
|
-
sender_id: ZUin.describe("发送者 QQ 号"),
|
|
44262
|
-
time: ZInt64.describe("消息 Unix 时间戳(秒)"),
|
|
44263
|
-
segments: array(lazy(() => IncomingSegment)).describe("消息段列表"),
|
|
44264
|
-
group: lazy(() => GroupEntity).nullish().describe("临时会话发送者的所在的群信息")
|
|
44265
|
-
}).describe("临时会话消息")
|
|
44266
|
-
]).describe("接收消息");
|
|
44267
|
-
var GroupEssenceMessage = object({
|
|
44268
|
-
group_id: ZUin.describe("群号"),
|
|
44269
|
-
message_seq: ZInt64.describe("消息序列号"),
|
|
44270
|
-
message_time: ZInt64.describe("消息发送时的 Unix 时间戳(秒)"),
|
|
44271
|
-
sender_id: ZUin.describe("发送者 QQ 号"),
|
|
44272
|
-
sender_name: ZString.describe("发送者名称"),
|
|
44273
|
-
operator_id: ZUin.describe("设置精华的操作者 QQ 号"),
|
|
44274
|
-
operator_name: ZString.describe("设置精华的操作者名称"),
|
|
44275
|
-
operation_time: ZInt64.describe("消息被设置精华时的 Unix 时间戳(秒)"),
|
|
44276
|
-
segments: array(lazy(() => IncomingSegment)).describe("消息段列表")
|
|
44277
|
-
}).describe("群精华消息");
|
|
44278
|
-
var BotOfflineEvent = object({ reason: ZString.describe("下线原因") });
|
|
44279
|
-
var MessageRecallEvent = object({
|
|
44280
|
-
message_scene: _enum([
|
|
44281
|
-
"friend",
|
|
44282
|
-
"group",
|
|
44283
|
-
"temp"
|
|
44284
|
-
]).describe("消息场景"),
|
|
44285
|
-
peer_id: ZUin.describe("好友 QQ 号或群号"),
|
|
44286
|
-
message_seq: ZInt64.describe("消息序列号"),
|
|
44287
|
-
sender_id: ZUin.describe("被撤回的消息的发送者 QQ 号"),
|
|
44288
|
-
operator_id: ZUin.describe("操作者 QQ 号"),
|
|
44289
|
-
display_suffix: ZString.describe("撤回提示的后缀文本")
|
|
44290
|
-
});
|
|
44291
|
-
var PeerPinChangeEvent = object({
|
|
44292
|
-
message_scene: _enum([
|
|
44293
|
-
"friend",
|
|
44294
|
-
"group",
|
|
44295
|
-
"temp"
|
|
44296
|
-
]).describe("发生改变的会话的消息场景"),
|
|
44297
|
-
peer_id: ZUin.describe("发生改变的好友 QQ 号或群号"),
|
|
44298
|
-
is_pinned: ZBoolean.describe("是否被置顶, `false` 表示取消置顶")
|
|
44299
|
-
});
|
|
44300
|
-
var FriendRequestEvent = object({
|
|
44301
|
-
initiator_id: ZUin.describe("申请好友的用户 QQ 号"),
|
|
44302
|
-
initiator_uid: ZString.describe("用户 UID"),
|
|
44303
|
-
comment: ZString.describe("申请附加信息"),
|
|
44304
|
-
via: ZString.describe("申请来源")
|
|
44305
|
-
});
|
|
44306
|
-
var GroupJoinRequestEvent = object({
|
|
44307
|
-
group_id: ZUin.describe("群号"),
|
|
44308
|
-
notification_seq: ZInt64.describe("请求对应的通知序列号"),
|
|
44309
|
-
is_filtered: ZBoolean.describe("请求是否被过滤(发起自风险账户)"),
|
|
44310
|
-
initiator_id: ZUin.describe("申请入群的用户 QQ 号"),
|
|
44311
|
-
comment: ZString.describe("申请附加信息")
|
|
44312
|
-
});
|
|
44313
|
-
var GroupInvitedJoinRequestEvent = object({
|
|
44314
|
-
group_id: ZUin.describe("群号"),
|
|
44315
|
-
notification_seq: ZInt64.describe("请求对应的通知序列号"),
|
|
44316
|
-
initiator_id: ZUin.describe("邀请者 QQ 号"),
|
|
44317
|
-
target_user_id: ZUin.describe("被邀请者 QQ 号")
|
|
44318
|
-
});
|
|
44319
|
-
var GroupInvitationEvent = object({
|
|
44320
|
-
group_id: ZUin.describe("群号"),
|
|
44321
|
-
invitation_seq: ZInt64.describe("邀请序列号"),
|
|
44322
|
-
initiator_id: ZUin.describe("邀请者 QQ 号"),
|
|
44323
|
-
source_group_id: ZUin.nullish().describe("来源群号,如果是通过 QQ 群邀请")
|
|
44324
|
-
});
|
|
44325
|
-
var FriendNudgeEvent = object({
|
|
44326
|
-
user_id: ZUin.describe("好友 QQ 号"),
|
|
44327
|
-
is_self_send: ZBoolean.describe("是否是自己发送的戳一戳"),
|
|
44328
|
-
is_self_receive: ZBoolean.describe("是否是自己接收的戳一戳"),
|
|
44329
|
-
display_action: ZString.describe("戳一戳提示的动作文本"),
|
|
44330
|
-
display_suffix: ZString.describe("戳一戳提示的后缀文本"),
|
|
44331
|
-
display_action_img_url: ZString.describe("戳一戳提示的动作图片 URL,用于取代动作提示文本")
|
|
44332
|
-
});
|
|
44333
|
-
var FriendFileUploadEvent = object({
|
|
44334
|
-
user_id: ZUin.describe("好友 QQ 号"),
|
|
44335
|
-
file_id: ZString.describe("文件 ID"),
|
|
44336
|
-
file_name: ZString.describe("文件名称"),
|
|
44337
|
-
file_size: ZInt64.describe("文件大小(字节)"),
|
|
44338
|
-
file_hash: ZString.describe("文件的 TriSHA1 哈希值"),
|
|
44339
|
-
is_self: ZBoolean.describe("是否是自己发送的文件")
|
|
44340
|
-
});
|
|
44341
|
-
var GroupAdminChangeEvent = object({
|
|
44342
|
-
group_id: ZUin.describe("群号"),
|
|
44343
|
-
user_id: ZUin.describe("发生变更的用户 QQ 号"),
|
|
44344
|
-
operator_id: ZUin.describe("操作者 QQ 号"),
|
|
44345
|
-
is_set: ZBoolean.describe("是否被设置为管理员,`false` 表示被取消管理员")
|
|
44346
|
-
});
|
|
44347
|
-
var GroupEssenceMessageChangeEvent = object({
|
|
44348
|
-
group_id: ZUin.describe("群号"),
|
|
44349
|
-
message_seq: ZInt64.describe("发生变更的消息序列号"),
|
|
44350
|
-
operator_id: ZUin.describe("操作者 QQ 号"),
|
|
44351
|
-
is_set: ZBoolean.describe("是否被设置为精华,`false` 表示被取消精华")
|
|
44352
|
-
});
|
|
44353
|
-
var GroupMemberIncreaseEvent = object({
|
|
44354
|
-
group_id: ZUin.describe("群号"),
|
|
44355
|
-
user_id: ZUin.describe("发生变更的用户 QQ 号"),
|
|
44356
|
-
operator_id: ZUin.nullish().describe("管理员 QQ 号,如果是管理员同意入群"),
|
|
44357
|
-
invitor_id: ZUin.nullish().describe("邀请者 QQ 号,如果是邀请入群")
|
|
44358
|
-
});
|
|
44359
|
-
var GroupMemberDecreaseEvent = object({
|
|
44360
|
-
group_id: ZUin.describe("群号"),
|
|
44361
|
-
user_id: ZUin.describe("发生变更的用户 QQ 号"),
|
|
44362
|
-
operator_id: ZUin.nullish().describe("管理员 QQ 号,如果是管理员踢出")
|
|
44363
|
-
});
|
|
44364
|
-
var GroupNameChangeEvent = object({
|
|
44365
|
-
group_id: ZUin.describe("群号"),
|
|
44366
|
-
new_group_name: ZString.describe("新的群名称"),
|
|
44367
|
-
operator_id: ZUin.describe("操作者 QQ 号")
|
|
44368
|
-
});
|
|
44369
|
-
var GroupMessageReactionEvent = object({
|
|
44370
|
-
group_id: ZUin.describe("群号"),
|
|
44371
|
-
user_id: ZUin.describe("发送回应者 QQ 号"),
|
|
44372
|
-
message_seq: ZInt64.describe("消息序列号"),
|
|
44373
|
-
face_id: ZString.describe("表情 ID"),
|
|
44374
|
-
reaction_type: _enum(["face", "emoji"]).describe("收到的回应类型"),
|
|
44375
|
-
is_add: ZBoolean.describe("是否为添加,`false` 表示取消回应")
|
|
44376
|
-
});
|
|
44377
|
-
var GroupMuteEvent = object({
|
|
44378
|
-
group_id: ZUin.describe("群号"),
|
|
44379
|
-
user_id: ZUin.describe("发生变更的用户 QQ 号"),
|
|
44380
|
-
operator_id: ZUin.describe("操作者 QQ 号"),
|
|
44381
|
-
duration: ZInt32.describe("禁言时长(秒),为 0 表示取消禁言")
|
|
44382
|
-
});
|
|
44383
|
-
var GroupWholeMuteEvent = object({
|
|
44384
|
-
group_id: ZUin.describe("群号"),
|
|
44385
|
-
operator_id: ZUin.describe("操作者 QQ 号"),
|
|
44386
|
-
is_mute: ZBoolean.describe("是否全员禁言,`false` 表示取消全员禁言")
|
|
44387
|
-
});
|
|
44388
|
-
var GroupNudgeEvent = object({
|
|
44389
|
-
group_id: ZUin.describe("群号"),
|
|
44390
|
-
sender_id: ZUin.describe("发送者 QQ 号"),
|
|
44391
|
-
receiver_id: ZUin.describe("接收者 QQ 号"),
|
|
44392
|
-
display_action: ZString.describe("戳一戳提示的动作文本"),
|
|
44393
|
-
display_suffix: ZString.describe("戳一戳提示的后缀文本"),
|
|
44394
|
-
display_action_img_url: ZString.describe("戳一戳提示的动作图片 URL,用于取代动作提示文本")
|
|
44395
|
-
});
|
|
44396
|
-
var GroupFileUploadEvent = object({
|
|
44397
|
-
group_id: ZUin.describe("群号"),
|
|
44398
|
-
user_id: ZUin.describe("发送者 QQ 号"),
|
|
44399
|
-
file_id: ZString.describe("文件 ID"),
|
|
44400
|
-
file_name: ZString.describe("文件名称"),
|
|
44401
|
-
file_size: ZInt64.describe("文件大小(字节)")
|
|
44402
|
-
});
|
|
44403
|
-
discriminatedUnion("event_type", [
|
|
44404
|
-
object({
|
|
44405
|
-
event_type: literal("bot_offline"),
|
|
44406
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44407
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44408
|
-
data: BotOfflineEvent
|
|
44409
|
-
}).describe("机器人离线事件"),
|
|
44410
|
-
object({
|
|
44411
|
-
event_type: literal("message_receive"),
|
|
44412
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44413
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44414
|
-
data: IncomingMessage
|
|
44415
|
-
}).describe("消息接收事件"),
|
|
44416
|
-
object({
|
|
44417
|
-
event_type: literal("message_recall"),
|
|
44418
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44419
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44420
|
-
data: MessageRecallEvent
|
|
44421
|
-
}).describe("消息撤回事件"),
|
|
44422
|
-
object({
|
|
44423
|
-
event_type: literal("peer_pin_change"),
|
|
44424
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44425
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44426
|
-
data: PeerPinChangeEvent
|
|
44427
|
-
}).describe("会话置顶变更事件"),
|
|
44428
|
-
object({
|
|
44429
|
-
event_type: literal("friend_request"),
|
|
44430
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44431
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44432
|
-
data: FriendRequestEvent
|
|
44433
|
-
}).describe("好友请求事件"),
|
|
44434
|
-
object({
|
|
44435
|
-
event_type: literal("group_join_request"),
|
|
44436
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44437
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44438
|
-
data: GroupJoinRequestEvent
|
|
44439
|
-
}).describe("入群请求事件"),
|
|
44440
|
-
object({
|
|
44441
|
-
event_type: literal("group_invited_join_request"),
|
|
44442
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44443
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44444
|
-
data: GroupInvitedJoinRequestEvent
|
|
44445
|
-
}).describe("群成员邀请他人入群请求事件"),
|
|
44446
|
-
object({
|
|
44447
|
-
event_type: literal("group_invitation"),
|
|
44448
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44449
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44450
|
-
data: GroupInvitationEvent
|
|
44451
|
-
}).describe("他人邀请自身入群事件"),
|
|
44452
|
-
object({
|
|
44453
|
-
event_type: literal("friend_nudge"),
|
|
44454
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44455
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44456
|
-
data: FriendNudgeEvent
|
|
44457
|
-
}).describe("好友戳一戳事件"),
|
|
44458
|
-
object({
|
|
44459
|
-
event_type: literal("friend_file_upload"),
|
|
44460
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44461
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44462
|
-
data: FriendFileUploadEvent
|
|
44463
|
-
}).describe("好友文件上传事件"),
|
|
44464
|
-
object({
|
|
44465
|
-
event_type: literal("group_admin_change"),
|
|
44466
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44467
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44468
|
-
data: GroupAdminChangeEvent
|
|
44469
|
-
}).describe("群管理员变更事件"),
|
|
44470
|
-
object({
|
|
44471
|
-
event_type: literal("group_essence_message_change"),
|
|
44472
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44473
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44474
|
-
data: GroupEssenceMessageChangeEvent
|
|
44475
|
-
}).describe("群精华消息变更事件"),
|
|
44476
|
-
object({
|
|
44477
|
-
event_type: literal("group_member_increase"),
|
|
44478
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44479
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44480
|
-
data: GroupMemberIncreaseEvent
|
|
44481
|
-
}).describe("群成员增加事件"),
|
|
44482
|
-
object({
|
|
44483
|
-
event_type: literal("group_member_decrease"),
|
|
44484
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44485
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44486
|
-
data: GroupMemberDecreaseEvent
|
|
44487
|
-
}).describe("群成员减少事件"),
|
|
44488
|
-
object({
|
|
44489
|
-
event_type: literal("group_name_change"),
|
|
44490
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44491
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44492
|
-
data: GroupNameChangeEvent
|
|
44493
|
-
}).describe("群名称变更事件"),
|
|
44494
|
-
object({
|
|
44495
|
-
event_type: literal("group_message_reaction"),
|
|
44496
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44497
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44498
|
-
data: GroupMessageReactionEvent
|
|
44499
|
-
}).describe("群消息表情回应事件"),
|
|
44500
|
-
object({
|
|
44501
|
-
event_type: literal("group_mute"),
|
|
44502
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44503
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44504
|
-
data: GroupMuteEvent
|
|
44505
|
-
}).describe("群禁言事件"),
|
|
44506
|
-
object({
|
|
44507
|
-
event_type: literal("group_whole_mute"),
|
|
44508
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44509
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44510
|
-
data: GroupWholeMuteEvent
|
|
44511
|
-
}).describe("群全体禁言事件"),
|
|
44512
|
-
object({
|
|
44513
|
-
event_type: literal("group_nudge"),
|
|
44514
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44515
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44516
|
-
data: GroupNudgeEvent
|
|
44517
|
-
}).describe("群戳一戳事件"),
|
|
44518
|
-
object({
|
|
44519
|
-
event_type: literal("group_file_upload"),
|
|
44520
|
-
time: ZInt64.describe("事件 Unix 时间戳(秒)"),
|
|
44521
|
-
self_id: ZUin.describe("机器人 QQ 号"),
|
|
44522
|
-
data: GroupFileUploadEvent
|
|
44523
|
-
}).describe("群文件上传事件")
|
|
44524
|
-
]).describe("事件");
|
|
44525
|
-
var milkyVersion = "1.2.0".split(".").slice(0, 2).join(".");
|
|
44526
|
-
var CachedApiBase = object({ no_cache: ZBooleanWithDefault(false).describe("是否强制不使用缓存") });
|
|
44527
44578
|
var GetLoginInfoOutput = object({
|
|
44528
|
-
uin:
|
|
44529
|
-
nickname:
|
|
44530
|
-
});
|
|
44579
|
+
uin: zUin.describe("登录 QQ 号"),
|
|
44580
|
+
nickname: string$1().describe("登录昵称")
|
|
44581
|
+
}).describe("get_login_info 响应数据");
|
|
44531
44582
|
var GetImplInfoOutput = object({
|
|
44532
|
-
impl_name:
|
|
44533
|
-
impl_version:
|
|
44534
|
-
qq_protocol_version:
|
|
44583
|
+
impl_name: string$1().describe("协议端名称"),
|
|
44584
|
+
impl_version: string$1().describe("协议端版本"),
|
|
44585
|
+
qq_protocol_version: string$1().describe("协议端使用的 QQ 协议版本"),
|
|
44535
44586
|
qq_protocol_type: _enum([
|
|
44536
44587
|
"windows",
|
|
44537
44588
|
"linux",
|
|
@@ -44543,306 +44594,320 @@ var GetImplInfoOutput = object({
|
|
|
44543
44594
|
"harmony",
|
|
44544
44595
|
"watch"
|
|
44545
44596
|
]).describe("协议端使用的 QQ 协议平台"),
|
|
44546
|
-
milky_version:
|
|
44547
|
-
});
|
|
44548
|
-
var GetUserProfileInput = object({ user_id:
|
|
44597
|
+
milky_version: string$1().describe("协议端实现的 Milky 协议版本,目前为 \"1.2\"")
|
|
44598
|
+
}).describe("get_impl_info 响应数据");
|
|
44599
|
+
var GetUserProfileInput = object({ user_id: zUin.describe("用户 QQ 号") }).describe("get_user_profile 请求参数");
|
|
44549
44600
|
var GetUserProfileOutput = object({
|
|
44550
|
-
nickname:
|
|
44551
|
-
qid:
|
|
44552
|
-
age:
|
|
44601
|
+
nickname: string$1().describe("昵称"),
|
|
44602
|
+
qid: string$1().describe("QID"),
|
|
44603
|
+
age: number$1().int().nonnegative().describe("年龄"),
|
|
44553
44604
|
sex: _enum([
|
|
44554
44605
|
"male",
|
|
44555
44606
|
"female",
|
|
44556
44607
|
"unknown"
|
|
44557
44608
|
]).describe("性别"),
|
|
44558
|
-
remark:
|
|
44559
|
-
bio:
|
|
44560
|
-
level:
|
|
44561
|
-
country:
|
|
44562
|
-
city:
|
|
44563
|
-
school:
|
|
44564
|
-
});
|
|
44565
|
-
var GetFriendListInput =
|
|
44566
|
-
var GetFriendListOutput = object({ friends: array(lazy(() => FriendEntity)).describe("好友列表") });
|
|
44567
|
-
var GetFriendInfoInput = object({
|
|
44568
|
-
|
|
44569
|
-
|
|
44570
|
-
|
|
44571
|
-
var
|
|
44572
|
-
var
|
|
44573
|
-
var
|
|
44574
|
-
var
|
|
44609
|
+
remark: string$1().describe("备注"),
|
|
44610
|
+
bio: string$1().describe("个性签名"),
|
|
44611
|
+
level: number$1().int().nonnegative().describe("QQ 等级"),
|
|
44612
|
+
country: string$1().describe("国家或地区"),
|
|
44613
|
+
city: string$1().describe("城市"),
|
|
44614
|
+
school: string$1().describe("学校")
|
|
44615
|
+
}).describe("get_user_profile 响应数据");
|
|
44616
|
+
var GetFriendListInput = object({ no_cache: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否强制不使用缓存") }).describe("get_friend_list 请求参数");
|
|
44617
|
+
var GetFriendListOutput = object({ friends: array(lazy(() => FriendEntity)).describe("好友列表") }).describe("get_friend_list 响应数据");
|
|
44618
|
+
var GetFriendInfoInput = object({
|
|
44619
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
44620
|
+
no_cache: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否强制不使用缓存")
|
|
44621
|
+
}).describe("get_friend_info 请求参数");
|
|
44622
|
+
var GetFriendInfoOutput = object({ friend: lazy(() => FriendEntity).describe("好友信息") }).describe("get_friend_info 响应数据");
|
|
44623
|
+
var GetGroupListInput = object({ no_cache: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否强制不使用缓存") }).describe("get_group_list 请求参数");
|
|
44624
|
+
var GetGroupListOutput = object({ groups: array(lazy(() => GroupEntity)).describe("群列表") }).describe("get_group_list 响应数据");
|
|
44625
|
+
var GetGroupInfoInput = object({
|
|
44626
|
+
group_id: zUin.describe("群号"),
|
|
44627
|
+
no_cache: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否强制不使用缓存")
|
|
44628
|
+
}).describe("get_group_info 请求参数");
|
|
44629
|
+
var GetGroupInfoOutput = object({ group: lazy(() => GroupEntity).describe("群信息") }).describe("get_group_info 响应数据");
|
|
44630
|
+
var GetGroupMemberListInput = object({
|
|
44631
|
+
group_id: zUin.describe("群号"),
|
|
44632
|
+
no_cache: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否强制不使用缓存")
|
|
44633
|
+
}).describe("get_group_member_list 请求参数");
|
|
44634
|
+
var GetGroupMemberListOutput = object({ members: array(lazy(() => GroupMemberEntity)).describe("群成员列表") }).describe("get_group_member_list 响应数据");
|
|
44575
44635
|
var GetGroupMemberInfoInput = object({
|
|
44576
|
-
group_id:
|
|
44577
|
-
user_id:
|
|
44578
|
-
|
|
44579
|
-
|
|
44636
|
+
group_id: zUin.describe("群号"),
|
|
44637
|
+
user_id: zUin.describe("群成员 QQ 号"),
|
|
44638
|
+
no_cache: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否强制不使用缓存")
|
|
44639
|
+
}).describe("get_group_member_info 请求参数");
|
|
44640
|
+
var GetGroupMemberInfoOutput = object({ member: lazy(() => GroupMemberEntity).describe("群成员信息") }).describe("get_group_member_info 响应数据");
|
|
44580
44641
|
var GetPeerPinsOutput = object({
|
|
44581
44642
|
friends: array(lazy(() => FriendEntity)).describe("置顶的好友列表"),
|
|
44582
44643
|
groups: array(lazy(() => GroupEntity)).describe("置顶的群列表")
|
|
44583
|
-
});
|
|
44644
|
+
}).describe("get_peer_pins 响应数据");
|
|
44584
44645
|
var SetPeerPinInput = object({
|
|
44585
44646
|
message_scene: _enum([
|
|
44586
44647
|
"friend",
|
|
44587
44648
|
"group",
|
|
44588
44649
|
"temp"
|
|
44589
44650
|
]).describe("要设置的会话的消息场景"),
|
|
44590
|
-
peer_id:
|
|
44591
|
-
is_pinned:
|
|
44592
|
-
});
|
|
44593
|
-
var SetAvatarInput = object({ uri:
|
|
44594
|
-
var SetNicknameInput = object({ new_nickname:
|
|
44595
|
-
var SetBioInput = object({ new_bio:
|
|
44596
|
-
var GetCustomFaceUrlListOutput = object({ urls: array(
|
|
44597
|
-
var GetCookiesInput = object({ domain:
|
|
44598
|
-
var GetCookiesOutput = object({ cookies:
|
|
44599
|
-
var GetCSRFTokenOutput = object({ csrf_token:
|
|
44600
|
-
var
|
|
44601
|
-
|
|
44602
|
-
|
|
44603
|
-
|
|
44604
|
-
|
|
44605
|
-
|
|
44606
|
-
|
|
44607
|
-
|
|
44608
|
-
var
|
|
44651
|
+
peer_id: zUin.describe("要设置的好友 QQ 号或群号"),
|
|
44652
|
+
is_pinned: boolean$1().nullish().default(true).transform((val) => val ?? true).describe("是否置顶, `false` 表示取消置顶")
|
|
44653
|
+
}).describe("set_peer_pin 请求参数");
|
|
44654
|
+
var SetAvatarInput = object({ uri: string$1().describe("头像文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式") }).describe("set_avatar 请求参数");
|
|
44655
|
+
var SetNicknameInput = object({ new_nickname: string$1().describe("新昵称") }).describe("set_nickname 请求参数");
|
|
44656
|
+
var SetBioInput = object({ new_bio: string$1().describe("新个性签名") }).describe("set_bio 请求参数");
|
|
44657
|
+
var GetCustomFaceUrlListOutput = object({ urls: array(string$1()).describe("自定义表情 URL 列表") }).describe("get_custom_face_url_list 响应数据");
|
|
44658
|
+
var GetCookiesInput = object({ domain: string$1().describe("需要获取 Cookies 的域名") }).describe("get_cookies 请求参数");
|
|
44659
|
+
var GetCookiesOutput = object({ cookies: string$1().describe("域名对应的 Cookies 字符串") }).describe("get_cookies 响应数据");
|
|
44660
|
+
var GetCSRFTokenOutput = object({ csrf_token: string$1().describe("CSRF Token") }).describe("get_csrf_token 响应数据");
|
|
44661
|
+
var SendPrivateMessageInput = object({
|
|
44662
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
44663
|
+
message: array(lazy(() => OutgoingSegment)).describe("消息内容")
|
|
44664
|
+
}).describe("send_private_message 请求参数");
|
|
44665
|
+
var SendPrivateMessageOutput = object({
|
|
44666
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44667
|
+
time: number$1().int().nonnegative().describe("消息发送时间")
|
|
44668
|
+
}).describe("send_private_message 响应数据");
|
|
44669
|
+
var SendGroupMessageInput = object({
|
|
44670
|
+
group_id: zUin.describe("群号"),
|
|
44671
|
+
message: array(lazy(() => OutgoingSegment)).describe("消息内容")
|
|
44672
|
+
}).describe("send_group_message 请求参数");
|
|
44673
|
+
var SendGroupMessageOutput = object({
|
|
44674
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44675
|
+
time: number$1().int().nonnegative().describe("消息发送时间")
|
|
44676
|
+
}).describe("send_group_message 响应数据");
|
|
44609
44677
|
var RecallPrivateMessageInput = object({
|
|
44610
|
-
user_id:
|
|
44611
|
-
message_seq:
|
|
44612
|
-
});
|
|
44678
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
44679
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号")
|
|
44680
|
+
}).describe("recall_private_message 请求参数");
|
|
44613
44681
|
var RecallGroupMessageInput = object({
|
|
44614
|
-
group_id:
|
|
44615
|
-
message_seq:
|
|
44616
|
-
});
|
|
44682
|
+
group_id: zUin.describe("群号"),
|
|
44683
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号")
|
|
44684
|
+
}).describe("recall_group_message 请求参数");
|
|
44617
44685
|
var GetMessageInput = object({
|
|
44618
44686
|
message_scene: _enum([
|
|
44619
44687
|
"friend",
|
|
44620
44688
|
"group",
|
|
44621
44689
|
"temp"
|
|
44622
44690
|
]).describe("消息场景"),
|
|
44623
|
-
peer_id:
|
|
44624
|
-
message_seq:
|
|
44625
|
-
});
|
|
44626
|
-
var GetMessageOutput = object({ message: lazy(() => IncomingMessage).describe("消息内容") });
|
|
44691
|
+
peer_id: zUin.describe("好友 QQ 号或群号"),
|
|
44692
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号")
|
|
44693
|
+
}).describe("get_message 请求参数");
|
|
44694
|
+
var GetMessageOutput = object({ message: lazy(() => IncomingMessage).describe("消息内容") }).describe("get_message 响应数据");
|
|
44627
44695
|
var GetHistoryMessagesInput = object({
|
|
44628
44696
|
message_scene: _enum([
|
|
44629
44697
|
"friend",
|
|
44630
44698
|
"group",
|
|
44631
44699
|
"temp"
|
|
44632
44700
|
]).describe("消息场景"),
|
|
44633
|
-
peer_id:
|
|
44634
|
-
start_message_seq:
|
|
44635
|
-
limit: number$1().int().
|
|
44636
|
-
});
|
|
44701
|
+
peer_id: zUin.describe("好友 QQ 号或群号"),
|
|
44702
|
+
start_message_seq: number$1().int().nonnegative().nullish().describe("起始消息序列号,由此开始从新到旧查询,不提供则从最新消息开始"),
|
|
44703
|
+
limit: number$1().int().nonnegative().nullish().default(20).transform((val) => val ?? 20).describe("期望获取到的消息数量,最多 30 条")
|
|
44704
|
+
}).describe("get_history_messages 请求参数");
|
|
44637
44705
|
var GetHistoryMessagesOutput = object({
|
|
44638
44706
|
messages: array(lazy(() => IncomingMessage)).describe("获取到的消息(message_seq 升序排列),部分消息可能不存在,如撤回的消息"),
|
|
44639
|
-
next_message_seq:
|
|
44640
|
-
});
|
|
44641
|
-
var GetResourceTempUrlInput = object({ resource_id:
|
|
44642
|
-
var GetResourceTempUrlOutput = object({ url:
|
|
44643
|
-
var GetForwardedMessagesInput = object({ forward_id:
|
|
44644
|
-
var GetForwardedMessagesOutput = object({ messages: array(lazy(() => IncomingForwardedMessage)).describe("转发消息内容") });
|
|
44707
|
+
next_message_seq: number$1().int().nonnegative().nullish().describe("下一页起始消息序列号")
|
|
44708
|
+
}).describe("get_history_messages 响应数据");
|
|
44709
|
+
var GetResourceTempUrlInput = object({ resource_id: string$1().describe("资源 ID") }).describe("get_resource_temp_url 请求参数");
|
|
44710
|
+
var GetResourceTempUrlOutput = object({ url: string$1().describe("临时资源链接") }).describe("get_resource_temp_url 响应数据");
|
|
44711
|
+
var GetForwardedMessagesInput = object({ forward_id: string$1().describe("转发消息 ID") }).describe("get_forwarded_messages 请求参数");
|
|
44712
|
+
var GetForwardedMessagesOutput = object({ messages: array(lazy(() => IncomingForwardedMessage)).describe("转发消息内容") }).describe("get_forwarded_messages 响应数据");
|
|
44645
44713
|
var MarkMessageAsReadInput = object({
|
|
44646
44714
|
message_scene: _enum([
|
|
44647
44715
|
"friend",
|
|
44648
44716
|
"group",
|
|
44649
44717
|
"temp"
|
|
44650
44718
|
]).describe("消息场景"),
|
|
44651
|
-
peer_id:
|
|
44652
|
-
message_seq:
|
|
44653
|
-
});
|
|
44719
|
+
peer_id: zUin.describe("好友 QQ 号或群号"),
|
|
44720
|
+
message_seq: number$1().int().nonnegative().describe("标为已读的消息序列号,该消息及更早的消息将被标记为已读")
|
|
44721
|
+
}).describe("mark_message_as_read 请求参数");
|
|
44654
44722
|
var SendFriendNudgeInput = object({
|
|
44655
|
-
user_id:
|
|
44656
|
-
is_self:
|
|
44657
|
-
});
|
|
44723
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
44724
|
+
is_self: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否戳自己")
|
|
44725
|
+
}).describe("send_friend_nudge 请求参数");
|
|
44658
44726
|
var SendProfileLikeInput = object({
|
|
44659
|
-
user_id:
|
|
44660
|
-
count:
|
|
44661
|
-
});
|
|
44662
|
-
var DeleteFriendInput = object({ user_id:
|
|
44727
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
44728
|
+
count: number$1().int().nonnegative().nullish().default(1).transform((val) => val ?? 1).describe("点赞数量")
|
|
44729
|
+
}).describe("send_profile_like 请求参数");
|
|
44730
|
+
var DeleteFriendInput = object({ user_id: zUin.describe("好友 QQ 号") }).describe("delete_friend 请求参数");
|
|
44663
44731
|
var GetFriendRequestsInput = object({
|
|
44664
|
-
limit:
|
|
44665
|
-
is_filtered:
|
|
44666
|
-
});
|
|
44667
|
-
var GetFriendRequestsOutput = object({ requests: array(lazy(() => FriendRequest)).describe("好友请求列表") });
|
|
44732
|
+
limit: number$1().int().nonnegative().nullish().default(20).transform((val) => val ?? 20).describe("获取的最大请求数量"),
|
|
44733
|
+
is_filtered: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("`true` 表示只获取被过滤(由风险账号发起)的通知,`false` 表示只获取未被过滤的通知")
|
|
44734
|
+
}).describe("get_friend_requests 请求参数");
|
|
44735
|
+
var GetFriendRequestsOutput = object({ requests: array(lazy(() => FriendRequest)).describe("好友请求列表") }).describe("get_friend_requests 响应数据");
|
|
44668
44736
|
var AcceptFriendRequestInput = object({
|
|
44669
|
-
initiator_uid:
|
|
44670
|
-
is_filtered:
|
|
44671
|
-
});
|
|
44737
|
+
initiator_uid: string$1().describe("请求发起者 UID"),
|
|
44738
|
+
is_filtered: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否是被过滤的请求")
|
|
44739
|
+
}).describe("accept_friend_request 请求参数");
|
|
44672
44740
|
var RejectFriendRequestInput = object({
|
|
44673
|
-
initiator_uid:
|
|
44674
|
-
is_filtered:
|
|
44675
|
-
reason:
|
|
44676
|
-
});
|
|
44677
|
-
function ZRobustArray(element) {
|
|
44678
|
-
return zod_default.array(element.catch(null)).transform((val) => val.filter((item) => item !== null));
|
|
44679
|
-
}
|
|
44741
|
+
initiator_uid: string$1().describe("请求发起者 UID"),
|
|
44742
|
+
is_filtered: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否是被过滤的请求"),
|
|
44743
|
+
reason: string$1().nullish().describe("拒绝理由")
|
|
44744
|
+
}).describe("reject_friend_request 请求参数");
|
|
44680
44745
|
var SetGroupNameInput = object({
|
|
44681
|
-
group_id:
|
|
44682
|
-
new_group_name:
|
|
44683
|
-
});
|
|
44746
|
+
group_id: zUin.describe("群号"),
|
|
44747
|
+
new_group_name: string$1().describe("新群名称")
|
|
44748
|
+
}).describe("set_group_name 请求参数");
|
|
44684
44749
|
var SetGroupAvatarInput = object({
|
|
44685
|
-
group_id:
|
|
44686
|
-
image_uri:
|
|
44687
|
-
});
|
|
44750
|
+
group_id: zUin.describe("群号"),
|
|
44751
|
+
image_uri: string$1().describe("头像文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式")
|
|
44752
|
+
}).describe("set_group_avatar 请求参数");
|
|
44688
44753
|
var SetGroupMemberCardInput = object({
|
|
44689
|
-
group_id:
|
|
44690
|
-
user_id:
|
|
44691
|
-
card:
|
|
44692
|
-
});
|
|
44754
|
+
group_id: zUin.describe("群号"),
|
|
44755
|
+
user_id: zUin.describe("被设置的群成员 QQ 号"),
|
|
44756
|
+
card: string$1().describe("新群名片")
|
|
44757
|
+
}).describe("set_group_member_card 请求参数");
|
|
44693
44758
|
var SetGroupMemberSpecialTitleInput = object({
|
|
44694
|
-
group_id:
|
|
44695
|
-
user_id:
|
|
44696
|
-
special_title:
|
|
44697
|
-
});
|
|
44759
|
+
group_id: zUin.describe("群号"),
|
|
44760
|
+
user_id: zUin.describe("被设置的群成员 QQ 号"),
|
|
44761
|
+
special_title: string$1().describe("新专属头衔")
|
|
44762
|
+
}).describe("set_group_member_special_title 请求参数");
|
|
44698
44763
|
var SetGroupMemberAdminInput = object({
|
|
44699
|
-
group_id:
|
|
44700
|
-
user_id:
|
|
44701
|
-
is_set:
|
|
44702
|
-
});
|
|
44764
|
+
group_id: zUin.describe("群号"),
|
|
44765
|
+
user_id: zUin.describe("被设置的 QQ 号"),
|
|
44766
|
+
is_set: boolean$1().nullish().default(true).transform((val) => val ?? true).describe("是否设置为管理员,`false` 表示取消管理员")
|
|
44767
|
+
}).describe("set_group_member_admin 请求参数");
|
|
44703
44768
|
var SetGroupMemberMuteInput = object({
|
|
44704
|
-
group_id:
|
|
44705
|
-
user_id:
|
|
44706
|
-
duration:
|
|
44707
|
-
});
|
|
44769
|
+
group_id: zUin.describe("群号"),
|
|
44770
|
+
user_id: zUin.describe("被设置的 QQ 号"),
|
|
44771
|
+
duration: number$1().int().nonnegative().nullish().default(0).transform((val) => val ?? 0).describe("禁言持续时间(秒),设为 `0` 为取消禁言")
|
|
44772
|
+
}).describe("set_group_member_mute 请求参数");
|
|
44708
44773
|
var SetGroupWholeMuteInput = object({
|
|
44709
|
-
group_id:
|
|
44710
|
-
is_mute:
|
|
44711
|
-
});
|
|
44774
|
+
group_id: zUin.describe("群号"),
|
|
44775
|
+
is_mute: boolean$1().nullish().default(true).transform((val) => val ?? true).describe("是否开启全员禁言,`false` 表示取消全员禁言")
|
|
44776
|
+
}).describe("set_group_whole_mute 请求参数");
|
|
44712
44777
|
var KickGroupMemberInput = object({
|
|
44713
|
-
group_id:
|
|
44714
|
-
user_id:
|
|
44715
|
-
reject_add_request:
|
|
44716
|
-
});
|
|
44717
|
-
var GetGroupAnnouncementsInput = object({ group_id:
|
|
44718
|
-
var GetGroupAnnouncementsOutput = object({ announcements: array(lazy(() => GroupAnnouncementEntity)).describe("群公告列表") });
|
|
44778
|
+
group_id: zUin.describe("群号"),
|
|
44779
|
+
user_id: zUin.describe("被踢的 QQ 号"),
|
|
44780
|
+
reject_add_request: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否拒绝加群申请,`false` 表示不拒绝")
|
|
44781
|
+
}).describe("kick_group_member 请求参数");
|
|
44782
|
+
var GetGroupAnnouncementsInput = object({ group_id: zUin.describe("群号") }).describe("get_group_announcements 请求参数");
|
|
44783
|
+
var GetGroupAnnouncementsOutput = object({ announcements: array(lazy(() => GroupAnnouncementEntity)).describe("群公告列表") }).describe("get_group_announcements 响应数据");
|
|
44719
44784
|
var SendGroupAnnouncementInput = object({
|
|
44720
|
-
group_id:
|
|
44721
|
-
content:
|
|
44722
|
-
image_uri:
|
|
44723
|
-
});
|
|
44785
|
+
group_id: zUin.describe("群号"),
|
|
44786
|
+
content: string$1().describe("公告内容"),
|
|
44787
|
+
image_uri: string$1().nullish().describe("公告附带图像文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式")
|
|
44788
|
+
}).describe("send_group_announcement 请求参数");
|
|
44724
44789
|
var DeleteGroupAnnouncementInput = object({
|
|
44725
|
-
group_id:
|
|
44726
|
-
announcement_id:
|
|
44727
|
-
});
|
|
44790
|
+
group_id: zUin.describe("群号"),
|
|
44791
|
+
announcement_id: string$1().describe("公告 ID")
|
|
44792
|
+
}).describe("delete_group_announcement 请求参数");
|
|
44728
44793
|
var GetGroupEssenceMessagesInput = object({
|
|
44729
|
-
group_id:
|
|
44730
|
-
page_index:
|
|
44731
|
-
page_size:
|
|
44732
|
-
});
|
|
44794
|
+
group_id: zUin.describe("群号"),
|
|
44795
|
+
page_index: number$1().int().nonnegative().describe("页码索引,从 0 开始"),
|
|
44796
|
+
page_size: number$1().int().nonnegative().describe("每页包含的精华消息数量")
|
|
44797
|
+
}).describe("get_group_essence_messages 请求参数");
|
|
44733
44798
|
var GetGroupEssenceMessagesOutput = object({
|
|
44734
44799
|
messages: array(lazy(() => GroupEssenceMessage)).describe("精华消息列表"),
|
|
44735
|
-
is_end:
|
|
44736
|
-
});
|
|
44800
|
+
is_end: boolean$1().describe("是否已到最后一页")
|
|
44801
|
+
}).describe("get_group_essence_messages 响应数据");
|
|
44737
44802
|
var SetGroupEssenceMessageInput = object({
|
|
44738
|
-
group_id:
|
|
44739
|
-
message_seq:
|
|
44740
|
-
is_set:
|
|
44741
|
-
});
|
|
44742
|
-
var QuitGroupInput = object({ group_id:
|
|
44803
|
+
group_id: zUin.describe("群号"),
|
|
44804
|
+
message_seq: number$1().int().nonnegative().describe("消息序列号"),
|
|
44805
|
+
is_set: boolean$1().nullish().default(true).transform((val) => val ?? true).describe("是否设置为精华消息,`false` 表示取消精华")
|
|
44806
|
+
}).describe("set_group_essence_message 请求参数");
|
|
44807
|
+
var QuitGroupInput = object({ group_id: zUin.describe("群号") }).describe("quit_group 请求参数");
|
|
44743
44808
|
var SendGroupMessageReactionInput = object({
|
|
44744
|
-
group_id:
|
|
44745
|
-
message_seq:
|
|
44746
|
-
reaction:
|
|
44747
|
-
reaction_type: _enum(["face", "emoji"]).default("face").describe("发送的回应类型"),
|
|
44748
|
-
is_add:
|
|
44749
|
-
});
|
|
44809
|
+
group_id: zUin.describe("群号"),
|
|
44810
|
+
message_seq: number$1().int().nonnegative().describe("要回应的消息序列号"),
|
|
44811
|
+
reaction: string$1().describe("发送的回应的表情 ID"),
|
|
44812
|
+
reaction_type: _enum(["face", "emoji"]).nullish().default("face").transform((val) => val ?? "face").describe("发送的回应类型"),
|
|
44813
|
+
is_add: boolean$1().nullish().default(true).transform((val) => val ?? true).describe("是否添加表情,`false` 表示取消")
|
|
44814
|
+
}).describe("send_group_message_reaction 请求参数");
|
|
44750
44815
|
var SendGroupNudgeInput = object({
|
|
44751
|
-
group_id:
|
|
44752
|
-
user_id:
|
|
44753
|
-
});
|
|
44816
|
+
group_id: zUin.describe("群号"),
|
|
44817
|
+
user_id: zUin.describe("被戳的群成员 QQ 号")
|
|
44818
|
+
}).describe("send_group_nudge 请求参数");
|
|
44754
44819
|
var GetGroupNotificationsInput = object({
|
|
44755
|
-
start_notification_seq:
|
|
44756
|
-
is_filtered:
|
|
44757
|
-
limit:
|
|
44758
|
-
});
|
|
44820
|
+
start_notification_seq: number$1().int().nonnegative().nullish().describe("起始通知序列号"),
|
|
44821
|
+
is_filtered: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("`true` 表示只获取被过滤(由风险账号发起)的通知,`false` 表示只获取未被过滤的通知"),
|
|
44822
|
+
limit: number$1().int().nonnegative().nullish().default(20).transform((val) => val ?? 20).describe("获取的最大通知数量")
|
|
44823
|
+
}).describe("get_group_notifications 请求参数");
|
|
44759
44824
|
var GetGroupNotificationsOutput = object({
|
|
44760
|
-
notifications:
|
|
44761
|
-
next_notification_seq:
|
|
44762
|
-
});
|
|
44825
|
+
notifications: zDropBadElementArray(GroupNotification).describe("获取到的群通知(notification_seq 降序排列),序列号不一定连续"),
|
|
44826
|
+
next_notification_seq: number$1().int().nonnegative().nullish().describe("下一页起始通知序列号")
|
|
44827
|
+
}).describe("get_group_notifications 响应数据");
|
|
44763
44828
|
var AcceptGroupRequestInput = object({
|
|
44764
|
-
notification_seq:
|
|
44829
|
+
notification_seq: number$1().int().nonnegative().describe("请求对应的通知序列号"),
|
|
44765
44830
|
notification_type: _enum(["join_request", "invited_join_request"]).describe("请求对应的通知类型"),
|
|
44766
|
-
group_id:
|
|
44767
|
-
is_filtered:
|
|
44768
|
-
});
|
|
44831
|
+
group_id: zUin.describe("请求所在的群号"),
|
|
44832
|
+
is_filtered: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否是被过滤的请求")
|
|
44833
|
+
}).describe("accept_group_request 请求参数");
|
|
44769
44834
|
var RejectGroupRequestInput = object({
|
|
44770
|
-
notification_seq:
|
|
44835
|
+
notification_seq: number$1().int().nonnegative().describe("请求对应的通知序列号"),
|
|
44771
44836
|
notification_type: _enum(["join_request", "invited_join_request"]).describe("请求对应的通知类型"),
|
|
44772
|
-
group_id:
|
|
44773
|
-
is_filtered:
|
|
44774
|
-
reason:
|
|
44775
|
-
});
|
|
44837
|
+
group_id: zUin.describe("请求所在的群号"),
|
|
44838
|
+
is_filtered: boolean$1().nullish().default(false).transform((val) => val ?? false).describe("是否是被过滤的请求"),
|
|
44839
|
+
reason: string$1().nullish().describe("拒绝理由")
|
|
44840
|
+
}).describe("reject_group_request 请求参数");
|
|
44776
44841
|
var AcceptGroupInvitationInput = object({
|
|
44777
|
-
group_id:
|
|
44778
|
-
invitation_seq:
|
|
44779
|
-
});
|
|
44842
|
+
group_id: zUin.describe("群号"),
|
|
44843
|
+
invitation_seq: number$1().int().nonnegative().describe("邀请序列号")
|
|
44844
|
+
}).describe("accept_group_invitation 请求参数");
|
|
44780
44845
|
var RejectGroupInvitationInput = object({
|
|
44781
|
-
group_id:
|
|
44782
|
-
invitation_seq:
|
|
44783
|
-
});
|
|
44846
|
+
group_id: zUin.describe("群号"),
|
|
44847
|
+
invitation_seq: number$1().int().nonnegative().describe("邀请序列号")
|
|
44848
|
+
}).describe("reject_group_invitation 请求参数");
|
|
44784
44849
|
var UploadPrivateFileInput = object({
|
|
44785
|
-
user_id:
|
|
44786
|
-
file_uri:
|
|
44787
|
-
file_name:
|
|
44788
|
-
});
|
|
44789
|
-
var UploadPrivateFileOutput = object({ file_id:
|
|
44850
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
44851
|
+
file_uri: string$1().describe("文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式"),
|
|
44852
|
+
file_name: string$1().describe("文件名称")
|
|
44853
|
+
}).describe("upload_private_file 请求参数");
|
|
44854
|
+
var UploadPrivateFileOutput = object({ file_id: string$1().describe("文件 ID") }).describe("upload_private_file 响应数据");
|
|
44790
44855
|
var UploadGroupFileInput = object({
|
|
44791
|
-
group_id:
|
|
44792
|
-
parent_folder_id:
|
|
44793
|
-
file_uri:
|
|
44794
|
-
file_name:
|
|
44795
|
-
});
|
|
44796
|
-
var UploadGroupFileOutput = object({ file_id:
|
|
44856
|
+
group_id: zUin.describe("群号"),
|
|
44857
|
+
parent_folder_id: string$1().nullish().default("/").transform((val) => val ?? "/").describe("目标文件夹 ID"),
|
|
44858
|
+
file_uri: string$1().describe("文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式"),
|
|
44859
|
+
file_name: string$1().describe("文件名称")
|
|
44860
|
+
}).describe("upload_group_file 请求参数");
|
|
44861
|
+
var UploadGroupFileOutput = object({ file_id: string$1().describe("文件 ID") }).describe("upload_group_file 响应数据");
|
|
44797
44862
|
var GetPrivateFileDownloadUrlInput = object({
|
|
44798
|
-
user_id:
|
|
44799
|
-
file_id:
|
|
44800
|
-
file_hash:
|
|
44801
|
-
});
|
|
44802
|
-
var GetPrivateFileDownloadUrlOutput = object({ download_url:
|
|
44863
|
+
user_id: zUin.describe("好友 QQ 号"),
|
|
44864
|
+
file_id: string$1().describe("文件 ID"),
|
|
44865
|
+
file_hash: string$1().describe("文件的 TriSHA1 哈希值")
|
|
44866
|
+
}).describe("get_private_file_download_url 请求参数");
|
|
44867
|
+
var GetPrivateFileDownloadUrlOutput = object({ download_url: string$1().describe("文件下载链接") }).describe("get_private_file_download_url 响应数据");
|
|
44803
44868
|
var GetGroupFileDownloadUrlInput = object({
|
|
44804
|
-
group_id:
|
|
44805
|
-
file_id:
|
|
44806
|
-
});
|
|
44807
|
-
var GetGroupFileDownloadUrlOutput = object({ download_url:
|
|
44869
|
+
group_id: zUin.describe("群号"),
|
|
44870
|
+
file_id: string$1().describe("文件 ID")
|
|
44871
|
+
}).describe("get_group_file_download_url 请求参数");
|
|
44872
|
+
var GetGroupFileDownloadUrlOutput = object({ download_url: string$1().describe("文件下载链接") }).describe("get_group_file_download_url 响应数据");
|
|
44808
44873
|
var GetGroupFilesInput = object({
|
|
44809
|
-
group_id:
|
|
44810
|
-
parent_folder_id:
|
|
44811
|
-
});
|
|
44874
|
+
group_id: zUin.describe("群号"),
|
|
44875
|
+
parent_folder_id: string$1().nullish().default("/").transform((val) => val ?? "/").describe("父文件夹 ID")
|
|
44876
|
+
}).describe("get_group_files 请求参数");
|
|
44812
44877
|
var GetGroupFilesOutput = object({
|
|
44813
44878
|
files: array(lazy(() => GroupFileEntity)).describe("文件列表"),
|
|
44814
44879
|
folders: array(lazy(() => GroupFolderEntity)).describe("文件夹列表")
|
|
44815
|
-
});
|
|
44880
|
+
}).describe("get_group_files 响应数据");
|
|
44816
44881
|
var MoveGroupFileInput = object({
|
|
44817
|
-
group_id:
|
|
44818
|
-
file_id:
|
|
44819
|
-
parent_folder_id:
|
|
44820
|
-
target_folder_id:
|
|
44821
|
-
});
|
|
44882
|
+
group_id: zUin.describe("群号"),
|
|
44883
|
+
file_id: string$1().describe("文件 ID"),
|
|
44884
|
+
parent_folder_id: string$1().nullish().default("/").transform((val) => val ?? "/").describe("文件所在的文件夹 ID"),
|
|
44885
|
+
target_folder_id: string$1().nullish().default("/").transform((val) => val ?? "/").describe("目标文件夹 ID")
|
|
44886
|
+
}).describe("move_group_file 请求参数");
|
|
44822
44887
|
var RenameGroupFileInput = object({
|
|
44823
|
-
group_id:
|
|
44824
|
-
file_id:
|
|
44825
|
-
parent_folder_id:
|
|
44826
|
-
new_file_name:
|
|
44827
|
-
});
|
|
44888
|
+
group_id: zUin.describe("群号"),
|
|
44889
|
+
file_id: string$1().describe("文件 ID"),
|
|
44890
|
+
parent_folder_id: string$1().nullish().default("/").transform((val) => val ?? "/").describe("文件所在的文件夹 ID"),
|
|
44891
|
+
new_file_name: string$1().describe("新文件名称")
|
|
44892
|
+
}).describe("rename_group_file 请求参数");
|
|
44828
44893
|
var DeleteGroupFileInput = object({
|
|
44829
|
-
group_id:
|
|
44830
|
-
file_id:
|
|
44831
|
-
});
|
|
44894
|
+
group_id: zUin.describe("群号"),
|
|
44895
|
+
file_id: string$1().describe("文件 ID")
|
|
44896
|
+
}).describe("delete_group_file 请求参数");
|
|
44832
44897
|
var CreateGroupFolderInput = object({
|
|
44833
|
-
group_id:
|
|
44834
|
-
folder_name:
|
|
44835
|
-
});
|
|
44836
|
-
var CreateGroupFolderOutput = object({ folder_id:
|
|
44898
|
+
group_id: zUin.describe("群号"),
|
|
44899
|
+
folder_name: string$1().describe("文件夹名称")
|
|
44900
|
+
}).describe("create_group_folder 请求参数");
|
|
44901
|
+
var CreateGroupFolderOutput = object({ folder_id: string$1().describe("文件夹 ID") }).describe("create_group_folder 响应数据");
|
|
44837
44902
|
var RenameGroupFolderInput = object({
|
|
44838
|
-
group_id:
|
|
44839
|
-
folder_id:
|
|
44840
|
-
new_folder_name:
|
|
44841
|
-
});
|
|
44903
|
+
group_id: zUin.describe("群号"),
|
|
44904
|
+
folder_id: string$1().describe("文件夹 ID"),
|
|
44905
|
+
new_folder_name: string$1().describe("新文件夹名")
|
|
44906
|
+
}).describe("rename_group_folder 请求参数");
|
|
44842
44907
|
var DeleteGroupFolderInput = object({
|
|
44843
|
-
group_id:
|
|
44844
|
-
folder_id:
|
|
44845
|
-
});
|
|
44908
|
+
group_id: zUin.describe("群号"),
|
|
44909
|
+
folder_id: string$1().describe("文件夹 ID")
|
|
44910
|
+
}).describe("delete_group_folder 请求参数");
|
|
44846
44911
|
//#endregion
|
|
44847
44912
|
//#region src/milky/common/download.ts
|
|
44848
44913
|
async function getResponse(url, headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0 Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36" }, useReferer = false) {
|
|
@@ -44857,7 +44922,7 @@ async function download(url, headers) {
|
|
|
44857
44922
|
return Buffer.from(bytes);
|
|
44858
44923
|
}
|
|
44859
44924
|
async function resolveMilkyUri(uri) {
|
|
44860
|
-
if (uri.startsWith("file://")) return await
|
|
44925
|
+
if (uri.startsWith("file://")) return await fs.readFile(fileURLToPath(uri));
|
|
44861
44926
|
if (uri.startsWith("http://") || uri.startsWith("https://")) return await download(uri);
|
|
44862
44927
|
if (uri.startsWith("base64://")) return Buffer.from(uri.slice(9), "base64");
|
|
44863
44928
|
throw new Error(`Unsupported URI scheme: ${uri}`);
|
|
@@ -45816,6 +45881,7 @@ var buildOptions = function(options) {
|
|
|
45816
45881
|
for (const { value, name } of propertyNameOptions) if (value) validatePropertyName(value, name);
|
|
45817
45882
|
if (built.onDangerousProperty === null) built.onDangerousProperty = defaultOnDangerousProperty;
|
|
45818
45883
|
built.processEntities = normalizeProcessEntities(built.processEntities);
|
|
45884
|
+
built.unpairedTagsSet = new Set(built.unpairedTags);
|
|
45819
45885
|
if (built.stopNodes && Array.isArray(built.stopNodes)) built.stopNodes = built.stopNodes.map((node) => {
|
|
45820
45886
|
if (typeof node === "string" && node.startsWith("*.")) return ".." + node.substring(2);
|
|
45821
45887
|
return node;
|
|
@@ -46206,10 +46272,11 @@ var Expression = class {
|
|
|
46206
46272
|
* @param {Object} options - Configuration options
|
|
46207
46273
|
* @param {string} options.separator - Path separator (default: '.')
|
|
46208
46274
|
*/
|
|
46209
|
-
constructor(pattern, options = {}) {
|
|
46275
|
+
constructor(pattern, options = {}, data) {
|
|
46210
46276
|
this.pattern = pattern;
|
|
46211
46277
|
this.separator = options.separator || ".";
|
|
46212
46278
|
this.segments = this._parse(pattern);
|
|
46279
|
+
this.data = data;
|
|
46213
46280
|
this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
|
|
46214
46281
|
this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
|
|
46215
46282
|
this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
|
|
@@ -46339,6 +46406,179 @@ var Expression = class {
|
|
|
46339
46406
|
}
|
|
46340
46407
|
};
|
|
46341
46408
|
//#endregion
|
|
46409
|
+
//#region node_modules/path-expression-matcher/src/ExpressionSet.js
|
|
46410
|
+
/**
|
|
46411
|
+
* ExpressionSet - An indexed collection of Expressions for efficient bulk matching
|
|
46412
|
+
*
|
|
46413
|
+
* Instead of iterating all expressions on every tag, ExpressionSet pre-indexes
|
|
46414
|
+
* them at insertion time by depth and terminal tag name. At match time, only
|
|
46415
|
+
* the relevant bucket is evaluated — typically reducing checks from O(E) to O(1)
|
|
46416
|
+
* lookup plus O(small bucket) matches.
|
|
46417
|
+
*
|
|
46418
|
+
* Three buckets are maintained:
|
|
46419
|
+
* - `_byDepthAndTag` — exact depth + exact tag name (tightest, used first)
|
|
46420
|
+
* - `_wildcardByDepth` — exact depth + wildcard tag `*` (depth-matched only)
|
|
46421
|
+
* - `_deepWildcards` — expressions containing `..` (cannot be depth-indexed)
|
|
46422
|
+
*
|
|
46423
|
+
* @example
|
|
46424
|
+
* import { Expression, ExpressionSet } from 'fast-xml-tagger';
|
|
46425
|
+
*
|
|
46426
|
+
* // Build once at config time
|
|
46427
|
+
* const stopNodes = new ExpressionSet();
|
|
46428
|
+
* stopNodes.add(new Expression('root.users.user'));
|
|
46429
|
+
* stopNodes.add(new Expression('root.config.setting'));
|
|
46430
|
+
* stopNodes.add(new Expression('..script'));
|
|
46431
|
+
*
|
|
46432
|
+
* // Query on every tag — hot path
|
|
46433
|
+
* if (stopNodes.matchesAny(matcher)) { ... }
|
|
46434
|
+
*/
|
|
46435
|
+
var ExpressionSet = class {
|
|
46436
|
+
constructor() {
|
|
46437
|
+
/** @type {Map<string, import('./Expression.js').default[]>} depth:tag → expressions */
|
|
46438
|
+
this._byDepthAndTag = /* @__PURE__ */ new Map();
|
|
46439
|
+
/** @type {Map<number, import('./Expression.js').default[]>} depth → wildcard-tag expressions */
|
|
46440
|
+
this._wildcardByDepth = /* @__PURE__ */ new Map();
|
|
46441
|
+
/** @type {import('./Expression.js').default[]} expressions containing deep wildcard (..) */
|
|
46442
|
+
this._deepWildcards = [];
|
|
46443
|
+
/** @type {Set<string>} pattern strings already added — used for deduplication */
|
|
46444
|
+
this._patterns = /* @__PURE__ */ new Set();
|
|
46445
|
+
/** @type {boolean} whether the set is sealed against further additions */
|
|
46446
|
+
this._sealed = false;
|
|
46447
|
+
}
|
|
46448
|
+
/**
|
|
46449
|
+
* Add an Expression to the set.
|
|
46450
|
+
* Duplicate patterns (same pattern string) are silently ignored.
|
|
46451
|
+
*
|
|
46452
|
+
* @param {import('./Expression.js').default} expression - A pre-constructed Expression instance
|
|
46453
|
+
* @returns {this} for chaining
|
|
46454
|
+
* @throws {TypeError} if called after seal()
|
|
46455
|
+
*
|
|
46456
|
+
* @example
|
|
46457
|
+
* set.add(new Expression('root.users.user'));
|
|
46458
|
+
* set.add(new Expression('..script'));
|
|
46459
|
+
*/
|
|
46460
|
+
add(expression) {
|
|
46461
|
+
if (this._sealed) throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");
|
|
46462
|
+
if (this._patterns.has(expression.pattern)) return this;
|
|
46463
|
+
this._patterns.add(expression.pattern);
|
|
46464
|
+
if (expression.hasDeepWildcard()) {
|
|
46465
|
+
this._deepWildcards.push(expression);
|
|
46466
|
+
return this;
|
|
46467
|
+
}
|
|
46468
|
+
const depth = expression.length;
|
|
46469
|
+
const tag = expression.segments[expression.segments.length - 1]?.tag;
|
|
46470
|
+
if (!tag || tag === "*") {
|
|
46471
|
+
if (!this._wildcardByDepth.has(depth)) this._wildcardByDepth.set(depth, []);
|
|
46472
|
+
this._wildcardByDepth.get(depth).push(expression);
|
|
46473
|
+
} else {
|
|
46474
|
+
const key = `${depth}:${tag}`;
|
|
46475
|
+
if (!this._byDepthAndTag.has(key)) this._byDepthAndTag.set(key, []);
|
|
46476
|
+
this._byDepthAndTag.get(key).push(expression);
|
|
46477
|
+
}
|
|
46478
|
+
return this;
|
|
46479
|
+
}
|
|
46480
|
+
/**
|
|
46481
|
+
* Add multiple expressions at once.
|
|
46482
|
+
*
|
|
46483
|
+
* @param {import('./Expression.js').default[]} expressions - Array of Expression instances
|
|
46484
|
+
* @returns {this} for chaining
|
|
46485
|
+
*
|
|
46486
|
+
* @example
|
|
46487
|
+
* set.addAll([
|
|
46488
|
+
* new Expression('root.users.user'),
|
|
46489
|
+
* new Expression('root.config.setting'),
|
|
46490
|
+
* ]);
|
|
46491
|
+
*/
|
|
46492
|
+
addAll(expressions) {
|
|
46493
|
+
for (const expr of expressions) this.add(expr);
|
|
46494
|
+
return this;
|
|
46495
|
+
}
|
|
46496
|
+
/**
|
|
46497
|
+
* Check whether a pattern string is already present in the set.
|
|
46498
|
+
*
|
|
46499
|
+
* @param {import('./Expression.js').default} expression
|
|
46500
|
+
* @returns {boolean}
|
|
46501
|
+
*/
|
|
46502
|
+
has(expression) {
|
|
46503
|
+
return this._patterns.has(expression.pattern);
|
|
46504
|
+
}
|
|
46505
|
+
/**
|
|
46506
|
+
* Number of expressions in the set.
|
|
46507
|
+
* @type {number}
|
|
46508
|
+
*/
|
|
46509
|
+
get size() {
|
|
46510
|
+
return this._patterns.size;
|
|
46511
|
+
}
|
|
46512
|
+
/**
|
|
46513
|
+
* Seal the set against further modifications.
|
|
46514
|
+
* Useful to prevent accidental mutations after config is built.
|
|
46515
|
+
* Calling add() or addAll() on a sealed set throws a TypeError.
|
|
46516
|
+
*
|
|
46517
|
+
* @returns {this}
|
|
46518
|
+
*/
|
|
46519
|
+
seal() {
|
|
46520
|
+
this._sealed = true;
|
|
46521
|
+
return this;
|
|
46522
|
+
}
|
|
46523
|
+
/**
|
|
46524
|
+
* Whether the set has been sealed.
|
|
46525
|
+
* @type {boolean}
|
|
46526
|
+
*/
|
|
46527
|
+
get isSealed() {
|
|
46528
|
+
return this._sealed;
|
|
46529
|
+
}
|
|
46530
|
+
/**
|
|
46531
|
+
* Test whether the matcher's current path matches any expression in the set.
|
|
46532
|
+
*
|
|
46533
|
+
* Evaluation order (cheapest → most expensive):
|
|
46534
|
+
* 1. Exact depth + tag bucket — O(1) lookup, typically 0–2 expressions
|
|
46535
|
+
* 2. Depth-only wildcard bucket — O(1) lookup, rare
|
|
46536
|
+
* 3. Deep-wildcard list — always checked, but usually small
|
|
46537
|
+
*
|
|
46538
|
+
* @param {import('./Matcher.js').default} matcher - Matcher instance (or readOnly view)
|
|
46539
|
+
* @returns {boolean} true if any expression matches the current path
|
|
46540
|
+
*
|
|
46541
|
+
* @example
|
|
46542
|
+
* if (stopNodes.matchesAny(matcher)) {
|
|
46543
|
+
* // handle stop node
|
|
46544
|
+
* }
|
|
46545
|
+
*/
|
|
46546
|
+
matchesAny(matcher) {
|
|
46547
|
+
return this.findMatch(matcher) !== null;
|
|
46548
|
+
}
|
|
46549
|
+
/**
|
|
46550
|
+
* Find and return the first Expression that matches the matcher's current path.
|
|
46551
|
+
*
|
|
46552
|
+
* Uses the same evaluation order as matchesAny (cheapest → most expensive):
|
|
46553
|
+
* 1. Exact depth + tag bucket
|
|
46554
|
+
* 2. Depth-only wildcard bucket
|
|
46555
|
+
* 3. Deep-wildcard list
|
|
46556
|
+
*
|
|
46557
|
+
* @param {import('./Matcher.js').default} matcher - Matcher instance (or readOnly view)
|
|
46558
|
+
* @returns {import('./Expression.js').default | null} the first matching Expression, or null
|
|
46559
|
+
*
|
|
46560
|
+
* @example
|
|
46561
|
+
* const expr = stopNodes.findMatch(matcher);
|
|
46562
|
+
* if (expr) {
|
|
46563
|
+
* // access expr.config, expr.pattern, etc.
|
|
46564
|
+
* }
|
|
46565
|
+
*/
|
|
46566
|
+
findMatch(matcher) {
|
|
46567
|
+
const depth = matcher.getDepth();
|
|
46568
|
+
const exactKey = `${depth}:${matcher.getCurrentTag()}`;
|
|
46569
|
+
const exactBucket = this._byDepthAndTag.get(exactKey);
|
|
46570
|
+
if (exactBucket) {
|
|
46571
|
+
for (let i = 0; i < exactBucket.length; i++) if (matcher.matches(exactBucket[i])) return exactBucket[i];
|
|
46572
|
+
}
|
|
46573
|
+
const wildcardBucket = this._wildcardByDepth.get(depth);
|
|
46574
|
+
if (wildcardBucket) {
|
|
46575
|
+
for (let i = 0; i < wildcardBucket.length; i++) if (matcher.matches(wildcardBucket[i])) return wildcardBucket[i];
|
|
46576
|
+
}
|
|
46577
|
+
for (let i = 0; i < this._deepWildcards.length; i++) if (matcher.matches(this._deepWildcards[i])) return this._deepWildcards[i];
|
|
46578
|
+
return null;
|
|
46579
|
+
}
|
|
46580
|
+
};
|
|
46581
|
+
//#endregion
|
|
46342
46582
|
//#region node_modules/path-expression-matcher/src/Matcher.js
|
|
46343
46583
|
/**
|
|
46344
46584
|
* Matcher - Tracks current path in XML/JSON tree and matches against Expressions
|
|
@@ -46378,6 +46618,9 @@ var Matcher = class {
|
|
|
46378
46618
|
this.separator = options.separator || ".";
|
|
46379
46619
|
this.path = [];
|
|
46380
46620
|
this.siblingStacks = [];
|
|
46621
|
+
this._pathStringCache = null;
|
|
46622
|
+
this._frozenPathCache = null;
|
|
46623
|
+
this._frozenSiblingsCache = null;
|
|
46381
46624
|
}
|
|
46382
46625
|
/**
|
|
46383
46626
|
* Push a new tag onto the path
|
|
@@ -46387,6 +46630,8 @@ var Matcher = class {
|
|
|
46387
46630
|
*/
|
|
46388
46631
|
push(tagName, attrValues = null, namespace = null) {
|
|
46389
46632
|
this._pathStringCache = null;
|
|
46633
|
+
this._frozenPathCache = null;
|
|
46634
|
+
this._frozenSiblingsCache = null;
|
|
46390
46635
|
if (this.path.length > 0) {
|
|
46391
46636
|
const prev = this.path[this.path.length - 1];
|
|
46392
46637
|
prev.values = void 0;
|
|
@@ -46413,8 +46658,10 @@ var Matcher = class {
|
|
|
46413
46658
|
* @returns {Object|undefined} The popped node
|
|
46414
46659
|
*/
|
|
46415
46660
|
pop() {
|
|
46416
|
-
if (this.path.length === 0) return;
|
|
46661
|
+
if (this.path.length === 0) return void 0;
|
|
46417
46662
|
this._pathStringCache = null;
|
|
46663
|
+
this._frozenPathCache = null;
|
|
46664
|
+
this._frozenSiblingsCache = null;
|
|
46418
46665
|
const node = this.path.pop();
|
|
46419
46666
|
if (this.siblingStacks.length > this.path.length + 1) this.siblingStacks.length = this.path.length + 1;
|
|
46420
46667
|
return node;
|
|
@@ -46427,7 +46674,10 @@ var Matcher = class {
|
|
|
46427
46674
|
updateCurrent(attrValues) {
|
|
46428
46675
|
if (this.path.length > 0) {
|
|
46429
46676
|
const current = this.path[this.path.length - 1];
|
|
46430
|
-
if (attrValues !== null && attrValues !== void 0)
|
|
46677
|
+
if (attrValues !== null && attrValues !== void 0) {
|
|
46678
|
+
current.values = attrValues;
|
|
46679
|
+
this._frozenPathCache = null;
|
|
46680
|
+
}
|
|
46431
46681
|
}
|
|
46432
46682
|
}
|
|
46433
46683
|
/**
|
|
@@ -46522,6 +46772,8 @@ var Matcher = class {
|
|
|
46522
46772
|
*/
|
|
46523
46773
|
reset() {
|
|
46524
46774
|
this._pathStringCache = null;
|
|
46775
|
+
this._frozenPathCache = null;
|
|
46776
|
+
this._frozenSiblingsCache = null;
|
|
46525
46777
|
this.path = [];
|
|
46526
46778
|
this.siblingStacks = [];
|
|
46527
46779
|
}
|
|
@@ -46617,6 +46869,14 @@ var Matcher = class {
|
|
|
46617
46869
|
return true;
|
|
46618
46870
|
}
|
|
46619
46871
|
/**
|
|
46872
|
+
* Match any expression in the given set against the current path.
|
|
46873
|
+
* @param {ExpressionSet} exprSet - The set of expressions to match against.
|
|
46874
|
+
* @returns {boolean} - True if any expression in the set matches the current path, false otherwise.
|
|
46875
|
+
*/
|
|
46876
|
+
matchesAny(exprSet) {
|
|
46877
|
+
return exprSet.matchesAny(this);
|
|
46878
|
+
}
|
|
46879
|
+
/**
|
|
46620
46880
|
* Create a snapshot of current state
|
|
46621
46881
|
* @returns {Object} State snapshot
|
|
46622
46882
|
*/
|
|
@@ -46632,6 +46892,8 @@ var Matcher = class {
|
|
|
46632
46892
|
*/
|
|
46633
46893
|
restore(snapshot) {
|
|
46634
46894
|
this._pathStringCache = null;
|
|
46895
|
+
this._frozenPathCache = null;
|
|
46896
|
+
this._frozenSiblingsCache = null;
|
|
46635
46897
|
this.path = snapshot.path.map((node) => ({ ...node }));
|
|
46636
46898
|
this.siblingStacks = snapshot.siblingStacks.map((map) => new Map(map));
|
|
46637
46899
|
}
|
|
@@ -46662,8 +46924,15 @@ var Matcher = class {
|
|
|
46662
46924
|
if (MUTATING_METHODS.has(prop)) return () => {
|
|
46663
46925
|
throw new TypeError(`Cannot call '${prop}' on a read-only Matcher. Obtain a writable instance to mutate state.`);
|
|
46664
46926
|
};
|
|
46927
|
+
if (prop === "path") {
|
|
46928
|
+
if (target._frozenPathCache === null) target._frozenPathCache = Object.freeze(target.path.map((node) => Object.freeze({ ...node })));
|
|
46929
|
+
return target._frozenPathCache;
|
|
46930
|
+
}
|
|
46931
|
+
if (prop === "siblingStacks") {
|
|
46932
|
+
if (target._frozenSiblingsCache === null) target._frozenSiblingsCache = Object.freeze(target.siblingStacks.map((map) => Object.freeze(new Map(map))));
|
|
46933
|
+
return target._frozenSiblingsCache;
|
|
46934
|
+
}
|
|
46665
46935
|
const value = Reflect.get(target, prop, receiver);
|
|
46666
|
-
if (prop === "path" || prop === "siblingStacks") return Object.freeze(Array.isArray(value) ? value.map((item) => item instanceof Map ? Object.freeze(new Map(item)) : Object.freeze({ ...item })) : value);
|
|
46667
46936
|
if (typeof value === "function") return value.bind(target);
|
|
46668
46937
|
return value;
|
|
46669
46938
|
},
|
|
@@ -46794,13 +47063,15 @@ var OrderedObjParser = class {
|
|
|
46794
47063
|
this.matcher = new Matcher();
|
|
46795
47064
|
this.readonlyMatcher = this.matcher.readOnly();
|
|
46796
47065
|
this.isCurrentNodeStopNode = false;
|
|
46797
|
-
|
|
46798
|
-
|
|
46799
|
-
|
|
46800
|
-
|
|
46801
|
-
|
|
46802
|
-
|
|
47066
|
+
this.stopNodeExpressionsSet = new ExpressionSet();
|
|
47067
|
+
const stopNodesOpts = this.options.stopNodes;
|
|
47068
|
+
if (stopNodesOpts && stopNodesOpts.length > 0) {
|
|
47069
|
+
for (let i = 0; i < stopNodesOpts.length; i++) {
|
|
47070
|
+
const stopNodeExp = stopNodesOpts[i];
|
|
47071
|
+
if (typeof stopNodeExp === "string") this.stopNodeExpressionsSet.add(new Expression(stopNodeExp));
|
|
47072
|
+
else if (stopNodeExp instanceof Expression) this.stopNodeExpressionsSet.add(stopNodeExp);
|
|
46803
47073
|
}
|
|
47074
|
+
this.stopNodeExpressionsSet.seal();
|
|
46804
47075
|
}
|
|
46805
47076
|
}
|
|
46806
47077
|
};
|
|
@@ -46825,16 +47096,17 @@ function addExternalEntities(externalEntities) {
|
|
|
46825
47096
|
* @param {boolean} escapeEntities
|
|
46826
47097
|
*/
|
|
46827
47098
|
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
47099
|
+
const options = this.options;
|
|
46828
47100
|
if (val !== void 0) {
|
|
46829
|
-
if (
|
|
47101
|
+
if (options.trimValues && !dontTrim) val = val.trim();
|
|
46830
47102
|
if (val.length > 0) {
|
|
46831
47103
|
if (!escapeEntities) val = this.replaceEntitiesValue(val, tagName, jPath);
|
|
46832
|
-
const jPathOrMatcher =
|
|
46833
|
-
const newval =
|
|
47104
|
+
const jPathOrMatcher = options.jPath ? jPath.toString() : jPath;
|
|
47105
|
+
const newval = options.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
|
|
46834
47106
|
if (newval === null || newval === void 0) return val;
|
|
46835
47107
|
else if (typeof newval !== typeof val || newval !== val) return newval;
|
|
46836
|
-
else if (
|
|
46837
|
-
else if (val.trim() === val) return parseValue(val,
|
|
47108
|
+
else if (options.trimValues) return parseValue(val, options.parseTagValue, options.numberParseOptions);
|
|
47109
|
+
else if (val.trim() === val) return parseValue(val, options.parseTagValue, options.numberParseOptions);
|
|
46838
47110
|
else return val;
|
|
46839
47111
|
}
|
|
46840
47112
|
}
|
|
@@ -46850,7 +47122,8 @@ function resolveNameSpace(tagname) {
|
|
|
46850
47122
|
}
|
|
46851
47123
|
var attrsRegx = /* @__PURE__ */ new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
|
|
46852
47124
|
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
46853
|
-
|
|
47125
|
+
const options = this.options;
|
|
47126
|
+
if (options.ignoreAttributes !== true && typeof attrStr === "string") {
|
|
46854
47127
|
const matches = getAllMatches(attrStr, attrsRegx);
|
|
46855
47128
|
const len = matches.length;
|
|
46856
47129
|
const attrs = {};
|
|
@@ -46862,7 +47135,7 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
46862
47135
|
const oldVal = matches[i][4];
|
|
46863
47136
|
if (attrName.length && oldVal !== void 0) {
|
|
46864
47137
|
let val = oldVal;
|
|
46865
|
-
if (
|
|
47138
|
+
if (options.trimValues) val = val.trim();
|
|
46866
47139
|
val = this.replaceEntitiesValue(val, tagName, this.readonlyMatcher);
|
|
46867
47140
|
processedVals[i] = val;
|
|
46868
47141
|
rawAttrsForMatcher[attrName] = val;
|
|
@@ -46870,32 +47143,32 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
46870
47143
|
}
|
|
46871
47144
|
}
|
|
46872
47145
|
if (hasRawAttrs && typeof jPath === "object" && jPath.updateCurrent) jPath.updateCurrent(rawAttrsForMatcher);
|
|
46873
|
-
const jPathStr =
|
|
47146
|
+
const jPathStr = options.jPath ? jPath.toString() : this.readonlyMatcher;
|
|
46874
47147
|
let hasAttrs = false;
|
|
46875
47148
|
for (let i = 0; i < len; i++) {
|
|
46876
47149
|
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
46877
47150
|
if (this.ignoreAttributesFn(attrName, jPathStr)) continue;
|
|
46878
|
-
let aName =
|
|
47151
|
+
let aName = options.attributeNamePrefix + attrName;
|
|
46879
47152
|
if (attrName.length) {
|
|
46880
|
-
if (
|
|
46881
|
-
aName = sanitizeName(aName,
|
|
47153
|
+
if (options.transformAttributeName) aName = options.transformAttributeName(aName);
|
|
47154
|
+
aName = sanitizeName(aName, options);
|
|
46882
47155
|
if (matches[i][4] !== void 0) {
|
|
46883
47156
|
const oldVal = processedVals[i];
|
|
46884
|
-
const newVal =
|
|
47157
|
+
const newVal = options.attributeValueProcessor(attrName, oldVal, jPathStr);
|
|
46885
47158
|
if (newVal === null || newVal === void 0) attrs[aName] = oldVal;
|
|
46886
47159
|
else if (typeof newVal !== typeof oldVal || newVal !== oldVal) attrs[aName] = newVal;
|
|
46887
|
-
else attrs[aName] = parseValue(oldVal,
|
|
47160
|
+
else attrs[aName] = parseValue(oldVal, options.parseAttributeValue, options.numberParseOptions);
|
|
46888
47161
|
hasAttrs = true;
|
|
46889
|
-
} else if (
|
|
47162
|
+
} else if (options.allowBooleanAttributes) {
|
|
46890
47163
|
attrs[aName] = true;
|
|
46891
47164
|
hasAttrs = true;
|
|
46892
47165
|
}
|
|
46893
47166
|
}
|
|
46894
47167
|
}
|
|
46895
47168
|
if (!hasAttrs) return;
|
|
46896
|
-
if (
|
|
47169
|
+
if (options.attributesGroupName) {
|
|
46897
47170
|
const attrCollection = {};
|
|
46898
|
-
attrCollection[
|
|
47171
|
+
attrCollection[options.attributesGroupName] = attrs;
|
|
46899
47172
|
return attrCollection;
|
|
46900
47173
|
}
|
|
46901
47174
|
return attrs;
|
|
@@ -46909,144 +47182,152 @@ var parseXml = function(xmlData) {
|
|
|
46909
47182
|
this.matcher.reset();
|
|
46910
47183
|
this.entityExpansionCount = 0;
|
|
46911
47184
|
this.currentExpandedLength = 0;
|
|
46912
|
-
|
|
46913
|
-
|
|
46914
|
-
|
|
46915
|
-
|
|
46916
|
-
|
|
46917
|
-
|
|
46918
|
-
|
|
46919
|
-
|
|
46920
|
-
|
|
46921
|
-
|
|
46922
|
-
|
|
46923
|
-
|
|
46924
|
-
|
|
46925
|
-
|
|
46926
|
-
|
|
46927
|
-
|
|
46928
|
-
|
|
46929
|
-
|
|
46930
|
-
|
|
46931
|
-
|
|
46932
|
-
|
|
46933
|
-
|
|
46934
|
-
|
|
46935
|
-
if (!tagData) throw new Error("Pi Tag is not closed.");
|
|
46936
|
-
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
46937
|
-
if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {} else {
|
|
46938
|
-
const childNode = new XmlNode(tagData.tagName);
|
|
46939
|
-
childNode.add(this.options.textNodeName, "");
|
|
46940
|
-
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) childNode[":@"] = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName);
|
|
46941
|
-
this.addChild(currentNode, childNode, this.readonlyMatcher, i);
|
|
46942
|
-
}
|
|
46943
|
-
i = tagData.closeIndex + 1;
|
|
46944
|
-
} else if (xmlData.substr(i + 1, 3) === "!--") {
|
|
46945
|
-
const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
|
|
46946
|
-
if (this.options.commentPropName) {
|
|
46947
|
-
const comment = xmlData.substring(i + 4, endIndex - 2);
|
|
46948
|
-
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
46949
|
-
currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
|
|
46950
|
-
}
|
|
46951
|
-
i = endIndex;
|
|
46952
|
-
} else if (xmlData.substr(i + 1, 2) === "!D") {
|
|
46953
|
-
const result = docTypeReader.readDocType(xmlData, i);
|
|
46954
|
-
this.docTypeEntities = result.entities;
|
|
46955
|
-
i = result.i;
|
|
46956
|
-
} else if (xmlData.substr(i + 1, 2) === "![") {
|
|
46957
|
-
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
46958
|
-
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
46959
|
-
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
46960
|
-
let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
|
|
46961
|
-
if (val == void 0) val = "";
|
|
46962
|
-
if (this.options.cdataPropName) currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
|
|
46963
|
-
else currentNode.add(this.options.textNodeName, val);
|
|
46964
|
-
i = closeIndex + 2;
|
|
46965
|
-
} else {
|
|
46966
|
-
let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
|
|
46967
|
-
if (!result) {
|
|
46968
|
-
const context = xmlData.substring(Math.max(0, i - 50), Math.min(xmlData.length, i + 50));
|
|
46969
|
-
throw new Error(`readTagExp returned undefined at position ${i}. Context: "${context}"`);
|
|
46970
|
-
}
|
|
46971
|
-
let tagName = result.tagName;
|
|
46972
|
-
const rawTagName = result.rawTagName;
|
|
46973
|
-
let tagExp = result.tagExp;
|
|
46974
|
-
let attrExpPresent = result.attrExpPresent;
|
|
46975
|
-
let closeIndex = result.closeIndex;
|
|
46976
|
-
({tagName, tagExp} = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
|
|
46977
|
-
if (this.options.strictReservedNames && (tagName === this.options.commentPropName || tagName === this.options.cdataPropName || tagName === this.options.textNodeName || tagName === this.options.attributesGroupName)) throw new Error(`Invalid tag name: ${tagName}`);
|
|
46978
|
-
if (currentNode && textData) {
|
|
46979
|
-
if (currentNode.tagname !== "!xml") textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher, false);
|
|
46980
|
-
}
|
|
46981
|
-
const lastTag = currentNode;
|
|
46982
|
-
if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
|
|
46983
|
-
currentNode = this.tagsNodeStack.pop();
|
|
46984
|
-
this.matcher.pop();
|
|
46985
|
-
}
|
|
46986
|
-
let isSelfClosing = false;
|
|
46987
|
-
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
46988
|
-
isSelfClosing = true;
|
|
46989
|
-
if (tagName[tagName.length - 1] === "/") {
|
|
46990
|
-
tagName = tagName.substr(0, tagName.length - 1);
|
|
46991
|
-
tagExp = tagName;
|
|
46992
|
-
} else tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
46993
|
-
attrExpPresent = tagName !== tagExp;
|
|
46994
|
-
}
|
|
46995
|
-
let prefixedAttrs = null;
|
|
46996
|
-
let namespace = void 0;
|
|
46997
|
-
namespace = extractNamespace(rawTagName);
|
|
46998
|
-
if (tagName !== xmlObj.tagname) this.matcher.push(tagName, {}, namespace);
|
|
46999
|
-
if (tagName !== tagExp && attrExpPresent) {
|
|
47000
|
-
prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
|
|
47001
|
-
if (prefixedAttrs) extractRawAttributes(prefixedAttrs, this.options);
|
|
47002
|
-
}
|
|
47003
|
-
if (tagName !== xmlObj.tagname) this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher);
|
|
47004
|
-
const startIndex = i;
|
|
47005
|
-
if (this.isCurrentNodeStopNode) {
|
|
47006
|
-
let tagContent = "";
|
|
47007
|
-
if (isSelfClosing) i = result.closeIndex;
|
|
47008
|
-
else if (this.options.unpairedTags.indexOf(tagName) !== -1) i = result.closeIndex;
|
|
47009
|
-
else {
|
|
47010
|
-
const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
47011
|
-
if (!result) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
47012
|
-
i = result.i;
|
|
47013
|
-
tagContent = result.tagContent;
|
|
47014
|
-
}
|
|
47015
|
-
const childNode = new XmlNode(tagName);
|
|
47016
|
-
if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
|
|
47017
|
-
childNode.add(this.options.textNodeName, tagContent);
|
|
47185
|
+
this.docTypeEntitiesKeys = [];
|
|
47186
|
+
this.lastEntitiesKeys = Object.keys(this.lastEntities);
|
|
47187
|
+
this.htmlEntitiesKeys = this.options.htmlEntities ? Object.keys(this.htmlEntities) : [];
|
|
47188
|
+
const options = this.options;
|
|
47189
|
+
const docTypeReader = new DocTypeReader(options.processEntities);
|
|
47190
|
+
const xmlLen = xmlData.length;
|
|
47191
|
+
for (let i = 0; i < xmlLen; i++) if (xmlData[i] === "<") {
|
|
47192
|
+
const c1 = xmlData.charCodeAt(i + 1);
|
|
47193
|
+
if (c1 === 47) {
|
|
47194
|
+
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
|
|
47195
|
+
let tagName = xmlData.substring(i + 2, closeIndex).trim();
|
|
47196
|
+
if (options.removeNSPrefix) {
|
|
47197
|
+
const colonIndex = tagName.indexOf(":");
|
|
47198
|
+
if (colonIndex !== -1) tagName = tagName.substr(colonIndex + 1);
|
|
47199
|
+
}
|
|
47200
|
+
tagName = transformTagName(options.transformTagName, tagName, "", options).tagName;
|
|
47201
|
+
if (currentNode) textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
47202
|
+
const lastTagName = this.matcher.getCurrentTag();
|
|
47203
|
+
if (tagName && options.unpairedTagsSet.has(tagName)) throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
|
|
47204
|
+
if (lastTagName && options.unpairedTagsSet.has(lastTagName)) {
|
|
47205
|
+
this.matcher.pop();
|
|
47206
|
+
this.tagsNodeStack.pop();
|
|
47207
|
+
}
|
|
47018
47208
|
this.matcher.pop();
|
|
47019
47209
|
this.isCurrentNodeStopNode = false;
|
|
47020
|
-
|
|
47210
|
+
currentNode = this.tagsNodeStack.pop();
|
|
47211
|
+
textData = "";
|
|
47212
|
+
i = closeIndex;
|
|
47213
|
+
} else if (c1 === 63) {
|
|
47214
|
+
let tagData = readTagExp(xmlData, i, false, "?>");
|
|
47215
|
+
if (!tagData) throw new Error("Pi Tag is not closed.");
|
|
47216
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
47217
|
+
if (options.ignoreDeclaration && tagData.tagName === "?xml" || options.ignorePiTags) {} else {
|
|
47218
|
+
const childNode = new XmlNode(tagData.tagName);
|
|
47219
|
+
childNode.add(options.textNodeName, "");
|
|
47220
|
+
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) childNode[":@"] = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName);
|
|
47221
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, i);
|
|
47222
|
+
}
|
|
47223
|
+
i = tagData.closeIndex + 1;
|
|
47224
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) {
|
|
47225
|
+
const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
|
|
47226
|
+
if (options.commentPropName) {
|
|
47227
|
+
const comment = xmlData.substring(i + 4, endIndex - 2);
|
|
47228
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
47229
|
+
currentNode.add(options.commentPropName, [{ [options.textNodeName]: comment }]);
|
|
47230
|
+
}
|
|
47231
|
+
i = endIndex;
|
|
47232
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 68) {
|
|
47233
|
+
const result = docTypeReader.readDocType(xmlData, i);
|
|
47234
|
+
this.docTypeEntities = result.entities;
|
|
47235
|
+
this.docTypeEntitiesKeys = Object.keys(this.docTypeEntities) || [];
|
|
47236
|
+
i = result.i;
|
|
47237
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 91) {
|
|
47238
|
+
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
47239
|
+
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
47240
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
47241
|
+
let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
|
|
47242
|
+
if (val == void 0) val = "";
|
|
47243
|
+
if (options.cdataPropName) currentNode.add(options.cdataPropName, [{ [options.textNodeName]: tagExp }]);
|
|
47244
|
+
else currentNode.add(options.textNodeName, val);
|
|
47245
|
+
i = closeIndex + 2;
|
|
47021
47246
|
} else {
|
|
47022
|
-
|
|
47023
|
-
|
|
47024
|
-
const
|
|
47025
|
-
|
|
47026
|
-
|
|
47247
|
+
let result = readTagExp(xmlData, i, options.removeNSPrefix);
|
|
47248
|
+
if (!result) {
|
|
47249
|
+
const context = xmlData.substring(Math.max(0, i - 50), Math.min(xmlLen, i + 50));
|
|
47250
|
+
throw new Error(`readTagExp returned undefined at position ${i}. Context: "${context}"`);
|
|
47251
|
+
}
|
|
47252
|
+
let tagName = result.tagName;
|
|
47253
|
+
const rawTagName = result.rawTagName;
|
|
47254
|
+
let tagExp = result.tagExp;
|
|
47255
|
+
let attrExpPresent = result.attrExpPresent;
|
|
47256
|
+
let closeIndex = result.closeIndex;
|
|
47257
|
+
({tagName, tagExp} = transformTagName(options.transformTagName, tagName, tagExp, options));
|
|
47258
|
+
if (options.strictReservedNames && (tagName === options.commentPropName || tagName === options.cdataPropName || tagName === options.textNodeName || tagName === options.attributesGroupName)) throw new Error(`Invalid tag name: ${tagName}`);
|
|
47259
|
+
if (currentNode && textData) {
|
|
47260
|
+
if (currentNode.tagname !== "!xml") textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher, false);
|
|
47261
|
+
}
|
|
47262
|
+
const lastTag = currentNode;
|
|
47263
|
+
if (lastTag && options.unpairedTagsSet.has(lastTag.tagname)) {
|
|
47264
|
+
currentNode = this.tagsNodeStack.pop();
|
|
47027
47265
|
this.matcher.pop();
|
|
47028
|
-
|
|
47029
|
-
|
|
47266
|
+
}
|
|
47267
|
+
let isSelfClosing = false;
|
|
47268
|
+
if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
47269
|
+
isSelfClosing = true;
|
|
47270
|
+
if (tagName[tagName.length - 1] === "/") {
|
|
47271
|
+
tagName = tagName.substr(0, tagName.length - 1);
|
|
47272
|
+
tagExp = tagName;
|
|
47273
|
+
} else tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
47274
|
+
attrExpPresent = tagName !== tagExp;
|
|
47275
|
+
}
|
|
47276
|
+
let prefixedAttrs = null;
|
|
47277
|
+
let namespace = void 0;
|
|
47278
|
+
namespace = extractNamespace(rawTagName);
|
|
47279
|
+
if (tagName !== xmlObj.tagname) this.matcher.push(tagName, {}, namespace);
|
|
47280
|
+
if (tagName !== tagExp && attrExpPresent) {
|
|
47281
|
+
prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
|
|
47282
|
+
if (prefixedAttrs) extractRawAttributes(prefixedAttrs, options);
|
|
47283
|
+
}
|
|
47284
|
+
if (tagName !== xmlObj.tagname) this.isCurrentNodeStopNode = this.isItStopNode();
|
|
47285
|
+
const startIndex = i;
|
|
47286
|
+
if (this.isCurrentNodeStopNode) {
|
|
47287
|
+
let tagContent = "";
|
|
47288
|
+
if (isSelfClosing) i = result.closeIndex;
|
|
47289
|
+
else if (options.unpairedTagsSet.has(tagName)) i = result.closeIndex;
|
|
47290
|
+
else {
|
|
47291
|
+
const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
47292
|
+
if (!result) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
47293
|
+
i = result.i;
|
|
47294
|
+
tagContent = result.tagContent;
|
|
47295
|
+
}
|
|
47030
47296
|
const childNode = new XmlNode(tagName);
|
|
47031
47297
|
if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
|
|
47032
|
-
|
|
47298
|
+
childNode.add(options.textNodeName, tagContent);
|
|
47033
47299
|
this.matcher.pop();
|
|
47034
47300
|
this.isCurrentNodeStopNode = false;
|
|
47035
|
-
i = result.closeIndex;
|
|
47036
|
-
continue;
|
|
47037
|
-
} else {
|
|
47038
|
-
const childNode = new XmlNode(tagName);
|
|
47039
|
-
if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
|
|
47040
|
-
this.tagsNodeStack.push(currentNode);
|
|
47041
|
-
if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
|
|
47042
47301
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
47043
|
-
|
|
47302
|
+
} else {
|
|
47303
|
+
if (isSelfClosing) {
|
|
47304
|
+
({tagName, tagExp} = transformTagName(options.transformTagName, tagName, tagExp, options));
|
|
47305
|
+
const childNode = new XmlNode(tagName);
|
|
47306
|
+
if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
|
|
47307
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
47308
|
+
this.matcher.pop();
|
|
47309
|
+
this.isCurrentNodeStopNode = false;
|
|
47310
|
+
} else if (options.unpairedTagsSet.has(tagName)) {
|
|
47311
|
+
const childNode = new XmlNode(tagName);
|
|
47312
|
+
if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
|
|
47313
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
47314
|
+
this.matcher.pop();
|
|
47315
|
+
this.isCurrentNodeStopNode = false;
|
|
47316
|
+
i = result.closeIndex;
|
|
47317
|
+
continue;
|
|
47318
|
+
} else {
|
|
47319
|
+
const childNode = new XmlNode(tagName);
|
|
47320
|
+
if (this.tagsNodeStack.length > options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
|
|
47321
|
+
this.tagsNodeStack.push(currentNode);
|
|
47322
|
+
if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
|
|
47323
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
47324
|
+
currentNode = childNode;
|
|
47325
|
+
}
|
|
47326
|
+
textData = "";
|
|
47327
|
+
i = closeIndex;
|
|
47044
47328
|
}
|
|
47045
|
-
textData = "";
|
|
47046
|
-
i = closeIndex;
|
|
47047
47329
|
}
|
|
47048
|
-
}
|
|
47049
|
-
else textData += xmlData[i];
|
|
47330
|
+
} else textData += xmlData[i];
|
|
47050
47331
|
return xmlObj.child;
|
|
47051
47332
|
};
|
|
47052
47333
|
function addChild(currentNode, childNode, matcher, startIndex) {
|
|
@@ -47074,7 +47355,7 @@ function replaceEntitiesValue(val, tagName, jPath) {
|
|
|
47074
47355
|
const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
|
|
47075
47356
|
if (!entityConfig.tagFilter(tagName, jPathOrMatcher)) return val;
|
|
47076
47357
|
}
|
|
47077
|
-
for (const entityName of
|
|
47358
|
+
for (const entityName of this.docTypeEntitiesKeys) {
|
|
47078
47359
|
const entity = this.docTypeEntities[entityName];
|
|
47079
47360
|
const matches = val.match(entity.regx);
|
|
47080
47361
|
if (matches) {
|
|
@@ -47089,7 +47370,7 @@ function replaceEntitiesValue(val, tagName, jPath) {
|
|
|
47089
47370
|
}
|
|
47090
47371
|
}
|
|
47091
47372
|
if (val.indexOf("&") === -1) return val;
|
|
47092
|
-
for (const entityName of
|
|
47373
|
+
for (const entityName of this.lastEntitiesKeys) {
|
|
47093
47374
|
const entity = this.lastEntities[entityName];
|
|
47094
47375
|
const matches = val.match(entity.regex);
|
|
47095
47376
|
if (matches) {
|
|
@@ -47099,7 +47380,7 @@ function replaceEntitiesValue(val, tagName, jPath) {
|
|
|
47099
47380
|
val = val.replace(entity.regex, entity.val);
|
|
47100
47381
|
}
|
|
47101
47382
|
if (val.indexOf("&") === -1) return val;
|
|
47102
|
-
|
|
47383
|
+
for (const entityName of this.htmlEntitiesKeys) {
|
|
47103
47384
|
const entity = this.htmlEntities[entityName];
|
|
47104
47385
|
const matches = val.match(entity.regex);
|
|
47105
47386
|
if (matches) {
|
|
@@ -47124,10 +47405,9 @@ function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
|
|
|
47124
47405
|
* @param {Array<Expression>} stopNodeExpressions - Array of compiled Expression objects
|
|
47125
47406
|
* @param {Matcher} matcher - Current path matcher
|
|
47126
47407
|
*/
|
|
47127
|
-
function isItStopNode(
|
|
47128
|
-
if (
|
|
47129
|
-
|
|
47130
|
-
return false;
|
|
47408
|
+
function isItStopNode() {
|
|
47409
|
+
if (this.stopNodeExpressionsSet.size === 0) return false;
|
|
47410
|
+
return this.matcher.matchesAny(this.stopNodeExpressionsSet);
|
|
47131
47411
|
}
|
|
47132
47412
|
/**
|
|
47133
47413
|
* Returns the tag Expression and where it is ending handling single-double quotes situation
|
|
@@ -47136,24 +47416,30 @@ function isItStopNode(stopNodeExpressions, matcher) {
|
|
|
47136
47416
|
* @returns
|
|
47137
47417
|
*/
|
|
47138
47418
|
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
47139
|
-
let attrBoundary;
|
|
47140
|
-
|
|
47141
|
-
|
|
47142
|
-
|
|
47419
|
+
let attrBoundary = 0;
|
|
47420
|
+
const chars = [];
|
|
47421
|
+
const len = xmlData.length;
|
|
47422
|
+
const closeCode0 = closingChar.charCodeAt(0);
|
|
47423
|
+
const closeCode1 = closingChar.length > 1 ? closingChar.charCodeAt(1) : -1;
|
|
47424
|
+
for (let index = i; index < len; index++) {
|
|
47425
|
+
const code = xmlData.charCodeAt(index);
|
|
47143
47426
|
if (attrBoundary) {
|
|
47144
|
-
if (
|
|
47145
|
-
} else if (
|
|
47146
|
-
else if (
|
|
47147
|
-
if (xmlData
|
|
47148
|
-
data:
|
|
47427
|
+
if (code === attrBoundary) attrBoundary = 0;
|
|
47428
|
+
} else if (code === 34 || code === 39) attrBoundary = code;
|
|
47429
|
+
else if (code === closeCode0) if (closeCode1 !== -1) {
|
|
47430
|
+
if (xmlData.charCodeAt(index + 1) === closeCode1) return {
|
|
47431
|
+
data: String.fromCharCode(...chars),
|
|
47149
47432
|
index
|
|
47150
47433
|
};
|
|
47151
47434
|
} else return {
|
|
47152
|
-
data:
|
|
47435
|
+
data: String.fromCharCode(...chars),
|
|
47153
47436
|
index
|
|
47154
47437
|
};
|
|
47155
|
-
else if (
|
|
47156
|
-
|
|
47438
|
+
else if (code === 9) {
|
|
47439
|
+
chars.push(32);
|
|
47440
|
+
continue;
|
|
47441
|
+
}
|
|
47442
|
+
chars.push(code);
|
|
47157
47443
|
}
|
|
47158
47444
|
}
|
|
47159
47445
|
function findClosingIndex(xmlData, str, i, errMsg) {
|
|
@@ -47161,6 +47447,11 @@ function findClosingIndex(xmlData, str, i, errMsg) {
|
|
|
47161
47447
|
if (closingIndex === -1) throw new Error(errMsg);
|
|
47162
47448
|
else return closingIndex + str.length - 1;
|
|
47163
47449
|
}
|
|
47450
|
+
function findClosingChar(xmlData, char, i, errMsg) {
|
|
47451
|
+
const closingIndex = xmlData.indexOf(char, i);
|
|
47452
|
+
if (closingIndex === -1) throw new Error(errMsg);
|
|
47453
|
+
return closingIndex;
|
|
47454
|
+
}
|
|
47164
47455
|
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
47165
47456
|
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
47166
47457
|
if (!result) return;
|
|
@@ -47198,24 +47489,28 @@ function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
|
47198
47489
|
function readStopNodeData(xmlData, tagName, i) {
|
|
47199
47490
|
const startIndex = i;
|
|
47200
47491
|
let openTagCount = 1;
|
|
47201
|
-
|
|
47202
|
-
|
|
47203
|
-
|
|
47204
|
-
|
|
47205
|
-
|
|
47206
|
-
|
|
47207
|
-
|
|
47208
|
-
|
|
47209
|
-
|
|
47210
|
-
|
|
47211
|
-
|
|
47212
|
-
|
|
47213
|
-
|
|
47214
|
-
|
|
47215
|
-
|
|
47216
|
-
if (
|
|
47217
|
-
|
|
47218
|
-
|
|
47492
|
+
const xmllen = xmlData.length;
|
|
47493
|
+
for (; i < xmllen; i++) if (xmlData[i] === "<") {
|
|
47494
|
+
const c1 = xmlData.charCodeAt(i + 1);
|
|
47495
|
+
if (c1 === 47) {
|
|
47496
|
+
const closeIndex = findClosingChar(xmlData, ">", i, `${tagName} is not closed`);
|
|
47497
|
+
if (xmlData.substring(i + 2, closeIndex).trim() === tagName) {
|
|
47498
|
+
openTagCount--;
|
|
47499
|
+
if (openTagCount === 0) return {
|
|
47500
|
+
tagContent: xmlData.substring(startIndex, i),
|
|
47501
|
+
i: closeIndex
|
|
47502
|
+
};
|
|
47503
|
+
}
|
|
47504
|
+
i = closeIndex;
|
|
47505
|
+
} else if (c1 === 63) i = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed.");
|
|
47506
|
+
else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) i = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.");
|
|
47507
|
+
else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 91) i = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
|
47508
|
+
else {
|
|
47509
|
+
const tagData = readTagExp(xmlData, i, ">");
|
|
47510
|
+
if (tagData) {
|
|
47511
|
+
if ((tagData && tagData.tagName) === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") openTagCount++;
|
|
47512
|
+
i = tagData.closeIndex;
|
|
47513
|
+
}
|
|
47219
47514
|
}
|
|
47220
47515
|
}
|
|
47221
47516
|
}
|
|
@@ -53260,7 +53555,7 @@ var NTQQMsgApi = class extends Service2 {
|
|
|
53260
53555
|
filterSendersUid,
|
|
53261
53556
|
filterMsgToTime: filterMsgTime,
|
|
53262
53557
|
filterMsgFromTime: filterMsgTime,
|
|
53263
|
-
isReverseOrder:
|
|
53558
|
+
isReverseOrder: true,
|
|
53264
53559
|
isIncludeCurrent: true,
|
|
53265
53560
|
pageLimit: 1
|
|
53266
53561
|
}
|
|
@@ -53800,7 +54095,7 @@ var NTQQWebApi = class extends Service2 {
|
|
|
53800
54095
|
const iBatchID = Math.floor(Date.now() / 1e3);
|
|
53801
54096
|
for (let i = 0; i < filePathList.length; i++) {
|
|
53802
54097
|
const filePath = filePathList[i];
|
|
53803
|
-
const fileBuffer = await
|
|
54098
|
+
const fileBuffer = await fs.readFile(filePath);
|
|
53804
54099
|
const fileSize = fileBuffer.length;
|
|
53805
54100
|
const checksum = await getMd5HexFromFile(filePath);
|
|
53806
54101
|
const getSessionUrl = `https://${domain}/webapp/json/sliceUpload/FileBatchControl/${checksum}?g_tk=${gtk}`;
|
|
@@ -54086,7 +54381,7 @@ async function authMiddleware(c, next) {
|
|
|
54086
54381
|
const clientIp = c.env.incoming.socket.remoteAddress;
|
|
54087
54382
|
const token = webuiTokenUtil.getToken();
|
|
54088
54383
|
if (!token) {
|
|
54089
|
-
if (c.req.path === "/set-token") return await next();
|
|
54384
|
+
if (c.req.path === "/api/set-token") return await next();
|
|
54090
54385
|
logAccess(clientIp, c.req.method, c.req.path, 401, "未设置密码");
|
|
54091
54386
|
return c.json({
|
|
54092
54387
|
success: false,
|
|
@@ -54142,7 +54437,7 @@ async function authMiddleware(c, next) {
|
|
|
54142
54437
|
globalLoginAttempt.lockedUntil = null;
|
|
54143
54438
|
}
|
|
54144
54439
|
logAccess(clientIp, c.req.method, c.req.path, 200);
|
|
54145
|
-
next();
|
|
54440
|
+
await next();
|
|
54146
54441
|
}
|
|
54147
54442
|
//#endregion
|
|
54148
54443
|
//#region src/webui/BE/utils.ts
|
|
@@ -54761,7 +55056,6 @@ function createProxyRoutes(ctx) {
|
|
|
54761
55056
|
success: false,
|
|
54762
55057
|
message: "文件不存在"
|
|
54763
55058
|
}, 404);
|
|
54764
|
-
const ext = path$1.extname(normalizedPath).toLowerCase();
|
|
54765
55059
|
const contentType = {
|
|
54766
55060
|
".jpg": "image/jpeg",
|
|
54767
55061
|
".jpeg": "image/jpeg",
|
|
@@ -54770,7 +55064,7 @@ function createProxyRoutes(ctx) {
|
|
|
54770
55064
|
".webp": "image/webp",
|
|
54771
55065
|
".mp4": "video/mp4",
|
|
54772
55066
|
".webm": "video/webm"
|
|
54773
|
-
}[
|
|
55067
|
+
}[path$1.extname(normalizedPath).toLowerCase()] || "application/octet-stream";
|
|
54774
55068
|
c.header("Content-Type", contentType);
|
|
54775
55069
|
c.header("Cache-Control", "public, max-age=86400");
|
|
54776
55070
|
return c.body(await readFile(normalizedPath));
|
|
@@ -55482,7 +55776,7 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
55482
55776
|
if (optionPath) filename = optionPath;
|
|
55483
55777
|
else try {
|
|
55484
55778
|
filename = tryDecodeURI(c.req.path);
|
|
55485
|
-
if (/(?:^|[\/\\])
|
|
55779
|
+
if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}/.test(filename)) throw new Error();
|
|
55486
55780
|
} catch {
|
|
55487
55781
|
await options.onNotFound?.(c.req.path, c);
|
|
55488
55782
|
return next();
|
|
@@ -55585,7 +55879,7 @@ var WebUIServer = class extends Service2 {
|
|
|
55585
55879
|
});
|
|
55586
55880
|
}
|
|
55587
55881
|
initServer() {
|
|
55588
|
-
this.app.use("/api", authMiddleware);
|
|
55882
|
+
this.app.use("/api/*", authMiddleware);
|
|
55589
55883
|
this.app.route("/api", createConfigRoutes(this.ctx));
|
|
55590
55884
|
this.app.route("/api", createLoginRoutes(this.ctx));
|
|
55591
55885
|
this.app.route("/api", createDashboardRoutes(this.ctx));
|
|
@@ -56026,7 +56320,7 @@ var package_exports = /* @__PURE__ */ __exportAll({
|
|
|
56026
56320
|
var name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, engines, package_default;
|
|
56027
56321
|
var init_package = __esmMin((() => {
|
|
56028
56322
|
name = "nodemailer";
|
|
56029
|
-
version = "8.0.
|
|
56323
|
+
version = "8.0.5";
|
|
56030
56324
|
description = "Easy as cake e-mail sending from your Node.js applications";
|
|
56031
56325
|
main = "lib/nodemailer.js";
|
|
56032
56326
|
scripts = {
|
|
@@ -56049,10 +56343,10 @@ var init_package = __esmMin((() => {
|
|
|
56049
56343
|
bugs = { "url": "https://github.com/nodemailer/nodemailer/issues" };
|
|
56050
56344
|
homepage = "https://nodemailer.com/";
|
|
56051
56345
|
devDependencies = {
|
|
56052
|
-
"@aws-sdk/client-sesv2": "3.
|
|
56346
|
+
"@aws-sdk/client-sesv2": "3.1025.0",
|
|
56053
56347
|
"bunyan": "1.8.15",
|
|
56054
56348
|
"c8": "11.0.0",
|
|
56055
|
-
"eslint": "10.0
|
|
56349
|
+
"eslint": "10.2.0",
|
|
56056
56350
|
"eslint-config-prettier": "10.1.8",
|
|
56057
56351
|
"globals": "17.4.0",
|
|
56058
56352
|
"libbase64": "1.3.0",
|
|
@@ -56062,7 +56356,7 @@ var init_package = __esmMin((() => {
|
|
|
56062
56356
|
"prettier": "3.8.1",
|
|
56063
56357
|
"proxy": "1.0.2",
|
|
56064
56358
|
"proxy-test-server": "1.0.0",
|
|
56065
|
-
"smtp-server": "3.18.
|
|
56359
|
+
"smtp-server": "3.18.3"
|
|
56066
56360
|
};
|
|
56067
56361
|
engines = { "node": ">=6.0.0" };
|
|
56068
56362
|
package_default = {
|
|
@@ -56326,7 +56620,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
56326
56620
|
var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
56327
56621
|
var urllib$2 = __require("url");
|
|
56328
56622
|
var util$1 = __require("util");
|
|
56329
|
-
var fs$
|
|
56623
|
+
var fs$5 = __require("fs");
|
|
56330
56624
|
var nmfetch = require_fetch();
|
|
56331
56625
|
var dns$1 = __require("dns");
|
|
56332
56626
|
var net$4 = __require("net");
|
|
@@ -56662,7 +56956,7 @@ var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
56662
56956
|
const parsedDataUri = module.exports.parseDataURI(content.path || content.href);
|
|
56663
56957
|
if (!parsedDataUri || !parsedDataUri.data) return callback(null, Buffer.from(0));
|
|
56664
56958
|
return callback(null, parsedDataUri.data);
|
|
56665
|
-
} else if (content.path) return resolveStream(fs$
|
|
56959
|
+
} else if (content.path) return resolveStream(fs$5.createReadStream(content.path), callback);
|
|
56666
56960
|
}
|
|
56667
56961
|
if (typeof data[key].content === "string" && ![
|
|
56668
56962
|
"utf8",
|
|
@@ -60488,7 +60782,7 @@ var require_le_unix = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
60488
60782
|
//#region node_modules/nodemailer/lib/mime-node/index.js
|
|
60489
60783
|
var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
60490
60784
|
var crypto$9 = __require("crypto");
|
|
60491
|
-
var fs$
|
|
60785
|
+
var fs$4 = __require("fs");
|
|
60492
60786
|
var punycode = require_punycode();
|
|
60493
60787
|
var { PassThrough: PassThrough$2 } = __require("stream");
|
|
60494
60788
|
var shared = require_shared();
|
|
@@ -61197,7 +61491,7 @@ var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61197
61491
|
});
|
|
61198
61492
|
return contentStream;
|
|
61199
61493
|
}
|
|
61200
|
-
return fs$
|
|
61494
|
+
return fs$4.createReadStream(content.path);
|
|
61201
61495
|
}
|
|
61202
61496
|
if (content && typeof content.href === "string") {
|
|
61203
61497
|
if (this.disableUrlAccess) {
|
|
@@ -62035,7 +62329,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62035
62329
|
var RelaxedBody = require_relaxed_body();
|
|
62036
62330
|
var sign = require_sign();
|
|
62037
62331
|
var { PassThrough: PassThrough$1 } = __require("stream");
|
|
62038
|
-
var fs$
|
|
62332
|
+
var fs$3 = __require("fs");
|
|
62039
62333
|
var path$2 = __require("path");
|
|
62040
62334
|
var crypto$6 = __require("crypto");
|
|
62041
62335
|
var DKIM_ALGO = "sha256";
|
|
@@ -62068,10 +62362,10 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62068
62362
|
}
|
|
62069
62363
|
cleanup() {
|
|
62070
62364
|
if (!this.cache || !this.cachePath) return;
|
|
62071
|
-
fs$
|
|
62365
|
+
fs$3.unlink(this.cachePath, () => false);
|
|
62072
62366
|
}
|
|
62073
62367
|
createReadCache() {
|
|
62074
|
-
this.cache = fs$
|
|
62368
|
+
this.cache = fs$3.createReadStream(this.cachePath);
|
|
62075
62369
|
this.cache.once("error", (err) => {
|
|
62076
62370
|
this.cleanup();
|
|
62077
62371
|
this.output.emit("error", err);
|
|
@@ -62117,7 +62411,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62117
62411
|
}
|
|
62118
62412
|
createWriteCache() {
|
|
62119
62413
|
this.output.usingCache = true;
|
|
62120
|
-
this.cache = fs$
|
|
62414
|
+
this.cache = fs$3.createWriteStream(this.cachePath);
|
|
62121
62415
|
this.cache.once("error", (err) => {
|
|
62122
62416
|
this.cleanup();
|
|
62123
62417
|
this.relaxedBody.unpipe(this.cache);
|
|
@@ -62877,6 +63171,22 @@ var require_smtp_connection = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
62877
63171
|
var DNS_TIMEOUT = 30 * 1e3;
|
|
62878
63172
|
var TEARDOWN_NOOP = () => {};
|
|
62879
63173
|
/**
|
|
63174
|
+
* Re-interpret a server response stored in fake 8-bit byte-container form
|
|
63175
|
+
* (the result of chunk.toString('binary') in _onData) as UTF-8.
|
|
63176
|
+
*
|
|
63177
|
+
* Server reply text has no formally defined charset (RFC 5321 §4.2.1), but
|
|
63178
|
+
* modern MTAs commonly use UTF-8. The byte-container plumbing in _onData is
|
|
63179
|
+
* required to reassemble multi-byte sequences split across socket chunks;
|
|
63180
|
+
* this helper performs the actual decode at the line boundary, falling back
|
|
63181
|
+
* to the byte-container form when the bytes are not valid UTF-8 so that
|
|
63182
|
+
* legacy 8-bit replies are still recoverable byte-for-byte.
|
|
63183
|
+
*/
|
|
63184
|
+
function decodeServerResponse(str) {
|
|
63185
|
+
if (!str) return str;
|
|
63186
|
+
const utf8 = Buffer.from(str, "binary").toString("utf8");
|
|
63187
|
+
return utf8.includes("�") ? str : utf8;
|
|
63188
|
+
}
|
|
63189
|
+
/**
|
|
62880
63190
|
* Generates a SMTP connection object
|
|
62881
63191
|
*
|
|
62882
63192
|
* Optional options object takes the following possible properties:
|
|
@@ -62916,7 +63226,7 @@ var require_smtp_connection = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
62916
63226
|
this.servername = this.options.servername ? this.options.servername : !net$1.isIP(this.host) ? this.host : false;
|
|
62917
63227
|
this.allowInternalNetworkInterfaces = this.options.allowInternalNetworkInterfaces || false;
|
|
62918
63228
|
if (typeof this.options.secure === "undefined" && this.port === 465) this.secureConnection = true;
|
|
62919
|
-
this.name = this.options.name || this._getHostname();
|
|
63229
|
+
this.name = (this.options.name || this._getHostname()).toString().replace(/[\r\n]+/g, "");
|
|
62920
63230
|
this.logger = shared.getLogger(this.options, {
|
|
62921
63231
|
component: this.options.component || "smtp-connection",
|
|
62922
63232
|
sid: this.id
|
|
@@ -63468,8 +63778,8 @@ var require_smtp_connection = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
63468
63778
|
_onClose() {
|
|
63469
63779
|
let serverResponse = false;
|
|
63470
63780
|
if (this._remainder && this._remainder.trim()) {
|
|
63471
|
-
|
|
63472
|
-
this.
|
|
63781
|
+
this.lastServerResponse = serverResponse = decodeServerResponse(this._remainder.trim());
|
|
63782
|
+
if (this.options.debug || this.options.transactionLog) this.logger.debug({ tnx: "server" }, serverResponse);
|
|
63473
63783
|
}
|
|
63474
63784
|
this.logger.info({ tnx: "network" }, "Connection closed");
|
|
63475
63785
|
if (this.upgrading && !this._destroyed) return this._onError(/* @__PURE__ */ new Error("Connection closed unexpectedly"), "ETLS", serverResponse, "CONN");
|
|
@@ -63544,7 +63854,7 @@ var require_smtp_connection = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
63544
63854
|
*/
|
|
63545
63855
|
_processResponse() {
|
|
63546
63856
|
if (!this._responseQueue.length) return false;
|
|
63547
|
-
let str = this.lastServerResponse = (this._responseQueue.shift() || "").toString();
|
|
63857
|
+
let str = this.lastServerResponse = decodeServerResponse((this._responseQueue.shift() || "").toString());
|
|
63548
63858
|
if (/^\d+-/.test(str.split("\n").pop())) return;
|
|
63549
63859
|
if (this.options.debug || this.options.transactionLog) this.logger.debug({ tnx: "server" }, str.replace(/\r?\n$/, ""));
|
|
63550
63860
|
if (!str.trim()) setImmediate(() => this._processResponse());
|