node-karin 1.3.18 → 1.3.19
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 +4 -2
- package/dist/index.js +53 -16
- package/dist/web/assets/index-B-8W3ik9.js +1 -0
- package/dist/web/assets/{index-Qf-xPnsA.css → index-D0BrE7YC.css} +1 -1
- package/dist/web/assets/{index-DF8S_xgW.js → index-Wy6xtsbt.js} +65 -65
- package/dist/web/assets/index-tbjWHMFL.js +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-DScKP-_C.js +0 -1
- package/dist/web/assets/index-tPsyyr3e.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [1.3.19](https://github.com/KarinJS/Karin/compare/core-v1.3.18...core-v1.3.19) (2025-02-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### 🐛 Bug Fixes
|
|
7
|
+
|
|
8
|
+
* hook ([3647bb2](https://github.com/KarinJS/Karin/commit/3647bb2db51d09a7ad94c33a78abb42455300abe))
|
|
9
|
+
|
|
3
10
|
## [1.3.18](https://github.com/KarinJS/Karin/compare/core-v1.3.17...core-v1.3.18) (2025-02-24)
|
|
4
11
|
|
|
5
12
|
|
package/dist/index.d.ts
CHANGED
|
@@ -11212,8 +11212,9 @@ interface MessageHookItem<T extends UnionMessage> {
|
|
|
11212
11212
|
* @param contact 联系人
|
|
11213
11213
|
* @param elements 消息元素
|
|
11214
11214
|
* @param retryCount 重试次数
|
|
11215
|
+
* @param next 继续执行下一个钩子的函数
|
|
11215
11216
|
*/
|
|
11216
|
-
type BaseMessageCallback<T> = (contact: Contact, elements: Array<Elements>, retryCount
|
|
11217
|
+
type BaseMessageCallback<T> = (contact: Contact, elements: Array<Elements>, retryCount: number, next: HookNext) => T | Promise<T>;
|
|
11217
11218
|
/**
|
|
11218
11219
|
* 接收普通消息发送回调类型 这个由开发者调用
|
|
11219
11220
|
*/
|
|
@@ -11227,8 +11228,9 @@ type HookEmitMessage = BaseMessageCallback<boolean>;
|
|
|
11227
11228
|
* @param contact 联系人
|
|
11228
11229
|
* @param elements 消息元素
|
|
11229
11230
|
* @param options 转发选项
|
|
11231
|
+
* @param next 继续执行下一个钩子的函数
|
|
11230
11232
|
*/
|
|
11231
|
-
type BaseForwardCallback<T> = (contact: Contact, elements: Array<NodeElement>, options
|
|
11233
|
+
type BaseForwardCallback<T> = (contact: Contact, elements: Array<NodeElement>, options: ForwardOptions | undefined, next: HookNext) => T | Promise<T>;
|
|
11232
11234
|
/**
|
|
11233
11235
|
* 接收转发消息回调类型 这个由开发者调用
|
|
11234
11236
|
*/
|
package/dist/index.js
CHANGED
|
@@ -5686,13 +5686,17 @@ var init_sendMsg = __esm({
|
|
|
5686
5686
|
}
|
|
5687
5687
|
};
|
|
5688
5688
|
emitHooks = async (hooks2, callback) => {
|
|
5689
|
-
|
|
5689
|
+
let shouldContinue = false;
|
|
5690
5690
|
for (const hook of hooks2) {
|
|
5691
|
-
const
|
|
5691
|
+
const next = () => {
|
|
5692
|
+
shouldContinue = true;
|
|
5693
|
+
};
|
|
5694
|
+
const result = callback(hook, next);
|
|
5692
5695
|
if (isPromise(result)) await result;
|
|
5693
|
-
if (!
|
|
5696
|
+
if (!shouldContinue) return false;
|
|
5697
|
+
shouldContinue = false;
|
|
5694
5698
|
}
|
|
5695
|
-
return
|
|
5699
|
+
return true;
|
|
5696
5700
|
};
|
|
5697
5701
|
hooksSendMsgEmit = {
|
|
5698
5702
|
/**
|
|
@@ -5702,10 +5706,10 @@ var init_sendMsg = __esm({
|
|
|
5702
5706
|
* @param retryCount 重试次数
|
|
5703
5707
|
* @returns 是否继续正常流程
|
|
5704
5708
|
*/
|
|
5705
|
-
message: async (contact3, elements, retryCount) => {
|
|
5709
|
+
message: async (contact3, elements, retryCount = 0) => {
|
|
5706
5710
|
return emitHooks(
|
|
5707
5711
|
cache10.sendMsg.message,
|
|
5708
|
-
(hook) => hook.callback(contact3, elements, retryCount)
|
|
5712
|
+
(hook, next) => hook.callback(contact3, elements, retryCount, next)
|
|
5709
5713
|
);
|
|
5710
5714
|
},
|
|
5711
5715
|
/**
|
|
@@ -5718,7 +5722,7 @@ var init_sendMsg = __esm({
|
|
|
5718
5722
|
forward: async (contact3, elements, options) => {
|
|
5719
5723
|
return emitHooks(
|
|
5720
5724
|
cache10.sendMsg.forward,
|
|
5721
|
-
(hook) => hook.callback(contact3, elements, options)
|
|
5725
|
+
(hook, next) => hook.callback(contact3, elements, options, next)
|
|
5722
5726
|
);
|
|
5723
5727
|
}
|
|
5724
5728
|
};
|
|
@@ -7798,8 +7802,9 @@ var init_messaeg = __esm({
|
|
|
7798
7802
|
});
|
|
7799
7803
|
if (isPromise2(result)) await result;
|
|
7800
7804
|
if (!isNext) return false;
|
|
7805
|
+
isNext = false;
|
|
7801
7806
|
}
|
|
7802
|
-
return
|
|
7807
|
+
return true;
|
|
7803
7808
|
};
|
|
7804
7809
|
hooksMessageEmit = {
|
|
7805
7810
|
/**
|
|
@@ -7931,8 +7936,16 @@ var init_groups4 = __esm({
|
|
|
7931
7936
|
initAlias(ctx3, group.alias);
|
|
7932
7937
|
initEmit(ctx3);
|
|
7933
7938
|
initPrint2(ctx3, "group", "\u7FA4\u6D88\u606F", isPrint ? "info" : "debug");
|
|
7934
|
-
hooksMessageEmit.group(ctx3);
|
|
7935
|
-
|
|
7939
|
+
const hook = await hooksMessageEmit.group(ctx3);
|
|
7940
|
+
if (!hook) {
|
|
7941
|
+
logger.debug(`[${ctx3.logFnc}] \u7FA4\u6D88\u606F\u94A9\u5B50\u8FD4\u56DEfalse \u8DF3\u8FC7\u5F53\u524D\u4E8B\u4EF6: ${ctx3.eventId}`);
|
|
7942
|
+
return;
|
|
7943
|
+
}
|
|
7944
|
+
const hook2 = await hooksMessageEmit.message(ctx3);
|
|
7945
|
+
if (!hook2) {
|
|
7946
|
+
logger.debug(`[${ctx3.logFnc}] \u6D88\u606F\u94A9\u5B50\u8FD4\u56DEfalse \u8DF3\u8FC7\u5F53\u524D\u4E8B\u4EF6: ${ctx3.eventId}`);
|
|
7947
|
+
return;
|
|
7948
|
+
}
|
|
7936
7949
|
const context2 = context(ctx3);
|
|
7937
7950
|
if (context2) return ctx3;
|
|
7938
7951
|
const cd = groupsCD(group, ctx3.groupId, ctx3.userId);
|
|
@@ -7960,8 +7973,16 @@ var init_groups4 = __esm({
|
|
|
7960
7973
|
initAlias(ctx3, group.alias);
|
|
7961
7974
|
initEmit(ctx3);
|
|
7962
7975
|
initPrint2(ctx3, "groupTemp", "\u7FA4\u4E34\u65F6\u6D88\u606F");
|
|
7963
|
-
hooksMessageEmit.groupTemp(ctx3);
|
|
7964
|
-
|
|
7976
|
+
const hook = await hooksMessageEmit.groupTemp(ctx3);
|
|
7977
|
+
if (!hook) {
|
|
7978
|
+
logger.debug(`[${ctx3.logFnc}] \u7FA4\u4E34\u65F6\u6D88\u606F\u94A9\u5B50\u8FD4\u56DEfalse \u8DF3\u8FC7\u5F53\u524D\u4E8B\u4EF6: ${ctx3.eventId}`);
|
|
7979
|
+
return;
|
|
7980
|
+
}
|
|
7981
|
+
const hook2 = await hooksMessageEmit.message(ctx3);
|
|
7982
|
+
if (!hook2) {
|
|
7983
|
+
logger.debug(`[${ctx3.logFnc}] \u6D88\u606F\u94A9\u5B50\u8FD4\u56DEfalse \u8DF3\u8FC7\u5F53\u524D\u4E8B\u4EF6: ${ctx3.eventId}`);
|
|
7984
|
+
return;
|
|
7985
|
+
}
|
|
7965
7986
|
const context2 = context(ctx3);
|
|
7966
7987
|
if (context2) return ctx3;
|
|
7967
7988
|
const cd = groupsCD(group, ctx3.groupId, ctx3.userId);
|
|
@@ -8091,8 +8112,16 @@ var init_private3 = __esm({
|
|
|
8091
8112
|
initAlias(ctx3, friend.alias);
|
|
8092
8113
|
initEmit(ctx3);
|
|
8093
8114
|
initPrint3(ctx3, "friend", "\u597D\u53CB\u6D88\u606F");
|
|
8094
|
-
hooksMessageEmit.friend(ctx3);
|
|
8095
|
-
|
|
8115
|
+
const hook = await hooksMessageEmit.friend(ctx3);
|
|
8116
|
+
if (!hook) {
|
|
8117
|
+
logger.debug(`[${ctx3.logFnc}] \u597D\u53CB\u6D88\u606F\u94A9\u5B50\u8FD4\u56DEfalse \u8DF3\u8FC7\u5F53\u524D\u4E8B\u4EF6: ${ctx3.eventId}`);
|
|
8118
|
+
return;
|
|
8119
|
+
}
|
|
8120
|
+
const hook2 = await hooksMessageEmit.message(ctx3);
|
|
8121
|
+
if (!hook2) {
|
|
8122
|
+
logger.debug(`[${ctx3.logFnc}] \u6D88\u606F\u94A9\u5B50\u8FD4\u56DEfalse \u8DF3\u8FC7\u5F53\u524D\u4E8B\u4EF6: ${ctx3.eventId}`);
|
|
8123
|
+
return;
|
|
8124
|
+
}
|
|
8096
8125
|
const context2 = context(ctx3);
|
|
8097
8126
|
if (context2) return ctx3;
|
|
8098
8127
|
const filter = privateFilterEvent(ctx3, config2, friend, privateCD(friend, ctx3.userId));
|
|
@@ -8112,8 +8141,16 @@ var init_private3 = __esm({
|
|
|
8112
8141
|
initAlias(ctx3, friend.alias);
|
|
8113
8142
|
initEmit(ctx3);
|
|
8114
8143
|
initPrint3(ctx3, "direct", "\u9891\u9053\u79C1\u4FE1");
|
|
8115
|
-
hooksMessageEmit.direct(ctx3);
|
|
8116
|
-
|
|
8144
|
+
const hook = await hooksMessageEmit.direct(ctx3);
|
|
8145
|
+
if (!hook) {
|
|
8146
|
+
logger.debug(`[${ctx3.logFnc}] \u9891\u9053\u79C1\u4FE1\u6D88\u606F\u94A9\u5B50\u8FD4\u56DEfalse \u8DF3\u8FC7\u5F53\u524D\u4E8B\u4EF6: ${ctx3.eventId}`);
|
|
8147
|
+
return;
|
|
8148
|
+
}
|
|
8149
|
+
const hook2 = await hooksMessageEmit.message(ctx3);
|
|
8150
|
+
if (!hook2) {
|
|
8151
|
+
logger.debug(`[${ctx3.logFnc}] \u6D88\u606F\u94A9\u5B50\u8FD4\u56DEfalse \u8DF3\u8FC7\u5F53\u524D\u4E8B\u4EF6: ${ctx3.eventId}`);
|
|
8152
|
+
return;
|
|
8153
|
+
}
|
|
8117
8154
|
const context2 = context(ctx3);
|
|
8118
8155
|
if (context2) return ctx3;
|
|
8119
8156
|
const cd = privateCD(friend, ctx3.userId);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as a}from"./index-Wy6xtsbt.js";var r=a;export{r as default};
|