node-karin 1.15.1 → 1.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.15.3](https://github.com/KarinJS/Karin/compare/core-v1.15.2...core-v1.15.3) (2026-04-01)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * 更新适配器平台、标准、协议和通信方式的类型定义,添加新选项 ([#636](https://github.com/KarinJS/Karin/issues/636)) ([295dc1a](https://github.com/KarinJS/Karin/commit/295dc1a6def09014815d38b7bac115fd0c39e62a))
9
+
10
+ ## [1.15.2](https://github.com/KarinJS/Karin/compare/core-v1.15.1...core-v1.15.2) (2026-03-30)
11
+
12
+
13
+ ### 🐛 Bug Fixes
14
+
15
+ * 上下文(ctx)方法添加 `超时后是否抛出错误` 选项,默认 true ([#634](https://github.com/KarinJS/Karin/issues/634)) ([9f2ac76](https://github.com/KarinJS/Karin/commit/9f2ac7679770878495825e7d450fff31857a9c51))
16
+
3
17
  ## [1.15.1](https://github.com/KarinJS/Karin/compare/core-v1.15.0...core-v1.15.1) (2026-03-24)
4
18
 
5
19
 
package/dist/index.d.ts CHANGED
@@ -229,21 +229,28 @@ interface SenderGroup$1 {
229
229
  * 适配器所属平台
230
230
  * - `qq`: QQ
231
231
  * - `wechat`: 微信
232
+ * - `wecom`: 企业微信
232
233
  * - `telegram`: Telegram
233
234
  * - `discord`: Discord
234
235
  * - `koko`: 开黑吧
236
+ * - `dingtalk`: 钉钉
237
+ * - `feishu`: 飞书
238
+ * - `slack`: Slack
239
+ * - `whatsapp`: WhatsApp
235
240
  * - `other`: 其他
236
241
  */
237
- type AdapterPlatform = 'qq' | 'wechat' | 'telegram' | 'discord' | 'koko' | 'other';
242
+ type AdapterPlatform = 'qq' | 'wechat' | 'telegram' | 'discord' | 'koko' | 'dingtalk' | 'feishu' | 'slack' | 'wecom' | 'whatsapp' | 'other' | (string & {});
238
243
  /**
239
244
  * 适配器所使用的标准接口协议
240
245
  * - `onebot11`: OneBot v11 标准
241
246
  * - `onebot12`: OneBot v12 标准
242
247
  * - `oicq`: OICQ 标准
243
248
  * - `icqq`: OICQ fork 标准
249
+ * - `milky`: Milky 标准
250
+ * - `satori`: Satori 标准
244
251
  * - `other`: 其他标准
245
252
  */
246
- type AdapterStandard = 'onebot11' | 'onebot12' | 'oicq' | 'icqq' | 'other';
253
+ type AdapterStandard = 'onebot11' | 'onebot12' | 'oicq' | 'icqq' | 'milky' | 'satori' | 'other' | (string & {});
247
254
  /**
248
255
  * 适配器协议实现名称
249
256
  * - `console`: 控制台
@@ -255,17 +262,19 @@ type AdapterStandard = 'onebot11' | 'onebot12' | 'oicq' | 'icqq' | 'other';
255
262
  * - `llonebot`: https://llonebot.github.io/zh-CN/
256
263
  * - `conwechat`: https://justundertaker.github.io/ComWeChatBotClient/
257
264
  * - `lagrange`: https://lagrangedev.github.io/Lagrange.Doc/Lagrange.OneBot/
265
+ * - `yogurt`: https://acidify.ntqqrev.org/
258
266
  */
259
- type AdapterProtocol = 'qqbot' | 'icqq' | 'gocq-http' | 'napcat' | 'oicq' | 'llonebot' | 'conwechat' | 'lagrange' | 'console' | 'other';
267
+ type AdapterProtocol = 'qqbot' | 'icqq' | 'gocq-http' | 'napcat' | 'oicq' | 'llonebot' | 'conwechat' | 'lagrange' | 'console' | 'yogurt' | 'other' | (string & {});
260
268
  /**
261
269
  * 适配器通信方式
262
270
  * - `http`: HTTP 通信
263
271
  * - `webSocketServer`: WebSocket 服务端
264
272
  * - `webSocketClient`: WebSocket 客户端
265
273
  * - `grpc`: gRPC 通信
274
+ * - `sse`: Server-Sent Events 通信
266
275
  * - `other`: 其他通信方式
267
276
  */
268
- type AdapterCommunication = 'http' | 'webSocketServer' | 'webSocketClient' | 'grpc' | 'other';
277
+ type AdapterCommunication = 'http' | 'webSocketServer' | 'webSocketClient' | 'grpc' | 'sse' | 'other' | (string & {});
269
278
  /**
270
279
  * 适配器基本信息
271
280
  */
@@ -7499,7 +7508,9 @@ declare const ctx: <T = Message>(e: Event, options?: {
7499
7508
  reply?: boolean;
7500
7509
  /** 超时回复文本 默认为'操作超时已取消' */
7501
7510
  replyMsg?: string;
7502
- }) => Promise<T>;
7511
+ /** 超时后是否抛出错误 默认为 true */
7512
+ throwOnTimeout?: boolean;
7513
+ }) => Promise<T | null>;
7503
7514
 
7504
7515
  interface HandlerOptions {
7505
7516
  /** 插件名称 */
package/dist/index.mjs CHANGED
@@ -24237,8 +24237,8 @@ var command = (reg, second, options = {}) => {
24237
24237
  init_internal();
24238
24238
  init_context();
24239
24239
  var ctx2 = async (e, options) => {
24240
- const time2 = options?.time || 120;
24241
- 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;
24242
24242
  const key = e.contact.subPeer ? `${e.contact.peer}:${e.contact.subPeer}:${userId}` : `${e.contact.peer}:${userId}`;
24243
24243
  ctx.set(key, e);
24244
24244
  return new Promise((resolve, reject) => {
@@ -24246,9 +24246,14 @@ var ctx2 = async (e, options) => {
24246
24246
  const data = ctx.get(key);
24247
24247
  if (data?.eventId === e.eventId) {
24248
24248
  ctx.delete(key);
24249
- 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");
24250
24250
  listeners.removeAllListeners(`ctx:${key}`);
24251
- 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
+ }
24252
24257
  return true;
24253
24258
  }
24254
24259
  }, time2 * 1e3);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.15.1",
3
+ "version": "1.15.3",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",