node-karin 1.11.3 → 1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.11.4](https://github.com/KarinJS/Karin/compare/core-v1.11.3...core-v1.11.4) (2025-10-08)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * use ID generator API for unique incremental IDs in input adapter ([#549](https://github.com/KarinJS/Karin/issues/549)) ([a373a71](https://github.com/KarinJS/Karin/commit/a373a711899682aa84ed417d1564ab6321d69396))
9
+
3
10
  ## [1.11.3](https://github.com/KarinJS/Karin/compare/core-v1.11.2...core-v1.11.3) (2025-10-07)
4
11
 
5
12
 
package/dist/index.d.ts CHANGED
@@ -9513,6 +9513,22 @@ declare const isNumber: (num: unknown, defaultValue?: number) => number;
9513
9513
  * isNumberInArray(['1', '2', '3'], 0) // 返回 0
9514
9514
  */
9515
9515
  declare const isNumberInArray: <T = number>(arr: unknown[], defaultValue?: number) => T;
9516
+ /**
9517
+ * 创建一个自增ID生成器
9518
+ * @description 返回一个函数,每次调用时返回一个递增的唯一ID
9519
+ * @param start 起始值,默认为 0
9520
+ * @returns 返回一个函数,调用时返回下一个ID
9521
+ * @example
9522
+ * const getId = createIdGenerator()
9523
+ * getId() // 返回 1
9524
+ * getId() // 返回 2
9525
+ * getId() // 返回 3
9526
+ *
9527
+ * const getIdFrom100 = createIdGenerator(100)
9528
+ * getIdFrom100() // 返回 101
9529
+ * getIdFrom100() // 返回 102
9530
+ */
9531
+ declare const createIdGenerator: (start?: number) => () => number;
9516
9532
 
9517
9533
  /**
9518
9534
  * 字符串工具
@@ -9716,6 +9732,7 @@ declare const index$1_axios: typeof axios;
9716
9732
  declare const index$1_base64: typeof base64;
9717
9733
  declare const index$1_buffer: typeof buffer;
9718
9734
  declare const index$1_clamp: typeof clamp;
9735
+ declare const index$1_createIdGenerator: typeof createIdGenerator;
9719
9736
  declare const index$1_createRawMessage: typeof createRawMessage;
9720
9737
  declare const index$1_diffArray: typeof diffArray;
9721
9738
  declare const index$1_diffSimpleArray: typeof diffSimpleArray;
@@ -9748,7 +9765,7 @@ declare const index$1_updateYaml: typeof updateYaml;
9748
9765
  declare const index$1_uptime: typeof uptime;
9749
9766
  declare const index$1_urlToPath: typeof urlToPath;
9750
9767
  declare namespace index$1 {
9751
- export { type index$1_AxiosFn as AxiosFn, type index$1_NpmInfo as NpmInfo, index$1_absPath as absPath, index$1_average as average, index$1_axios as axios, index$1_base64 as base64, index$1_buffer as buffer, karinToQQBot as buttonToQQBot, index$1_clamp as clamp, index$1_createRawMessage as createRawMessage, index$1_diffArray as diffArray, index$1_diffSimpleArray as diffSimpleArray, index$1_downFile as downFile, existToMkdir as exists, index$1_formatNumber as formatNumber, index$1_formatTime as formatTime, index$1_formatUnit as formatUnit, index$1_getAbsPath as getAbsPath, index$1_getGitPlugins as getGitPlugins, index$1_getNpmPlugins as getNpmPlugins, getPlugins$1 as getPlugins, index$1_getRelPath as getRelPath, index$1_isDir as isDir, index$1_isEven as isEven, index$1_isNumber as isNumber, index$1_isNumberInArray as isNumberInArray, index$1_isPlugin as isPlugin, index$1_karinToQQBot as karinToQQBot, index$1_makeForward as makeForward, index$1_makeMessage as makeMessage, createRawMessage as makeMessageLog, index$1_mergeImage as mergeImage, mkdirSync as mkdir, index$1_percentage as percentage, getPluginInfo as pkgJson, pkgRoot as pkgroot, index$1_qqbotToKarin as qqbotToKarin, index$1_random as random, readJsonSync as readJson, read as readYaml, index$1_round as round, index$1_sleep as sleep, index$1_splitPath as splitPath, index$1_strToBool as strToBool, index$1_stream as stream, index$1_updateYaml as updateYaml, index$1_uptime as uptime, index$1_urlToPath as urlToPath, writeJsonSync as writeJson, write as writeYaml };
9768
+ export { type index$1_AxiosFn as AxiosFn, type index$1_NpmInfo as NpmInfo, index$1_absPath as absPath, index$1_average as average, index$1_axios as axios, index$1_base64 as base64, index$1_buffer as buffer, karinToQQBot as buttonToQQBot, index$1_clamp as clamp, index$1_createIdGenerator as createIdGenerator, index$1_createRawMessage as createRawMessage, index$1_diffArray as diffArray, index$1_diffSimpleArray as diffSimpleArray, index$1_downFile as downFile, existToMkdir as exists, index$1_formatNumber as formatNumber, index$1_formatTime as formatTime, index$1_formatUnit as formatUnit, index$1_getAbsPath as getAbsPath, index$1_getGitPlugins as getGitPlugins, index$1_getNpmPlugins as getNpmPlugins, getPlugins$1 as getPlugins, index$1_getRelPath as getRelPath, index$1_isDir as isDir, index$1_isEven as isEven, index$1_isNumber as isNumber, index$1_isNumberInArray as isNumberInArray, index$1_isPlugin as isPlugin, index$1_karinToQQBot as karinToQQBot, index$1_makeForward as makeForward, index$1_makeMessage as makeMessage, createRawMessage as makeMessageLog, index$1_mergeImage as mergeImage, mkdirSync as mkdir, index$1_percentage as percentage, getPluginInfo as pkgJson, pkgRoot as pkgroot, index$1_qqbotToKarin as qqbotToKarin, index$1_random as random, readJsonSync as readJson, read as readYaml, index$1_round as round, index$1_sleep as sleep, index$1_splitPath as splitPath, index$1_strToBool as strToBool, index$1_stream as stream, index$1_updateYaml as updateYaml, index$1_uptime as uptime, index$1_urlToPath as urlToPath, writeJsonSync as writeJson, write as writeYaml };
9752
9769
  }
9753
9770
 
9754
9771
  /**
package/dist/index.mjs CHANGED
@@ -1637,12 +1637,12 @@ var init_yaml = __esm({
1637
1637
  logger.error("[YamlEditor] \u6307\u5B9A\u7684\u8DEF\u5F84\u4E0D\u662F\u6570\u7EC4");
1638
1638
  return false;
1639
1639
  }
1640
- const index6 = current.items.findIndex((item) => lodash3.isEqual(item.toJSON(), value));
1641
- if (index6 < 0) {
1640
+ const index5 = current.items.findIndex((item) => lodash3.isEqual(item.toJSON(), value));
1641
+ if (index5 < 0) {
1642
1642
  logger.error("[YamlEditor] \u672A\u627E\u5230\u8981\u5220\u9664\u7684\u503C");
1643
1643
  return false;
1644
1644
  }
1645
- current.items.splice(index6, 1);
1645
+ current.items.splice(index5, 1);
1646
1646
  logger.debug(`[YamlEditor] \u5DF2\u4ECE ${path36} \u6570\u7EC4\u5220\u9664\u5143\u7D20\uFF1A${value}`);
1647
1647
  return true;
1648
1648
  } catch (error) {
@@ -1718,16 +1718,16 @@ var init_yaml = __esm({
1718
1718
  * 根据索引从根节点数组删除元素
1719
1719
  * @param index - 要删除元素的索引
1720
1720
  */
1721
- delarr(index6) {
1721
+ delarr(index5) {
1722
1722
  try {
1723
1723
  if (!(this.document.contents instanceof YAML.YAMLSeq)) {
1724
1724
  throw new Error("[YamlEditor] \u6839\u8282\u70B9\u4E0D\u662F\u6570\u7EC4");
1725
1725
  }
1726
- if (index6 < 0 || index6 >= this.document.contents.items.length) {
1726
+ if (index5 < 0 || index5 >= this.document.contents.items.length) {
1727
1727
  throw new Error("[YamlEditor] \u7D22\u5F15\u8D85\u51FA\u8303\u56F4");
1728
1728
  }
1729
- this.document.contents.items.splice(index6, 1);
1730
- logger.debug("[YamlEditor] \u5DF2\u6839\u636E\u7D22\u5F15\u4ECE\u6839\u8282\u70B9\u6570\u7EC4\u5220\u9664\u5143\u7D20\uFF0C\u7D22\u5F15\uFF1A", index6);
1729
+ this.document.contents.items.splice(index5, 1);
1730
+ logger.debug("[YamlEditor] \u5DF2\u6839\u636E\u7D22\u5F15\u4ECE\u6839\u8282\u70B9\u6570\u7EC4\u5220\u9664\u5143\u7D20\uFF0C\u7D22\u5F15\uFF1A", index5);
1731
1731
  return true;
1732
1732
  } catch (error) {
1733
1733
  logger.error(`[YamlEditor] \u6839\u636E\u7D22\u5F15\u5220\u9664\u6839\u8282\u70B9\u6570\u7EC4\u5143\u7D20\u65F6\u51FA\u9519\uFF1A${error}`);
@@ -1974,9 +1974,9 @@ var init_changelog = __esm({
1974
1974
  }
1975
1975
  const list2 = parseChangelog(data);
1976
1976
  const keys = Object.keys(list2);
1977
- const index6 = keys.indexOf(version2);
1978
- const start3 = reverse ? index6 - length : index6;
1979
- const end = reverse ? index6 : index6 + length;
1977
+ const index5 = keys.indexOf(version2);
1978
+ const start3 = reverse ? index5 - length : index5;
1979
+ const end = reverse ? index5 : index5 + length;
1980
1980
  const versions = keys.slice(start3, end).map((key) => list2[key] ? list2[key] : "");
1981
1981
  return versions.join("");
1982
1982
  };
@@ -2228,7 +2228,7 @@ var init_fs2 = __esm({
2228
2228
  init_fs();
2229
2229
  }
2230
2230
  });
2231
- var diffArray, diffSimpleArray, clamp, random, formatNumber, percentage, formatUnit, isEven, average, round, isNumber, isNumberInArray;
2231
+ var diffArray, diffSimpleArray, clamp, random, formatNumber, percentage, formatUnit, isEven, average, round, isNumber, isNumberInArray, createIdGenerator;
2232
2232
  var init_number = __esm({
2233
2233
  "src/utils/common/number.ts"() {
2234
2234
  diffArray = (old, data) => {
@@ -2288,6 +2288,10 @@ var init_number = __esm({
2288
2288
  }
2289
2289
  return defaultValue;
2290
2290
  };
2291
+ createIdGenerator = (start3 = 0) => {
2292
+ let id = start3;
2293
+ return () => ++id;
2294
+ };
2291
2295
  }
2292
2296
  });
2293
2297
  var TypedListeners, listeners;
@@ -10198,10 +10202,10 @@ var init_env3 = __esm({
10198
10202
  const lines = content.split("\n");
10199
10203
  const list2 = [];
10200
10204
  const obj = {};
10201
- lines.forEach((line, index6) => {
10202
- obj[index6] = line;
10205
+ lines.forEach((line, index5) => {
10206
+ obj[index5] = line;
10203
10207
  });
10204
- lines.forEach((line, index6) => {
10208
+ lines.forEach((line, index5) => {
10205
10209
  if (!line.includes("=")) return;
10206
10210
  let comment2 = "";
10207
10211
  let [key, value] = line.split("=").map((item) => item.trim());
@@ -10217,7 +10221,7 @@ var init_env3 = __esm({
10217
10221
  }
10218
10222
  }
10219
10223
  if (!comment2) {
10220
- const data = obj[index6 - 1]?.trim();
10224
+ const data = obj[index5 - 1]?.trim();
10221
10225
  if (data?.startsWith("#")) comment2 = data;
10222
10226
  }
10223
10227
  value = value?.replace(/^"|"$/g, "") || "";
@@ -10508,8 +10512,8 @@ var init_status_listener = __esm({
10508
10512
  }
10509
10513
  sysCpuInfo() {
10510
10514
  const currentTimes = os.cpus().map((cpu) => cpu.times);
10511
- const { total, active } = currentTimes.map((times, index6) => {
10512
- const prevTimes = this.cpuTimes[index6];
10515
+ const { total, active } = currentTimes.map((times, index5) => {
10516
+ const prevTimes = this.cpuTimes[index5];
10513
10517
  const totalCurrent = times.user + times.nice + times.sys + times.idle + times.irq;
10514
10518
  const totalPrev = prevTimes.user + prevTimes.nice + prevTimes.sys + prevTimes.idle + prevTimes.irq;
10515
10519
  const activeCurrent = totalCurrent - times.idle;
@@ -13009,6 +13013,7 @@ __export(common_exports, {
13009
13013
  buffer: () => buffer,
13010
13014
  buttonToQQBot: () => karinToQQBot,
13011
13015
  clamp: () => clamp,
13016
+ createIdGenerator: () => createIdGenerator,
13012
13017
  createRawMessage: () => createRawMessage,
13013
13018
  diffArray: () => diffArray,
13014
13019
  diffSimpleArray: () => diffSimpleArray,
@@ -13132,12 +13137,12 @@ var init_common = __esm({
13132
13137
  };
13133
13138
  getAbsPath = (images, root) => {
13134
13139
  const files = [];
13135
- images.forEach((image2, index6) => {
13140
+ images.forEach((image2, index5) => {
13136
13141
  if (typeof image2 !== "string") throw TypeError("\u4F20\u5165\u7684\u56FE\u7247\u53EA\u652F\u6301\u672C\u5730\u8DEF\u5F84 \u6216 \u5E26\u524D\u7F00base64://\u5B57\u7B26\u4E32");
13137
13142
  if (image2.startsWith("base64://")) {
13138
13143
  const base642 = image2.replace(/^base64:\/\//, "");
13139
13144
  const buffer2 = Buffer.from(base642, "base64");
13140
- const file3 = path4.join(root, `${index6}.png`);
13145
+ const file3 = path4.join(root, `${index5}.png`);
13141
13146
  fs5.writeFileSync(file3, buffer2);
13142
13147
  files.push(file3);
13143
13148
  return;
@@ -13155,9 +13160,9 @@ var init_common = __esm({
13155
13160
  return { width, height };
13156
13161
  };
13157
13162
  generateLayout = (dimensions, perRow, maxWidth, maxHeight) => {
13158
- const layouts = dimensions.map((_, index6) => {
13159
- const row = Math.floor(index6 / perRow);
13160
- const col = index6 % perRow;
13163
+ const layouts = dimensions.map((_, index5) => {
13164
+ const row = Math.floor(index5 / perRow);
13165
+ const col = index5 % perRow;
13161
13166
  return `${col * maxWidth}_${row * maxHeight}`;
13162
13167
  }).join("|");
13163
13168
  return layouts;
@@ -13172,11 +13177,11 @@ var init_common = __esm({
13172
13177
  const maxWidth = Math.max(...list2.map((d) => d.width));
13173
13178
  const maxHeight = Math.max(...list2.map((d) => d.height));
13174
13179
  let cmd = "";
13175
- list2.forEach((_, index6) => {
13176
- cmd += `[${index6}:v]pad=${maxWidth}:${maxHeight}:(ow-iw)/2:(oh-ih)/2[p${index6}]; `;
13180
+ list2.forEach((_, index5) => {
13181
+ cmd += `[${index5}:v]pad=${maxWidth}:${maxHeight}:(ow-iw)/2:(oh-ih)/2[p${index5}]; `;
13177
13182
  });
13178
13183
  const layouts = generateLayout(list2, perRow, maxWidth, maxHeight);
13179
- cmd += `${list2.map((_, index6) => `[p${index6}]`).join("")}xstack=inputs=${list2.length}:layout=${layouts}[out]`;
13184
+ cmd += `${list2.map((_, index5) => `[p${index5}]`).join("")}xstack=inputs=${list2.length}:layout=${layouts}[out]`;
13180
13185
  return cmd;
13181
13186
  };
13182
13187
  }
@@ -17050,9 +17055,9 @@ var init_bot = __esm({
17050
17055
  };
17051
17056
  unregisterBot = (type, idOrIndex, address) => {
17052
17057
  const findIndexAndRemove = (predicate) => {
17053
- const index6 = list.findIndex(predicate);
17054
- if (index6 !== -1) {
17055
- const [removed] = list.splice(index6, 1);
17058
+ const index5 = list.findIndex(predicate);
17059
+ if (index5 !== -1) {
17060
+ const [removed] = list.splice(index5, 1);
17056
17061
  logger.bot("info", removed.bot.selfId, `${logger.red("[service][\u5378\u8F7DBot]")} ${removed.bot.adapter.name}`);
17057
17062
  return true;
17058
17063
  }
@@ -19473,13 +19478,13 @@ var init_cache4 = __esm({
19473
19478
  logger.mark(`[render:${index4}] ${logger.green("\u6CE8\u518C\u6210\u529F")}: ${id}`);
19474
19479
  return i;
19475
19480
  };
19476
- unregisterRender = (index6) => {
19477
- const app5 = cache8.find((app6) => app6.index === index6);
19481
+ unregisterRender = (index5) => {
19482
+ const app5 = cache8.find((app6) => app6.index === index5);
19478
19483
  if (!app5) {
19479
- logger.error(`[render] \u5378\u8F7D\u5931\u8D25: \u4E0D\u5B58\u5728\u7D22\u5F15 ${index6}`);
19484
+ logger.error(`[render] \u5378\u8F7D\u5931\u8D25: \u4E0D\u5B58\u5728\u7D22\u5F15 ${index5}`);
19480
19485
  return false;
19481
19486
  }
19482
- cache8.splice(cache8.findIndex((app6) => app6.index === index6), 1);
19487
+ cache8.splice(cache8.findIndex((app6) => app6.index === index5), 1);
19483
19488
  logger.mark(`[render] ${logger.yellow("\u5378\u8F7D\u6210\u529F")}: ${app5.id}`);
19484
19489
  return true;
19485
19490
  };
@@ -19547,8 +19552,8 @@ var init_cache4 = __esm({
19547
19552
  * @param index 渲染器索引
19548
19553
  * @returns 是否卸载成功
19549
19554
  */
19550
- unapp(index6) {
19551
- return unregisterRender(index6);
19555
+ unapp(index5) {
19556
+ return unregisterRender(index5);
19552
19557
  }
19553
19558
  /**
19554
19559
  * 返回渲染器实例 未键入id返回第一个
@@ -19597,7 +19602,7 @@ var init_client = __esm({
19597
19602
  PREFIX = "[snapka-ws-clinet] ";
19598
19603
  snapkaMap = /* @__PURE__ */ new Map();
19599
19604
  createSnapkaClient = (clientOptions) => {
19600
- let index6 = -1;
19605
+ let index5 = -1;
19601
19606
  let isReconnect = true;
19602
19607
  let reconnectTimer;
19603
19608
  const { enable, url, token, reconnectTime = 5e3, heartbeatTime = 3e4, isSnapka = false } = clientOptions;
@@ -19620,7 +19625,7 @@ var init_client = __esm({
19620
19625
  const fnc2 = (isPrint = true) => {
19621
19626
  client.removeAllListeners();
19622
19627
  client?.close();
19623
- index6 > 0 && unregisterRender(index6);
19628
+ index5 > 0 && unregisterRender(index5);
19624
19629
  if (!isReconnect) {
19625
19630
  isPrint && logger.error(`${PREFIX}\u8FDE\u63A5\u5173\u95ED: ${url}`);
19626
19631
  return;
@@ -19639,7 +19644,7 @@ var init_client = __esm({
19639
19644
  setTimeout(() => {
19640
19645
  if (client.readyState !== WebSocket$1.OPEN) return;
19641
19646
  logger.info(`${PREFIX}\u8FDE\u63A5\u6210\u529F: ${url}`);
19642
- index6 = registerRender("snapka", render4);
19647
+ index5 = registerRender("snapka", render4);
19643
19648
  client.on("message", async (event) => onMessage(client, url, event, authorization));
19644
19649
  }, 3e3);
19645
19650
  });
@@ -19754,7 +19759,7 @@ var init_server = __esm({
19754
19759
  init_template();
19755
19760
  init_cache4();
19756
19761
  WebSocketPuppeteerServer = async (socket, request3) => {
19757
- let index6 = -1;
19762
+ let index5 = -1;
19758
19763
  const authorization = request3.headers["authorization"];
19759
19764
  if (!auth(authorization)) {
19760
19765
  socket.close();
@@ -19766,7 +19771,7 @@ var init_server = __esm({
19766
19771
  return sendWsScreenshotRequest(socket, options);
19767
19772
  };
19768
19773
  socket.on("close", () => {
19769
- index6 > 0 && unregisterRender(index6);
19774
+ index5 > 0 && unregisterRender(index5);
19770
19775
  socket.removeAllListeners();
19771
19776
  socket.close();
19772
19777
  });
@@ -19783,7 +19788,7 @@ var init_server = __esm({
19783
19788
  listeners.emit(key, { status, data });
19784
19789
  });
19785
19790
  const name = request3.headers["x-client-name"] || "snapka";
19786
- index6 = registerRender(name, render4);
19791
+ index5 = registerRender(name, render4);
19787
19792
  };
19788
19793
  initWebSocketPuppeteerServer = () => {
19789
19794
  listeners.on(WS_SNAPKA, (socket, request3, call2) => {
@@ -19835,14 +19840,14 @@ var init_http = __esm({
19835
19840
  };
19836
19841
  let pingTimer;
19837
19842
  let consecutiveFailures = 0;
19838
- const index6 = registerRender("snapka-http", render4);
19843
+ const index5 = registerRender("snapka-http", render4);
19839
19844
  const close = () => {
19840
19845
  if (pingTimer) {
19841
19846
  clearInterval(pingTimer);
19842
19847
  pingTimer = void 0;
19843
19848
  }
19844
19849
  snapkaMap2.delete(options.url);
19845
- unregisterRender(index6);
19850
+ unregisterRender(index5);
19846
19851
  };
19847
19852
  const startPingInterval = () => {
19848
19853
  pingTimer = setInterval(async () => {
@@ -21139,11 +21144,11 @@ var init_mock = __esm({
21139
21144
  this.store[key].expire = -1;
21140
21145
  this.#zset[key] = [];
21141
21146
  }
21142
- const index6 = this.#zset[key].findIndex((entry) => entry.member === member.toString());
21143
- if (index6 === -1) {
21147
+ const index5 = this.#zset[key].findIndex((entry) => entry.member === member.toString());
21148
+ if (index5 === -1) {
21144
21149
  this.#zset[key].push({ score, member });
21145
21150
  } else {
21146
- this.#zset[key][index6] = { score, member };
21151
+ this.#zset[key][index5] = { score, member };
21147
21152
  }
21148
21153
  this.#sqlite.set(key, JSON.stringify(this.#zset[key]), "zset" /* ZSET */, this.store[key].expire);
21149
21154
  return 1;
@@ -21167,8 +21172,8 @@ var init_mock = __esm({
21167
21172
  async zRank(key, member) {
21168
21173
  if (!this.#list[key]) return null;
21169
21174
  if (this.checkExpire(key)) return null;
21170
- const index6 = this.#list[key].findIndex((entry) => entry === member.toString());
21171
- return index6 !== -1 ? index6 : null;
21175
+ const index5 = this.#list[key].findIndex((entry) => entry === member.toString());
21176
+ return index5 !== -1 ? index5 : null;
21172
21177
  }
21173
21178
  /**
21174
21179
  * 返回有序集合中指定成员的分数
@@ -21394,17 +21399,17 @@ var init_mock = __esm({
21394
21399
  * @param index 索引,0表示第一个元素,-1表示最后一个元素
21395
21400
  * @returns 返回元素值,索引超出范围返回null
21396
21401
  */
21397
- async lIndex(key, index6) {
21402
+ async lIndex(key, index5) {
21398
21403
  if (!this.#list[key]) return null;
21399
21404
  if (this.checkExpire(key)) return null;
21400
21405
  const list2 = this.#list[key];
21401
- if (index6 < 0) {
21402
- index6 = list2.length + index6;
21406
+ if (index5 < 0) {
21407
+ index5 = list2.length + index5;
21403
21408
  }
21404
- if (index6 < 0 || index6 >= list2.length) {
21409
+ if (index5 < 0 || index5 >= list2.length) {
21405
21410
  return null;
21406
21411
  }
21407
- return list2[index6].toString();
21412
+ return list2[index5].toString();
21408
21413
  }
21409
21414
  /**
21410
21415
  * 设置列表指定索引的元素值
@@ -21413,17 +21418,17 @@ var init_mock = __esm({
21413
21418
  * @param value 值
21414
21419
  * @returns 成功返回"OK",失败返回错误
21415
21420
  */
21416
- async lSet(key, index6, value) {
21421
+ async lSet(key, index5, value) {
21417
21422
  if (!this.#list[key]) return null;
21418
21423
  if (this.checkExpire(key)) return null;
21419
21424
  const list2 = this.#list[key];
21420
- if (index6 < 0) {
21421
- index6 = list2.length + index6;
21425
+ if (index5 < 0) {
21426
+ index5 = list2.length + index5;
21422
21427
  }
21423
- if (index6 < 0 || index6 >= list2.length) {
21428
+ if (index5 < 0 || index5 >= list2.length) {
21424
21429
  return null;
21425
21430
  }
21426
- list2[index6] = value;
21431
+ list2[index5] = value;
21427
21432
  this.#sqlite.set(key, JSON.stringify(list2), "list" /* LIST */, this.store[key].expire);
21428
21433
  return "OK";
21429
21434
  }
@@ -21637,9 +21642,9 @@ var init_mock = __esm({
21637
21642
  if (!this.#zset[key]) return 0;
21638
21643
  if (this.checkExpire(key)) return 0;
21639
21644
  const strMember = member.toString();
21640
- const index6 = this.#zset[key].findIndex((entry) => entry.member.toString() === strMember);
21641
- if (index6 !== -1) {
21642
- this.#zset[key].splice(index6, 1);
21645
+ const index5 = this.#zset[key].findIndex((entry) => entry.member.toString() === strMember);
21646
+ if (index5 !== -1) {
21647
+ this.#zset[key].splice(index5, 1);
21643
21648
  this.#sqlite.set(key, JSON.stringify(this.#zset[key]), "zset" /* ZSET */, this.store[key].expire);
21644
21649
  return 1;
21645
21650
  }
@@ -22753,7 +22758,7 @@ var init_http2 = __esm({
22753
22758
  }
22754
22759
  return;
22755
22760
  }
22756
- const index6 = registerRender("puppeteer", async (options) => {
22761
+ const index5 = registerRender("puppeteer", async (options) => {
22757
22762
  try {
22758
22763
  const result = await axios8.post(`${url}/puppeteer`, options, { headers });
22759
22764
  if (result.status !== 200) {
@@ -22763,7 +22768,7 @@ var init_http2 = __esm({
22763
22768
  } catch (error) {
22764
22769
  if (axios8.isAxiosError(error)) {
22765
22770
  if (!error.response) {
22766
- unregisterRender(index6);
22771
+ unregisterRender(index5);
22767
22772
  throw new Error(`[render][http] \u7F51\u7EDC\u8FDE\u63A5\u5931\u8D25: ${error.message}`);
22768
22773
  }
22769
22774
  const { response } = error;
@@ -26757,7 +26762,7 @@ var init_app = __esm({
26757
26762
  };
26758
26763
  }
26759
26764
  });
26760
- var index5, botID, AdapterConsole, adapter2;
26765
+ var getMessageId, getFileId, botID, AdapterConsole, adapter2;
26761
26766
  var init_input = __esm({
26762
26767
  "src/adapter/input/index.ts"() {
26763
26768
  init_base();
@@ -26767,9 +26772,11 @@ var init_input = __esm({
26767
26772
  init_service();
26768
26773
  init_message2();
26769
26774
  init_config();
26775
+ init_common();
26770
26776
  init_create();
26771
26777
  init_event2();
26772
- index5 = 0;
26778
+ getMessageId = createIdGenerator();
26779
+ getFileId = createIdGenerator();
26773
26780
  botID = "console";
26774
26781
  AdapterConsole = class extends AdapterBase {
26775
26782
  constructor() {
@@ -26850,7 +26857,7 @@ var init_input = __esm({
26850
26857
  }
26851
26858
  async sendMsg(contact3, elements, _) {
26852
26859
  const time2 = Date.now();
26853
- const messageId = (++index5).toString();
26860
+ const messageId = getMessageId().toString();
26854
26861
  const result = {
26855
26862
  message_id: messageId,
26856
26863
  messageId,
@@ -26889,7 +26896,7 @@ var init_input = __esm({
26889
26896
  }
26890
26897
  async getUrl(data, ext) {
26891
26898
  const cfg = adapter();
26892
- const name = (++index5).toString();
26899
+ const name = getFileId().toString();
26893
26900
  const file2 = path4.join(consolePath, `${name}${ext}`);
26894
26901
  await fs5.promises.writeFile(file2, await buffer(data));
26895
26902
  if (cfg.console.isLocal) {
@@ -27628,8 +27635,8 @@ var Other = class extends EventEmitter {
27628
27635
  * 根据索引获取Bot
27629
27636
  * @param index - Bot的索引id
27630
27637
  */
27631
- getBotByIndex(index6) {
27632
- return getBot(index6);
27638
+ getBotByIndex(index5) {
27639
+ return getBot(index5);
27633
27640
  }
27634
27641
  /**
27635
27642
  * 获取注册的Bot数量
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.11.3",
3
+ "version": "1.11.4",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",