node-karin 0.12.16 → 0.12.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/lib/adapter/input/index.d.ts +1 -3
- package/lib/adapter/input/index.js +2 -4
- package/lib/adapter/onebot/11/event.d.ts +3 -9
- package/lib/adapter/onebot/11/event.js +7 -13
- package/lib/adapter/onebot/11/index.d.ts +21 -58
- package/lib/adapter/onebot/11/index.js +22 -59
- package/lib/cli/index.d.ts +5 -15
- package/lib/cli/index.js +6 -16
- package/lib/core/karin/karin.d.ts +10 -4
- package/lib/core/karin/karin.js +7 -3
- package/lib/core/listener/listener.d.ts +5 -15
- package/lib/core/listener/listener.js +5 -13
- package/lib/core/plugin/loader.d.ts +10 -16
- package/lib/core/plugin/loader.js +20 -15
- package/lib/core/server/server.d.ts +3 -9
- package/lib/core/server/server.js +3 -9
- package/lib/event/handler/base.d.ts +13 -24
- package/lib/event/handler/base.js +25 -24
- package/lib/event/handler/message.d.ts +8 -24
- package/lib/event/handler/message.js +11 -24
- package/lib/event/handler/notice.d.ts +3 -9
- package/lib/event/handler/notice.js +6 -9
- package/lib/event/handler/request.d.ts +3 -9
- package/lib/event/handler/request.js +6 -9
- package/lib/event/handler/review.d.ts +7 -21
- package/lib/event/handler/review.js +7 -21
- package/lib/types/adapter/base.d.ts +21 -63
- package/lib/types/config/config.d.ts +65 -195
- package/lib/types/event/contact.d.ts +5 -9
- package/lib/types/event/event.d.ts +15 -30
- package/lib/types/event/message.d.ts +6 -15
- package/lib/types/event/message.js +2 -0
- package/lib/types/event/notice.d.ts +1 -0
- package/lib/types/event/notice.js +2 -0
- package/lib/types/event/request.d.ts +1 -0
- package/lib/types/event/request.js +2 -0
- package/lib/types/plugin/app.d.ts +13 -15
- package/lib/types/plugin/plugin.d.ts +22 -39
- package/package.json +1 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 事件来源枚举
|
|
3
|
-
*/
|
|
1
|
+
/** 事件来源枚举 */
|
|
4
2
|
export declare const enum Scene {
|
|
5
3
|
/** 群 */
|
|
6
4
|
Group = "group",
|
|
@@ -17,14 +15,12 @@ export declare const enum Scene {
|
|
|
17
15
|
/** 临时群会话 */
|
|
18
16
|
StrangerFromGroup = "stranger_from_group"
|
|
19
17
|
}
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
export interface Contact {
|
|
18
|
+
/** 事件联系人信息 也就是从哪来的这条消息 */
|
|
19
|
+
export interface Contact<T extends `${Scene}` = `${Scene}`> {
|
|
24
20
|
/** 事件来源场景 */
|
|
25
|
-
scene:
|
|
21
|
+
scene: T;
|
|
26
22
|
/** 事件来源id 群号或者用户id */
|
|
27
23
|
peer: string;
|
|
28
24
|
/** 事件来源子id 仅在频道和临时会话中存在 */
|
|
29
|
-
sub_peer
|
|
25
|
+
sub_peer: T extends Scene.Guild | Scene.Nearby ? string : null;
|
|
30
26
|
}
|
|
@@ -2,9 +2,7 @@ import { Sender } from './sender.js';
|
|
|
2
2
|
import { Contact } from './contact.js';
|
|
3
3
|
import { KarinAdapter } from '../../types/index.js';
|
|
4
4
|
import { Reply, replyCallback } from './reply.js';
|
|
5
|
-
/**
|
|
6
|
-
* 事件类型枚举
|
|
7
|
-
*/
|
|
5
|
+
/** 事件类型枚举 */
|
|
8
6
|
export declare const enum EventType {
|
|
9
7
|
/** 消息事件 */
|
|
10
8
|
Message = "message",
|
|
@@ -13,9 +11,7 @@ export declare const enum EventType {
|
|
|
13
11
|
/** 请求事件 */
|
|
14
12
|
Request = "request"
|
|
15
13
|
}
|
|
16
|
-
/**
|
|
17
|
-
* 消息事件子类型枚举
|
|
18
|
-
*/
|
|
14
|
+
/** 消息事件子类型枚举 */
|
|
19
15
|
export declare const enum MessageSubType {
|
|
20
16
|
/** 群消息 */
|
|
21
17
|
GroupMessage = "group_message",
|
|
@@ -30,9 +26,7 @@ export declare const enum MessageSubType {
|
|
|
30
26
|
/** 陌生人消息 */
|
|
31
27
|
Stranger = "stranger"
|
|
32
28
|
}
|
|
33
|
-
/**
|
|
34
|
-
* 通知事件子类型枚举
|
|
35
|
-
*/
|
|
29
|
+
/** 通知事件子类型枚举 */
|
|
36
30
|
export declare const enum NoticeSubType {
|
|
37
31
|
/** 私聊戳一戳 */
|
|
38
32
|
PrivatePoke = "private_poke",
|
|
@@ -69,9 +63,7 @@ export declare const enum NoticeSubType {
|
|
|
69
63
|
/** 好友增加 */
|
|
70
64
|
FriendIncrease = "friend_increase"
|
|
71
65
|
}
|
|
72
|
-
/**
|
|
73
|
-
* 请求事件子类型枚举
|
|
74
|
-
*/
|
|
66
|
+
/** 请求事件子类型枚举 */
|
|
75
67
|
export declare const enum RequestSubType {
|
|
76
68
|
/** 好友申请 */
|
|
77
69
|
PrivateApply = "private_apply",
|
|
@@ -86,29 +78,17 @@ export type EventToSubEvent = {
|
|
|
86
78
|
[EventType.Notice]: NoticeSubType;
|
|
87
79
|
[EventType.Request]: RequestSubType;
|
|
88
80
|
};
|
|
89
|
-
/**
|
|
90
|
-
* 所有消息事件类型
|
|
91
|
-
*/
|
|
81
|
+
/** 所有消息事件类型 */
|
|
92
82
|
export type AllMessageSubType = `${EventType.Message}` | `${EventType.Message}.${MessageSubType}`;
|
|
93
|
-
/**
|
|
94
|
-
* 所有通知事件类型
|
|
95
|
-
*/
|
|
83
|
+
/** 所有通知事件类型 */
|
|
96
84
|
export type AllNoticeSubType = `${EventType.Notice}` | `${EventType.Notice}.${NoticeSubType}`;
|
|
97
|
-
/**
|
|
98
|
-
* 所有请求事件类型
|
|
99
|
-
*/
|
|
85
|
+
/** 所有请求事件类型 */
|
|
100
86
|
export type AllRequestSubType = `${EventType.Request}` | `${EventType.Request}.${RequestSubType}`;
|
|
101
|
-
/**
|
|
102
|
-
* 所有组合事件类型
|
|
103
|
-
*/
|
|
87
|
+
/** 所有组合事件类型 */
|
|
104
88
|
export type CombinedEventType = AllMessageSubType | AllNoticeSubType | AllRequestSubType;
|
|
105
|
-
/**
|
|
106
|
-
* 所有监听事件
|
|
107
|
-
*/
|
|
89
|
+
/** 所有监听事件 */
|
|
108
90
|
export type AllListenEvent = `${EventType}` | `${CombinedEventType}`;
|
|
109
|
-
/**
|
|
110
|
-
* 事件基类定义
|
|
111
|
-
*/
|
|
91
|
+
/** 事件基类定义 */
|
|
112
92
|
export interface KarinEventType {
|
|
113
93
|
/** 机器人ID 请尽量使用UID */
|
|
114
94
|
self_id: string;
|
|
@@ -161,6 +141,11 @@ export interface KarinEventType {
|
|
|
161
141
|
* @default false
|
|
162
142
|
*/
|
|
163
143
|
isGroupTemp: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* - 是否为频道私信
|
|
146
|
+
* @default false
|
|
147
|
+
*/
|
|
148
|
+
isDirect: boolean;
|
|
164
149
|
/** 日志函数字符串 */
|
|
165
150
|
logFnc: string;
|
|
166
151
|
/** 日志用户字符串 */
|
|
@@ -14,30 +14,20 @@ export interface KarinMessageType extends KarinEventType {
|
|
|
14
14
|
elements: Array<KarinElement>;
|
|
15
15
|
/** 群ID */
|
|
16
16
|
group_id: string;
|
|
17
|
-
/**
|
|
18
|
-
* 经过处理后的消息
|
|
19
|
-
*/
|
|
17
|
+
/** 经过处理后的消息 */
|
|
20
18
|
msg: string;
|
|
21
19
|
/** 消息图片 */
|
|
22
20
|
image: string[];
|
|
23
21
|
/** 语音url */
|
|
24
22
|
record: string;
|
|
25
23
|
file: any;
|
|
26
|
-
/**
|
|
27
|
-
* 是否atBot
|
|
28
|
-
*/
|
|
24
|
+
/** 是否atBot */
|
|
29
25
|
atBot: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* 是否atAll
|
|
32
|
-
*/
|
|
26
|
+
/** 是否atAll */
|
|
33
27
|
atAll: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* at的用户列表 不会出现Bot自身的at
|
|
36
|
-
*/
|
|
28
|
+
/** at的用户列表 不会出现Bot自身的at */
|
|
37
29
|
at: string[];
|
|
38
|
-
/**
|
|
39
|
-
* 引用回复的消息id
|
|
40
|
-
*/
|
|
30
|
+
/** 引用回复的消息id */
|
|
41
31
|
reply_id: string;
|
|
42
32
|
/** bot别名 */
|
|
43
33
|
alias: string;
|
|
@@ -79,6 +69,7 @@ export declare class KarinMessage implements KarinMessageType {
|
|
|
79
69
|
at: KarinMessageType['at'];
|
|
80
70
|
reply_id: KarinMessageType['reply_id'];
|
|
81
71
|
alias: KarinMessageType['alias'];
|
|
72
|
+
isDirect: KarinMessageType['isDirect'];
|
|
82
73
|
constructor({ event, self_id: selfId, user_id: userId, group_id: groupId, time, contact, sender, sub_event: subEvent, event_id: eventId, message_id: messageId, message_seq: messageSeq, elements, raw_event: rawEvent, }: BaseEventDataType & {
|
|
83
74
|
event: KarinMessageType['event'];
|
|
84
75
|
sub_event: KarinMessageType['sub_event'];
|
|
@@ -35,6 +35,7 @@ export class KarinMessage {
|
|
|
35
35
|
at;
|
|
36
36
|
reply_id;
|
|
37
37
|
alias;
|
|
38
|
+
isDirect;
|
|
38
39
|
constructor({ event, self_id: selfId, user_id: userId, group_id: groupId = '', time, contact, sender, sub_event: subEvent, event_id: eventId, message_id: messageId, message_seq: messageSeq, elements, raw_event: rawEvent, }) {
|
|
39
40
|
this.self_id = selfId;
|
|
40
41
|
this.user_id = userId;
|
|
@@ -55,6 +56,7 @@ export class KarinMessage {
|
|
|
55
56
|
this.isGroup = false;
|
|
56
57
|
this.isGuild = false;
|
|
57
58
|
this.isGroupTemp = false;
|
|
59
|
+
this.isDirect = false;
|
|
58
60
|
this.logFnc = '';
|
|
59
61
|
this.logText = '';
|
|
60
62
|
this.store = new Map();
|
|
@@ -290,6 +290,7 @@ export declare class KarinNotice implements KarinNoticeEventBase {
|
|
|
290
290
|
isGroup: KarinNoticeType['isGroup'];
|
|
291
291
|
isGuild: KarinNoticeType['isGuild'];
|
|
292
292
|
isGroupTemp: KarinNoticeType['isGroupTemp'];
|
|
293
|
+
isDirect: KarinNoticeType['isDirect'];
|
|
293
294
|
logFnc: KarinNoticeType['logFnc'];
|
|
294
295
|
logText: KarinNoticeType['logText'];
|
|
295
296
|
store: KarinNoticeType['store'];
|
|
@@ -15,6 +15,7 @@ export class KarinNotice {
|
|
|
15
15
|
isGroup;
|
|
16
16
|
isGuild;
|
|
17
17
|
isGroupTemp;
|
|
18
|
+
isDirect;
|
|
18
19
|
logFnc;
|
|
19
20
|
logText;
|
|
20
21
|
store;
|
|
@@ -41,6 +42,7 @@ export class KarinNotice {
|
|
|
41
42
|
this.isGroup = false;
|
|
42
43
|
this.isGuild = false;
|
|
43
44
|
this.isGroupTemp = false;
|
|
45
|
+
this.isDirect = false;
|
|
44
46
|
this.logFnc = '';
|
|
45
47
|
this.logText = '';
|
|
46
48
|
this.store = new Map();
|
|
@@ -72,6 +72,7 @@ export declare class KarinRequest implements KarinRequestEventBase {
|
|
|
72
72
|
isGroup: KarinRequestType['isGroup'];
|
|
73
73
|
isGuild: KarinRequestType['isGuild'];
|
|
74
74
|
isGroupTemp: KarinRequestType['isGroupTemp'];
|
|
75
|
+
isDirect: KarinRequestType['isDirect'];
|
|
75
76
|
logFnc: KarinRequestType['logFnc'];
|
|
76
77
|
logText: KarinRequestType['logText'];
|
|
77
78
|
store: KarinRequestType['store'];
|
|
@@ -15,6 +15,7 @@ export class KarinRequest {
|
|
|
15
15
|
isGroup;
|
|
16
16
|
isGuild;
|
|
17
17
|
isGroupTemp;
|
|
18
|
+
isDirect;
|
|
18
19
|
logFnc;
|
|
19
20
|
logText;
|
|
20
21
|
store;
|
|
@@ -42,6 +43,7 @@ export class KarinRequest {
|
|
|
42
43
|
this.isGroup = false;
|
|
43
44
|
this.isGuild = false;
|
|
44
45
|
this.isGroupTemp = false;
|
|
46
|
+
this.isDirect = false;
|
|
45
47
|
this.logFnc = '';
|
|
46
48
|
this.logText = '';
|
|
47
49
|
this.store = new Map();
|
|
@@ -33,6 +33,10 @@ export interface CommandInfo extends AppBase {
|
|
|
33
33
|
perm: `${Permission}`;
|
|
34
34
|
/** class */
|
|
35
35
|
data: NewMessagePlugin | '';
|
|
36
|
+
/** 只有对应的适配器才会生效 */
|
|
37
|
+
adapter: Array<KarinAdapter['adapter']['name']>;
|
|
38
|
+
/** 指定的适配器无效 */
|
|
39
|
+
notAdapter: Array<KarinAdapter['adapter']['name']>;
|
|
36
40
|
}
|
|
37
41
|
/** task规则集类型 */
|
|
38
42
|
export interface TaskInfo extends Omit<AppBase, 'rank'> {
|
|
@@ -75,10 +79,12 @@ export interface AcceptInfo extends AppBase {
|
|
|
75
79
|
type: `${AppType.Accept}`;
|
|
76
80
|
/** 监听事件 */
|
|
77
81
|
event: `${AllNoticeSubType}` | `${AllRequestSubType}`;
|
|
82
|
+
/** 只有对应的适配器才会生效 */
|
|
83
|
+
adapter: Array<KarinAdapter['adapter']['name']>;
|
|
84
|
+
/** 指定的适配器无效 */
|
|
85
|
+
notAdapter: Array<KarinAdapter['adapter']['name']>;
|
|
78
86
|
}
|
|
79
|
-
/**
|
|
80
|
-
* 初始化消息前 中间件实现方法
|
|
81
|
-
*/
|
|
87
|
+
/** 初始化消息前 中间件实现方法 */
|
|
82
88
|
export type UseRecvMsgFn = (
|
|
83
89
|
/** 消息事件方法 */
|
|
84
90
|
e: KarinMessageType,
|
|
@@ -86,9 +92,7 @@ e: KarinMessageType,
|
|
|
86
92
|
next: () => void,
|
|
87
93
|
/** 是否退出此条消息 不再执行匹配插件 */
|
|
88
94
|
exit: () => void) => Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* 回复消息前 中间件实现方法
|
|
91
|
-
*/
|
|
95
|
+
/** 回复消息前 中间件实现方法 */
|
|
92
96
|
export type UseSendMsgFn = (
|
|
93
97
|
/** 消息事件方法 */
|
|
94
98
|
e: KarinMessageType,
|
|
@@ -98,9 +102,7 @@ element: KarinElement[],
|
|
|
98
102
|
next: () => void,
|
|
99
103
|
/** 是否不发送此条消息 */
|
|
100
104
|
exit: () => void) => Promise<void>;
|
|
101
|
-
/**
|
|
102
|
-
* 发送主动消息前 中间件实现方法
|
|
103
|
-
*/
|
|
105
|
+
/** 发送主动消息前 中间件实现方法 */
|
|
104
106
|
export type UseSendNoticeFn = (
|
|
105
107
|
/** 发送的bot */
|
|
106
108
|
uid: string,
|
|
@@ -112,9 +114,7 @@ element: KarinElement[],
|
|
|
112
114
|
next: () => void,
|
|
113
115
|
/** 是否不发送此条消息 */
|
|
114
116
|
exit: () => void) => Promise<void>;
|
|
115
|
-
/**
|
|
116
|
-
* 发送合并转发前 中间件实现方法
|
|
117
|
-
*/
|
|
117
|
+
/** 发送合并转发前 中间件实现方法 */
|
|
118
118
|
export type UseForwardMsgFn = (bot: KarinAdapter,
|
|
119
119
|
/** 发送的目标信息 */
|
|
120
120
|
contact: Contact,
|
|
@@ -124,9 +124,7 @@ elements: Array<NodeElement>,
|
|
|
124
124
|
next: () => void,
|
|
125
125
|
/** 是否不发送此条消息 */
|
|
126
126
|
exit: () => void) => Promise<void>;
|
|
127
|
-
/**
|
|
128
|
-
* 消息事件没有找到任何匹配的插件触发 中间件实现方法
|
|
129
|
-
*/
|
|
127
|
+
/** 消息事件没有找到任何匹配的插件触发 中间件实现方法 */
|
|
130
128
|
export type UseNotFoundMsgFn = (
|
|
131
129
|
/** 消息事件方法 */
|
|
132
130
|
e: KarinMessageType,
|
|
@@ -2,6 +2,7 @@ import schedule from 'node-schedule';
|
|
|
2
2
|
import { Reply, replyCallback, replyForward } from '../event/reply.js';
|
|
3
3
|
import { KarinNoticeType, KarinRequestType, AllListenEvent, KarinMessageType, AllMessageSubType, Permission } from '../event/index.js';
|
|
4
4
|
import { AcceptInfo, ButtonInfo, CommandInfo, HandlerInfo, Plugin, UseForwardMsgFn, UseInfo, UseNotFoundMsgFn, UseRecvMsgFn, UseSendMsgFn, UseSendNoticeFn } from '../../core/index.js';
|
|
5
|
+
import { KarinAdapter } from '../adapter/base.js';
|
|
5
6
|
/**
|
|
6
7
|
* - 插件根目录名称
|
|
7
8
|
* - 例如: karin-plugin-example
|
|
@@ -15,9 +16,7 @@ export type dirName = `karin-plugin-${string}` | string;
|
|
|
15
16
|
* - 例如: index.js index.ts
|
|
16
17
|
*/
|
|
17
18
|
export type fileName = `${string}.js` | `${string}.ts`;
|
|
18
|
-
/**
|
|
19
|
-
* 插件类型枚举
|
|
20
|
-
*/
|
|
19
|
+
/** 插件类型枚举 */
|
|
21
20
|
export declare const enum AppsType {
|
|
22
21
|
/** git插件 */
|
|
23
22
|
Git = "git",
|
|
@@ -26,18 +25,14 @@ export declare const enum AppsType {
|
|
|
26
25
|
/** 单个app插件 */
|
|
27
26
|
Js = "js"
|
|
28
27
|
}
|
|
29
|
-
/**
|
|
30
|
-
* 插件实现方法类型
|
|
31
|
-
*/
|
|
28
|
+
/** 插件实现方法类型 */
|
|
32
29
|
export declare const enum MethodType {
|
|
33
30
|
/** 函数 */
|
|
34
31
|
Function = "function",
|
|
35
32
|
/** 类 */
|
|
36
33
|
Class = "class"
|
|
37
34
|
}
|
|
38
|
-
/**
|
|
39
|
-
* plugin基本信息
|
|
40
|
-
*/
|
|
35
|
+
/** plugin基本信息 */
|
|
41
36
|
export interface PluginInfoType {
|
|
42
37
|
/** 插件包类型 */
|
|
43
38
|
type: `${AppsType}`;
|
|
@@ -48,9 +43,7 @@ export interface PluginInfoType {
|
|
|
48
43
|
/** 插件文件名称 index.js index.ts */
|
|
49
44
|
file: string;
|
|
50
45
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Command规则集信息
|
|
53
|
-
*/
|
|
46
|
+
/** Command规则集信息 */
|
|
54
47
|
export interface PluginCommandInfoType {
|
|
55
48
|
/** 插件基本信息的映射key */
|
|
56
49
|
key: number;
|
|
@@ -74,10 +67,12 @@ export interface PluginCommandInfoType {
|
|
|
74
67
|
event: CommandInfo['event'];
|
|
75
68
|
/** 优先级 */
|
|
76
69
|
rank: CommandInfo['rank'];
|
|
70
|
+
/** 只有对应的适配器才会生效 */
|
|
71
|
+
adapter: Array<KarinAdapter['adapter']['name']>;
|
|
72
|
+
/** 指定的适配器无效 */
|
|
73
|
+
notAdapter: Array<KarinAdapter['adapter']['name']>;
|
|
77
74
|
}
|
|
78
|
-
/**
|
|
79
|
-
* accept规则集信息
|
|
80
|
-
*/
|
|
75
|
+
/** accept规则集信息 */
|
|
81
76
|
export interface PluginAcceptInfoType {
|
|
82
77
|
/** 插件基本信息的映射key */
|
|
83
78
|
key: number;
|
|
@@ -91,10 +86,12 @@ export interface PluginAcceptInfoType {
|
|
|
91
86
|
event: AcceptInfo['event'];
|
|
92
87
|
/** 执行打印日志方法 */
|
|
93
88
|
log: AcceptInfo['log'];
|
|
89
|
+
/** 只有对应的适配器才会生效 */
|
|
90
|
+
adapter: Array<KarinAdapter['adapter']['name']>;
|
|
91
|
+
/** 指定的适配器无效 */
|
|
92
|
+
notAdapter: Array<KarinAdapter['adapter']['name']>;
|
|
94
93
|
}
|
|
95
|
-
/**
|
|
96
|
-
* task规则集信息
|
|
97
|
-
*/
|
|
94
|
+
/** task规则集信息 */
|
|
98
95
|
export interface PluginTaskInfoType {
|
|
99
96
|
/** 插件基本信息的映射key */
|
|
100
97
|
key: number;
|
|
@@ -113,9 +110,7 @@ export interface PluginTaskInfoType {
|
|
|
113
110
|
/** 停止函数 */
|
|
114
111
|
schedule: schedule.Job;
|
|
115
112
|
}
|
|
116
|
-
/**
|
|
117
|
-
* button规则集信息
|
|
118
|
-
*/
|
|
113
|
+
/** button规则集信息 */
|
|
119
114
|
export interface PluginButtonInfoType {
|
|
120
115
|
/** 插件基本信息的映射key */
|
|
121
116
|
key: number;
|
|
@@ -128,9 +123,7 @@ export interface PluginButtonInfoType {
|
|
|
128
123
|
/** 优先级 */
|
|
129
124
|
rank: ButtonInfo['rank'];
|
|
130
125
|
}
|
|
131
|
-
/**
|
|
132
|
-
* handler规则集信息
|
|
133
|
-
*/
|
|
126
|
+
/** handler规则集信息 */
|
|
134
127
|
export interface PluginHandlerInfoType {
|
|
135
128
|
/** 插件基本信息的映射key */
|
|
136
129
|
key: number;
|
|
@@ -151,9 +144,7 @@ export interface UseBase<T> {
|
|
|
151
144
|
/** 优先级 */
|
|
152
145
|
rank: UseInfo['rank'];
|
|
153
146
|
}
|
|
154
|
-
/**
|
|
155
|
-
* 中间件类型
|
|
156
|
-
*/
|
|
147
|
+
/** 中间件类型 */
|
|
157
148
|
export declare const enum UseKeyType {
|
|
158
149
|
/** 收到消息后 */
|
|
159
150
|
ReceiveMsg = "recvMsg",
|
|
@@ -166,9 +157,7 @@ export declare const enum UseKeyType {
|
|
|
166
157
|
/** 消息事件没有找到任何匹配的插件触发 */
|
|
167
158
|
NotFoundMsg = "notFoundMsg"
|
|
168
159
|
}
|
|
169
|
-
/**
|
|
170
|
-
* 中间件映射
|
|
171
|
-
*/
|
|
160
|
+
/** 中间件映射 */
|
|
172
161
|
export interface UseMapType {
|
|
173
162
|
[UseKeyType.ReceiveMsg]: Array<UseBase<UseRecvMsgFn>>;
|
|
174
163
|
[UseKeyType.ReplyMsg]: Array<UseBase<UseSendMsgFn>>;
|
|
@@ -176,9 +165,7 @@ export interface UseMapType {
|
|
|
176
165
|
[UseKeyType.ForwardMsg]: Array<UseBase<UseForwardMsgFn>>;
|
|
177
166
|
[UseKeyType.NotFoundMsg]: Array<UseBase<UseNotFoundMsgFn>>;
|
|
178
167
|
}
|
|
179
|
-
/**
|
|
180
|
-
* 上下文状态
|
|
181
|
-
*/
|
|
168
|
+
/** 上下文状态 */
|
|
182
169
|
export interface stateArrType {
|
|
183
170
|
[key: string]: {
|
|
184
171
|
type: 'fnc';
|
|
@@ -201,9 +188,7 @@ export interface PluginRule {
|
|
|
201
188
|
event?: AllMessageSubType;
|
|
202
189
|
/** 优先级 默认为10000 */
|
|
203
190
|
priority?: number;
|
|
204
|
-
/**
|
|
205
|
-
* 权限
|
|
206
|
-
*/
|
|
191
|
+
/** 权限 */
|
|
207
192
|
permission?: `${Permission}`;
|
|
208
193
|
/** 打印日志 默认为true */
|
|
209
194
|
log?: boolean | Function;
|
|
@@ -329,7 +314,5 @@ export interface PluginApps {
|
|
|
329
314
|
/** handler */
|
|
330
315
|
handler: Array<PluginHandler>;
|
|
331
316
|
}
|
|
332
|
-
/**
|
|
333
|
-
* 未实例化的插件
|
|
334
|
-
*/
|
|
317
|
+
/** 未实例化的插件 */
|
|
335
318
|
export type NewMessagePlugin = new (e?: KarinMessageType) => Plugin;
|