node-karin 1.14.1 → 1.14.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.14.3](https://github.com/KarinJS/Karin/compare/core-v1.14.2...core-v1.14.3) (2026-02-09)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * 修复pokeUser参数错误的问题close [#576](https://github.com/KarinJS/Karin/issues/576) ([#609](https://github.com/KarinJS/Karin/issues/609)) ([5853366](https://github.com/KarinJS/Karin/commit/5853366236226b340f60d560fab84ac8c2d20d2d))
9
+
10
+ ## [1.14.2](https://github.com/KarinJS/Karin/compare/core-v1.14.1...core-v1.14.2) (2026-01-30)
11
+
12
+
13
+ ### 🎡 Continuous Integration
14
+
15
+ * **workflow:** 移除docker构建 ([#606](https://github.com/KarinJS/Karin/issues/606)) ([302190a](https://github.com/KarinJS/Karin/commit/302190a5bd499b747c3c82ce443979c92825f05c))
16
+
3
17
  ## [1.14.1](https://github.com/KarinJS/Karin/compare/core-v1.14.0...core-v1.14.1) (2025-12-25)
4
18
 
5
19
 
package/README.md CHANGED
@@ -38,9 +38,9 @@
38
38
 
39
39
  我们提供多个文档站点供您访问,解决可能出现的访问困难:
40
40
 
41
- - **主文档站**: [https://karinjs.com](https://karinjs.com) (基于 GitHub Pages)
41
+ - **主文档站**: [https://karinjs.com](https://karinjs.com)
42
42
  - **镜像站点**:
43
- - [Vercel 镜像(瑜笙)](https://github.com/yusheng929): [https://docs.karinjs.com](https://docs.karinjs.com)
43
+ - [自建镜像(雾里)](https://github.com/shiwuliya): [https://karin.wuliya.cn](https://karin.wuliya.cn)
44
44
  - [Vercel 镜像(憨憨)](https://github.com/hanhan258): [https://karin.hanhanz.top](https://karin.hanhanz.top)
45
45
  - Deno 镜像: [https://karin.deno.dev](https://karin.deno.dev)
46
46
  - [自建CDN镜像(ikechan8370)](https://github.com/ikechan8370): [https://karin.chaite.cloud](https://karin.chaite.cloud)
package/dist/index.d.ts CHANGED
@@ -1502,9 +1502,10 @@ interface AdapterType<T = any> {
1502
1502
  /**
1503
1503
  * 戳一戳用户 支持群聊和私聊
1504
1504
  * @param contact 目标信息
1505
+ * @param targetId 被戳用户 ID
1505
1506
  * @param count 戳一戳次数 默认为1
1506
1507
  */
1507
- pokeUser(contact: Contact, count?: number): Promise<boolean>;
1508
+ pokeUser(contact: Contact, targetId: string, count?: number): Promise<boolean>;
1508
1509
  /**
1509
1510
  * 获取 Cookies
1510
1511
  * @param domain The domain to get cookies from
@@ -3438,9 +3439,10 @@ declare abstract class AdapterBase<T = any> implements AdapterType<T> {
3438
3439
  /**
3439
3440
  * 戳一戳用户 支持群聊和私聊
3440
3441
  * @param _contact 目标信息
3442
+ * @param _targetId 被戳用户 ID
3441
3443
  * @param _count 戳一戳次数 默认为1
3442
3444
  */
3443
- pokeUser(_contact: Contact, _count?: number): Promise<boolean>;
3445
+ pokeUser(_contact: Contact, _targetId: string, _count?: number): Promise<boolean>;
3444
3446
  /**
3445
3447
  * 获取 Cookies
3446
3448
  * @param _domain The domain to get cookies from
@@ -12212,7 +12214,8 @@ declare enum OneBotFriendApiAction {
12212
12214
  nc_getFriendsWithCategory = "nc_get_friends_with_category",
12213
12215
  nc_getDoubtFriendsAddRequest = "nc_get_doubt_friends_add_request",
12214
12216
  nc_setDoubtFriendsAddRequest = "nc_set_doubt_friends_add_request",
12215
- nc_friendPoke = "nc_friend_poke"
12217
+ nc_friendPoke = "nc_friend_poke",
12218
+ lgl_friendPoke = "lgl_friend_poke"
12216
12219
  }
12217
12220
  /**
12218
12221
  * 好友相关 API
@@ -12452,6 +12455,15 @@ interface OneBotFriendApi {
12452
12455
  };
12453
12456
  response: null;
12454
12457
  };
12458
+ /** Lagrange扩展: 好友戳一戳 */
12459
+ [OneBotFriendApiAction.lgl_friendPoke]: {
12460
+ action: 'friend_poke';
12461
+ params: {
12462
+ user_id?: number;
12463
+ target_id?: number;
12464
+ };
12465
+ response: null;
12466
+ };
12455
12467
  }
12456
12468
 
12457
12469
  declare enum OneBotGroupApiAction {
@@ -12465,6 +12477,7 @@ declare enum OneBotGroupApiAction {
12465
12477
  setGroupName = "set_group_name",
12466
12478
  setGroupLeave = "set_group_leave",
12467
12479
  lgl_setGroupLeave = "lgl_set_group_leave",
12480
+ lgl_groupPoke = "group_poke",
12468
12481
  setGroupSpecialTitle = "set_group_special_title",
12469
12482
  getGroupInfo = "get_group_info",
12470
12483
  getGroupList = "get_group_list",
@@ -12948,6 +12961,15 @@ interface OneBotGroupApi {
12948
12961
  };
12949
12962
  response: null;
12950
12963
  };
12964
+ /** Lagrange拓展: 群内戳一戳 */
12965
+ [OneBotGroupApiAction.lgl_groupPoke]: {
12966
+ action: 'group_poke';
12967
+ params: {
12968
+ group_id: number;
12969
+ user_id: number;
12970
+ };
12971
+ response: null;
12972
+ };
12951
12973
  /** NapCat拓展: 获取群信息扩展 */
12952
12974
  [OneBotGroupApiAction.nc_getGroupInfoEx]: {
12953
12975
  action: 'get_group_info_ex';
@@ -14736,6 +14758,11 @@ declare abstract class OneBotCore extends EventEmitter$1 {
14736
14758
  * @param target_id - 目标ID
14737
14759
  */
14738
14760
  nc_friendPoke(user_id?: number, target_id?: number): Promise<null>;
14761
+ /** Lagrange扩展: 好友戳一戳
14762
+ * @param user_id - 用户ID
14763
+ * @param target_id - 目标ID
14764
+ */
14765
+ lgl_friendPoke(user_id?: number, target_id?: number): Promise<null>;
14739
14766
  /**
14740
14767
  * 群组踢人
14741
14768
  * @param group_id - 群ID
@@ -15085,6 +15112,11 @@ declare abstract class OneBotCore extends EventEmitter$1 {
15085
15112
  * @param user_id - 用户ID
15086
15113
  */
15087
15114
  nc_groupPoke(group_id: number, user_id: number): Promise<null>;
15115
+ /** Lagrange拓展: 群内戳一戳
15116
+ * @param group_id - 群ID
15117
+ * @param user_id - 用户ID
15118
+ */
15119
+ lgl_groupPoke(group_id: number, user_id: number): Promise<null>;
15088
15120
  /**
15089
15121
  * NapCat拓展: 获取群信息扩展
15090
15122
  * @param group_id - 群ID
@@ -16758,7 +16790,13 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16758
16790
  * @param create true为添加精华消息,false为删除精华消息 默认为true
16759
16791
  */
16760
16792
  setGroupHighlights(_: string, messageId: string, create: boolean): Promise<void>;
16761
- PokeMember(_: string, __: string): Promise<void>;
16793
+ /**
16794
+ * 戳一戳用户
16795
+ * @param _contact 事件来源
16796
+ * @param _targetId 被戳目标ID
16797
+ * @param _count 戳一戳次数,默认1
16798
+ */
16799
+ pokeUser(_contact: Contact, _targetId: string, _count?: number): Promise<boolean>;
16762
16800
  /**
16763
16801
  * 设置好友请求结果
16764
16802
  * @param requestId 请求事件ID
@@ -16783,11 +16821,11 @@ declare class AdapterOneBot<T extends OneBotType> extends AdapterBase {
16783
16821
  */
16784
16822
  setInvitedJoinGroupResult(requestId: string, isApprove: boolean): Promise<void>;
16785
16823
  /**
16786
- * 合并转发 karin -> adapter
16787
- * @param elements 消息元素
16788
- * @param options 首层小卡片外显参数
16789
- * @returns 适配器消息元素
16790
- */
16824
+ * 合并转发 karin -> adapter
16825
+ * @param elements 消息元素
16826
+ * @param options 首层小卡片外显参数
16827
+ * @returns 适配器消息元素
16828
+ */
16791
16829
  forwardKarinConvertAdapter(elements: Array<NodeElement>, options?: ForwardOptions): Array<NodeMessage>;
16792
16830
  /**
16793
16831
  * 发送合并转发消息
package/dist/index.mjs CHANGED
@@ -3022,9 +3022,10 @@ var init_base = __esm({
3022
3022
  /**
3023
3023
  * 戳一戳用户 支持群聊和私聊
3024
3024
  * @param _contact 目标信息
3025
+ * @param _targetId 被戳用户 ID
3025
3026
  * @param _count 戳一戳次数 默认为1
3026
3027
  */
3027
- pokeUser(_contact, _count) {
3028
+ pokeUser(_contact, _targetId, _count) {
3028
3029
  throw new Error(this.#errMsg);
3029
3030
  }
3030
3031
  /**
@@ -4161,6 +4162,16 @@ var init_dist2 = __esm({
4161
4162
  target_id
4162
4163
  });
4163
4164
  }
4165
+ /** Lagrange扩展: 好友戳一戳
4166
+ * @param user_id - 用户ID
4167
+ * @param target_id - 目标ID
4168
+ */
4169
+ async lgl_friendPoke(user_id, target_id) {
4170
+ return this.sendApi("lgl_friend_poke", {
4171
+ user_id,
4172
+ target_id
4173
+ });
4174
+ }
4164
4175
  /**
4165
4176
  * 群组踢人
4166
4177
  * @param group_id - 群ID
@@ -4539,6 +4550,16 @@ var init_dist2 = __esm({
4539
4550
  user_id
4540
4551
  });
4541
4552
  }
4553
+ /** Lagrange拓展: 群内戳一戳
4554
+ * @param group_id - 群ID
4555
+ * @param user_id - 用户ID
4556
+ */
4557
+ async lgl_groupPoke(group_id, user_id) {
4558
+ return this.sendApi("group_poke", {
4559
+ group_id,
4560
+ user_id
4561
+ });
4562
+ }
4542
4563
  /**
4543
4564
  * NapCat拓展: 获取群信息扩展
4544
4565
  * @param group_id - 群ID
@@ -5394,21 +5415,22 @@ var init_dist2 = __esm({
5394
5415
  */
5395
5416
  async sendApi(action, params, timeout2 = this._options.timeout) {
5396
5417
  const echo = (++this.echo).toString();
5397
- const request22 = JSON.stringify({ echo, action, params });
5418
+ const realAction = this._formatAction(action);
5419
+ const request22 = JSON.stringify({ echo, action: realAction, params });
5398
5420
  return new Promise((resolve, reject) => {
5399
5421
  const timeoutId = setTimeout(() => {
5400
- reject(this._formatApiError(action, request22, "\u8BF7\u6C42\u8D85\u65F6"));
5422
+ reject(this._formatApiError(realAction, request22, "\u8BF7\u6C42\u8D85\u65F6"));
5401
5423
  }, timeout2 * 1e3);
5402
- this.emit("sendApi", { echo, action, params, request: request22 });
5424
+ this.emit("sendApi", { echo, action: realAction, params, request: request22 });
5403
5425
  this._socket.send(request22);
5404
5426
  this.once(`echo:${echo}`, (data) => {
5405
5427
  clearTimeout(timeoutId);
5406
5428
  if (data.status === "ok") {
5407
5429
  resolve(data.data);
5408
5430
  } else {
5409
- reject(this._formatApiError(action, request22, data));
5431
+ reject(this._formatApiError(realAction, request22, data));
5410
5432
  }
5411
- this.emit("response", { echo, action, params, request: request22, data });
5433
+ this.emit("response", { echo, action: realAction, params, request: request22, data });
5412
5434
  });
5413
5435
  });
5414
5436
  }
@@ -5863,14 +5885,15 @@ var init_dist2 = __esm({
5863
5885
  * @returns 返回API响应 注意: 返回的是response.data,而不是response
5864
5886
  */
5865
5887
  async sendApi(action, params, timeout2 = this._options.timeout) {
5866
- const host2 = `${this._options.httpHost}/${action}`;
5888
+ const realAction = this._formatAction(action);
5889
+ const host2 = `${this._options.httpHost}/${realAction}`;
5867
5890
  const request22 = JSON.stringify(params);
5868
- this.emit("sendApi", { action, params, request: request22, echo: "" });
5891
+ this.emit("sendApi", { action: realAction, params, request: request22, echo: "" });
5869
5892
  const data = await http_default.post(host2, request22, { timeout: timeout2, headers: this._options.headers });
5870
5893
  if (data.data.status === "ok") {
5871
5894
  return data.data.data;
5872
5895
  } else {
5873
- throw this._formatApiError(action, request22, data.data);
5896
+ throw this._formatApiError(realAction, request22, data.data);
5874
5897
  }
5875
5898
  }
5876
5899
  /**
@@ -18915,8 +18938,38 @@ var init_core = __esm({
18915
18938
  await this._onebot.deleteEssenceMsg(+messageId);
18916
18939
  }
18917
18940
  }
18918
- async PokeMember(_, __) {
18919
- throw new Error("Method not implemented.");
18941
+ /**
18942
+ * 戳一戳用户
18943
+ * @param _contact 事件来源
18944
+ * @param _targetId 被戳目标ID
18945
+ * @param _count 戳一戳次数,默认1
18946
+ */
18947
+ async pokeUser(_contact, _targetId, _count = 1) {
18948
+ if (!["group", "friend"].includes(_contact.scene)) {
18949
+ throw new Error("\u4E0D\u652F\u6301\u7684\u573A\u666F");
18950
+ }
18951
+ const peerId = Number(_contact.peer);
18952
+ const targetId = Number(_targetId);
18953
+ const scene = _contact.scene;
18954
+ const handlers = {
18955
+ "Lagrange.OneBot": {
18956
+ group: () => this._onebot.lgl_groupPoke(peerId, targetId),
18957
+ friend: () => this._onebot.lgl_friendPoke(targetId)
18958
+ },
18959
+ "NapCat.Onebot": {
18960
+ group: () => this._onebot.nc_groupPoke(peerId, targetId),
18961
+ friend: () => this._onebot.nc_friendPoke(targetId)
18962
+ }
18963
+ };
18964
+ const adapterHandlers = handlers[this.adapter.name];
18965
+ if (!adapterHandlers) {
18966
+ throw new Error(`${this.adapter.name} \u4E0D\u652F\u6301\u6233\u4E00\u6233\u529F\u80FD`);
18967
+ }
18968
+ const pokeOnce = adapterHandlers[scene];
18969
+ for (let i = 0; i < _count; i++) {
18970
+ await pokeOnce();
18971
+ }
18972
+ return true;
18920
18973
  }
18921
18974
  /**
18922
18975
  * 设置好友请求结果
@@ -18948,11 +19001,11 @@ var init_core = __esm({
18948
19001
  await this._onebot.setGroupAddRequest(requestId, "invite", isApprove);
18949
19002
  }
18950
19003
  /**
18951
- * 合并转发 karin -> adapter
18952
- * @param elements 消息元素
18953
- * @param options 首层小卡片外显参数
18954
- * @returns 适配器消息元素
18955
- */
19004
+ * 合并转发 karin -> adapter
19005
+ * @param elements 消息元素
19006
+ * @param options 首层小卡片外显参数
19007
+ * @returns 适配器消息元素
19008
+ */
18956
19009
  forwardKarinConvertAdapter(elements, options) {
18957
19010
  const messages = [];
18958
19011
  for (const elem of elements) {
@@ -23987,7 +24040,7 @@ var init_config4 = __esm({
23987
24040
  for (const item of list2) {
23988
24041
  if (item === npmName) return "npm";
23989
24042
  if (item === gitName) return "git";
23990
- if (item === rootName) return "npm";
24043
+ if (item === rootName) return "git";
23991
24044
  }
23992
24045
  return null;
23993
24046
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "1.14.1",
3
+ "version": "1.14.3",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",
@@ -159,7 +159,7 @@
159
159
  "yaml": "2.7.0"
160
160
  },
161
161
  "devDependencies": {
162
- "@karinjs/node-pty": "^1.1.0",
162
+ "@karinjs/node-pty": "^1.1.3",
163
163
  "@karinjs/plugin-webui-network-monitor": "^1.0.3",
164
164
  "@karinjs/plugins-list": "^1.7.0",
165
165
  "@types/express": "^5.0.3",