node-karin 1.14.2 → 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 +7 -0
- package/dist/index.d.ts +47 -9
- package/dist/index.mjs +59 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
10
|
## [1.14.2](https://github.com/KarinJS/Karin/compare/core-v1.14.1...core-v1.14.2) (2026-01-30)
|
|
4
11
|
|
|
5
12
|
|
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
|
-
|
|
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
|
-
|
|
16787
|
-
|
|
16788
|
-
|
|
16789
|
-
|
|
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
|
|
@@ -18917,8 +18938,38 @@ var init_core = __esm({
|
|
|
18917
18938
|
await this._onebot.deleteEssenceMsg(+messageId);
|
|
18918
18939
|
}
|
|
18919
18940
|
}
|
|
18920
|
-
|
|
18921
|
-
|
|
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;
|
|
18922
18973
|
}
|
|
18923
18974
|
/**
|
|
18924
18975
|
* 设置好友请求结果
|
|
@@ -18950,11 +19001,11 @@ var init_core = __esm({
|
|
|
18950
19001
|
await this._onebot.setGroupAddRequest(requestId, "invite", isApprove);
|
|
18951
19002
|
}
|
|
18952
19003
|
/**
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
19004
|
+
* 合并转发 karin -> adapter
|
|
19005
|
+
* @param elements 消息元素
|
|
19006
|
+
* @param options 首层小卡片外显参数
|
|
19007
|
+
* @returns 适配器消息元素
|
|
19008
|
+
*/
|
|
18958
19009
|
forwardKarinConvertAdapter(elements, options) {
|
|
18959
19010
|
const messages = [];
|
|
18960
19011
|
for (const elem of elements) {
|