node-karin 1.15.0 → 1.15.2

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,19 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.15.2](https://github.com/KarinJS/Karin/compare/core-v1.15.1...core-v1.15.2) (2026-03-30)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * 上下文(ctx)方法添加 `超时后是否抛出错误` 选项,默认 true ([#634](https://github.com/KarinJS/Karin/issues/634)) ([9f2ac76](https://github.com/KarinJS/Karin/commit/9f2ac7679770878495825e7d450fff31857a9c51))
9
+
10
+ ## [1.15.1](https://github.com/KarinJS/Karin/compare/core-v1.15.0...core-v1.15.1) (2026-03-24)
11
+
12
+
13
+ ### 🐛 Bug Fixes
14
+
15
+ * ffmpeg initialization priority order ([#629](https://github.com/KarinJS/Karin/issues/629)) ([5510219](https://github.com/KarinJS/Karin/commit/5510219de2dc199d1dfe71dd024524b9cf45ff87))
16
+
3
17
  ## [1.15.0](https://github.com/KarinJS/Karin/compare/core-v1.14.4...core-v1.15.0) (2026-03-24)
4
18
 
5
19
 
package/dist/index.d.ts CHANGED
@@ -7499,7 +7499,9 @@ declare const ctx: <T = Message>(e: Event, options?: {
7499
7499
  reply?: boolean;
7500
7500
  /** 超时回复文本 默认为'操作超时已取消' */
7501
7501
  replyMsg?: string;
7502
- }) => Promise<T>;
7502
+ /** 超时后是否抛出错误 默认为 true */
7503
+ throwOnTimeout?: boolean;
7504
+ }) => Promise<T | null>;
7503
7505
 
7504
7506
  interface HandlerOptions {
7505
7507
  /** 插件名称 */
package/dist/index.mjs CHANGED
@@ -7543,26 +7543,23 @@ var init_ffmpeg = __esm({
7543
7543
  ffprobePath2 = "ffprobe";
7544
7544
  ffplayPath2 = "ffplay";
7545
7545
  setTimeout(async () => {
7546
- const env3 = await exec("ffmpeg -version", { booleanResult: true });
7547
- if (!env3) {
7548
- try {
7549
- const name = "@karinjs/plugin-ffmpeg";
7550
- const plugin = await import(name);
7551
- const ffmpeg2 = plugin.default.ffmpegPath;
7552
- const ffprobe2 = plugin.default.ffprobePath;
7553
- const ffplay2 = plugin.default.ffplayPath;
7554
- ffmpegPath2 = ffmpeg2 ? `"${ffmpeg2}"` : ffmpegPath2;
7555
- ffprobePath2 = ffprobe2 ? `"${ffprobe2}"` : ffprobePath2;
7556
- ffplayPath2 = ffplay2 ? `"${ffplay2}"` : ffplayPath2;
7557
- } catch {
7558
- const cfg = await Promise.resolve().then(() => (init_config(), config_exports));
7559
- const ffmpeg2 = cfg.ffmpegPath();
7560
- const ffprobe2 = cfg.ffprobePath();
7561
- const ffplay2 = cfg.ffplayPath();
7562
- ffmpegPath2 = ffmpeg2 ? `"${ffmpeg2}"` : ffmpegPath2;
7563
- ffprobePath2 = ffprobe2 ? `"${ffprobe2}"` : ffprobePath2;
7564
- ffplayPath2 = ffplay2 ? `"${ffplay2}"` : ffplayPath2;
7565
- }
7546
+ try {
7547
+ const name = "@karinjs/plugin-ffmpeg";
7548
+ const plugin = await import(name);
7549
+ const ffmpeg2 = plugin.default.ffmpegPath;
7550
+ const ffprobe2 = plugin.default.ffprobePath;
7551
+ const ffplay2 = plugin.default.ffplayPath;
7552
+ ffmpegPath2 = ffmpeg2 ? `"${ffmpeg2}"` : ffmpegPath2;
7553
+ ffprobePath2 = ffprobe2 ? `"${ffprobe2}"` : ffprobePath2;
7554
+ ffplayPath2 = ffplay2 ? `"${ffplay2}"` : ffplayPath2;
7555
+ } catch {
7556
+ const cfg = await Promise.resolve().then(() => (init_config(), config_exports));
7557
+ const ffmpeg2 = cfg.ffmpegPath();
7558
+ const ffprobe2 = cfg.ffprobePath();
7559
+ const ffplay2 = cfg.ffplayPath();
7560
+ ffmpegPath2 = ffmpeg2 ? `"${ffmpeg2}"` : ffmpegPath2;
7561
+ ffprobePath2 = ffprobe2 ? `"${ffprobe2}"` : ffprobePath2;
7562
+ ffplayPath2 = ffplay2 ? `"${ffplay2}"` : ffplayPath2;
7566
7563
  }
7567
7564
  }, 1e3);
7568
7565
  ffmpeg = async (cmd, options) => {
@@ -24240,8 +24237,8 @@ var command = (reg, second, options = {}) => {
24240
24237
  init_internal();
24241
24238
  init_context();
24242
24239
  var ctx2 = async (e, options) => {
24243
- const time2 = options?.time || 120;
24244
- const userId = options?.userId || e.userId || e.user_id;
24240
+ const { time: time2 = 120, userId: optionUserId, reply: reply2, replyMsg, throwOnTimeout = true } = options ?? {};
24241
+ const userId = optionUserId || e.userId || e.user_id;
24245
24242
  const key = e.contact.subPeer ? `${e.contact.peer}:${e.contact.subPeer}:${userId}` : `${e.contact.peer}:${userId}`;
24246
24243
  ctx.set(key, e);
24247
24244
  return new Promise((resolve, reject) => {
@@ -24249,9 +24246,14 @@ var ctx2 = async (e, options) => {
24249
24246
  const data = ctx.get(key);
24250
24247
  if (data?.eventId === e.eventId) {
24251
24248
  ctx.delete(key);
24252
- if (options?.reply) e.reply(options.replyMsg || "\u64CD\u4F5C\u8D85\u65F6\u5DF2\u53D6\u6D88");
24249
+ if (reply2) e.reply(replyMsg || "\u64CD\u4F5C\u8D85\u65F6\u5DF2\u53D6\u6D88");
24253
24250
  listeners.removeAllListeners(`ctx:${key}`);
24254
- reject(new Error(`\u63A5\u6536\u4E0B\u6587\u4E8B\u4EF6\u8D85\u65F6\uFF0C\u5DF2\u53D6\u6D88\u4E0B\u6587\u76D1\u542C: ${key}`));
24251
+ if (throwOnTimeout) {
24252
+ reject(new Error(`\u63A5\u6536\u4E0B\u6587\u4E8B\u4EF6\u8D85\u65F6\uFF0C\u5DF2\u53D6\u6D88\u4E0B\u6587\u76D1\u542C: ${key}`));
24253
+ } else {
24254
+ logger.debug(`\u63A5\u6536\u4E0B\u6587\u4E8B\u4EF6\u8D85\u65F6\uFF0C\u5DF2\u53D6\u6D88\u4E0B\u6587\u76D1\u542C: ${key}`);
24255
+ resolve(null);
24256
+ }
24255
24257
  return true;
24256
24258
  }
24257
24259
  }, time2 * 1e3);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.15.0",
3
+ "version": "1.15.2",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",