node-karin 0.12.8 → 0.12.9
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.
|
@@ -5,6 +5,8 @@ type FncElement = string | KarinElement | Array<KarinElement>;
|
|
|
5
5
|
type UseReceive = (e: KarinMessageType, next: Function, exit: Function) => Promise<void>;
|
|
6
6
|
type UseReply = (e: KarinMessageType, element: KarinElement[], next: Function, exit: Function) => Promise<void>;
|
|
7
7
|
type UseRecord = (uid: string, contact: Contact, elements: KarinElement[], next: Function, exit: Function) => Promise<void>;
|
|
8
|
+
type ForwardRecord = (contact: Contact, elements: KarinElement[], next: Function, exit: Function) => Promise<void>;
|
|
9
|
+
type NotFoundRecord = (e: KarinMessageType, next: Function, exit: Function) => Promise<void>;
|
|
8
10
|
/**
|
|
9
11
|
* 中间件类型
|
|
10
12
|
*/
|
|
@@ -14,7 +16,11 @@ export declare const enum MiddlewareType {
|
|
|
14
16
|
/** 回复消息前 */
|
|
15
17
|
ReplyMsg = "replyMsg",
|
|
16
18
|
/** 发送主动消息前 */
|
|
17
|
-
SendMsg = "sendMsg"
|
|
19
|
+
SendMsg = "sendMsg",
|
|
20
|
+
/** 发送合并转发前 */
|
|
21
|
+
ForwardMsg = "forwardMsg",
|
|
22
|
+
/** 消息事件没有找到任何匹配的插件触发 */
|
|
23
|
+
NotFoundMsg = "notFound"
|
|
18
24
|
}
|
|
19
25
|
export interface Options {
|
|
20
26
|
/**
|
|
@@ -181,6 +187,8 @@ export declare class Karin extends Listeners {
|
|
|
181
187
|
use(type: `${MiddlewareType.ReceiveMsg}`, fn: UseReceive, options?: Omit<Options, 'log'>): UseInfo;
|
|
182
188
|
use(type: `${MiddlewareType.ReplyMsg}`, fn: UseReply, options?: Omit<Options, 'log'>): UseInfo;
|
|
183
189
|
use(type: `${MiddlewareType.SendMsg}`, fn: UseRecord, options?: Omit<Options, 'log'>): UseInfo;
|
|
190
|
+
use(type: `${MiddlewareType.ForwardMsg}`, fn: ForwardRecord, options?: Omit<Options, 'log'>): UseInfo;
|
|
191
|
+
use(type: `${MiddlewareType.NotFoundMsg}`, fn: NotFoundRecord, options?: Omit<Options, 'log'>): UseInfo;
|
|
184
192
|
/**
|
|
185
193
|
* - 启动
|
|
186
194
|
*/
|
package/lib/core/karin/karin.js
CHANGED