alemonjs 2.0.15 → 2.0.16
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/README.md +2 -2
- package/lib/app/event-processor.js +3 -1
- package/lib/app/hook-use-api.d.ts +7 -1
- package/lib/app/hook-use-api.js +25 -2
- package/lib/app/hook-use-subscribe.d.ts +7 -4
- package/lib/app/hook-use-subscribe.js +7 -4
- package/lib/app/message-api.d.ts +8 -2
- package/lib/app/message-api.js +8 -2
- package/lib/global.d.ts +9 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +2 -2
- package/lib/jsx.d.ts +12 -1
- package/lib/jsx.js +34 -1
- package/lib/main.js +6 -2
- package/lib/typing/event/index.d.ts +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,9 +20,9 @@ start('src/index.js')
|
|
|
20
20
|
> src/response/res.js
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
|
-
import {
|
|
23
|
+
import { onSelects, onResponse, Text, useSend } from 'alemonjs'
|
|
24
24
|
// 创建事件类型
|
|
25
|
-
export const selects =
|
|
25
|
+
export const selects = onSelects(['message.create'])
|
|
26
26
|
// 导出响应
|
|
27
27
|
export default onResponse(selects, event => {
|
|
28
28
|
// 使用发送函数
|
|
@@ -50,7 +50,9 @@ const callback = () => {
|
|
|
50
50
|
// 下一次清理的时间,应该随着长度的增加而减少
|
|
51
51
|
const length = ProcessorEventAutoClearMap.size + ProcessorEventUserAudoClearMap.size;
|
|
52
52
|
// 长度控制在37个以内
|
|
53
|
-
const time = length > processor_repeated_clear_size
|
|
53
|
+
const time = length > processor_repeated_clear_size
|
|
54
|
+
? processor_repeated_clear_time_min
|
|
55
|
+
: processor_repeated_clear_time_max;
|
|
54
56
|
setTimeout(callback, time);
|
|
55
57
|
};
|
|
56
58
|
setTimeout(callback, processor_repeated_clear_time_min);
|
|
@@ -31,6 +31,7 @@ declare const useMention: <T extends EventKeys>(event: Events[T]) => {
|
|
|
31
31
|
* @throws {Error} - 如果 event 无效,抛出错误。
|
|
32
32
|
*/
|
|
33
33
|
declare const useSend: <T extends EventKeys>(event: Events[T]) => (...val: DataEnums[]) => Promise<Result | ClientAPIMessageResult[]>;
|
|
34
|
+
declare const useSends: <T extends EventKeys>(event: Events[T]) => ((val: DataEnums[]) => Promise<Result | ClientAPIMessageResult[]>)[];
|
|
34
35
|
/**
|
|
35
36
|
* 卸载模块
|
|
36
37
|
* @param name
|
|
@@ -47,6 +48,11 @@ declare const unMount: () => void;
|
|
|
47
48
|
* @param values
|
|
48
49
|
* @returns
|
|
49
50
|
*/
|
|
51
|
+
declare const onSelects: <T extends EventKeys[] | EventKeys>(values: T) => T;
|
|
52
|
+
/**
|
|
53
|
+
* 废弃,请使用onSelects
|
|
54
|
+
* @deprecated
|
|
55
|
+
*/
|
|
50
56
|
declare const createSelects: <T extends EventKeys[] | EventKeys>(values: T) => T;
|
|
51
57
|
|
|
52
|
-
export { createSelects, unChildren, unMount, useMention, useSend };
|
|
58
|
+
export { createSelects, onSelects, unChildren, unMount, useMention, useSend, useSends };
|
package/lib/app/hook-use-api.js
CHANGED
|
@@ -113,6 +113,23 @@ const useSend = (event) => {
|
|
|
113
113
|
return await alemonjsBot.api.use.send(event, val);
|
|
114
114
|
};
|
|
115
115
|
};
|
|
116
|
+
const useSends = (event) => {
|
|
117
|
+
if (!event || typeof event !== 'object') {
|
|
118
|
+
logger.error({
|
|
119
|
+
code: ResultCode.FailParams,
|
|
120
|
+
message: 'Invalid event: event must be an object',
|
|
121
|
+
data: null
|
|
122
|
+
});
|
|
123
|
+
throw new Error('Invalid event: event must be an object');
|
|
124
|
+
}
|
|
125
|
+
const send = async (val) => {
|
|
126
|
+
if (!val || val.length === 0) {
|
|
127
|
+
return createResult(ResultCode.FailParams, 'Invalid val: val must be a non-empty array', null);
|
|
128
|
+
}
|
|
129
|
+
return await alemonjsBot.api.use.send(event, val);
|
|
130
|
+
};
|
|
131
|
+
return [send];
|
|
132
|
+
};
|
|
116
133
|
/**
|
|
117
134
|
* 卸载模块
|
|
118
135
|
* @param name
|
|
@@ -146,6 +163,12 @@ const unMount = () => {
|
|
|
146
163
|
* @param values
|
|
147
164
|
* @returns
|
|
148
165
|
*/
|
|
149
|
-
const
|
|
166
|
+
const onSelects = (values) => values;
|
|
167
|
+
global.onSelects = onSelects;
|
|
168
|
+
/**
|
|
169
|
+
* 废弃,请使用onSelects
|
|
170
|
+
* @deprecated
|
|
171
|
+
*/
|
|
172
|
+
const createSelects = onSelects;
|
|
150
173
|
|
|
151
|
-
export { createSelects, unChildren, unMount, useMention, useSend };
|
|
174
|
+
export { createSelects, onSelects, unChildren, unMount, useMention, useSend, useSends };
|
|
@@ -10,10 +10,13 @@ import '../global.js';
|
|
|
10
10
|
*/
|
|
11
11
|
declare const useSubscribe: <T extends EventKeys>(event: Events[T], select: T) => ((callback: Current<T>, keys: (keyof Events[T])[]) => void)[];
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* 废弃,请使用
|
|
14
|
+
* ***
|
|
15
|
+
* const [_, observer] = useSubscribe(event, option)
|
|
16
|
+
* ***
|
|
17
|
+
* observer()
|
|
18
|
+
* ***
|
|
19
|
+
* @deprecated
|
|
17
20
|
*/
|
|
18
21
|
declare const useObserver: <T extends EventKeys>(event: Events[T], option: T) => (callback: Current<T>, keys: (keyof Events[T])[]) => void;
|
|
19
22
|
|
|
@@ -55,10 +55,13 @@ const useSubscribe = (event, select) => {
|
|
|
55
55
|
return [create, mountBefore, unmount];
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* 废弃,请使用
|
|
59
|
+
* ***
|
|
60
|
+
* const [_, observer] = useSubscribe(event, option)
|
|
61
|
+
* ***
|
|
62
|
+
* observer()
|
|
63
|
+
* ***
|
|
64
|
+
* @deprecated
|
|
62
65
|
*/
|
|
63
66
|
const useObserver = (event, option) => {
|
|
64
67
|
const [_, mount] = useSubscribe(event, option);
|
package/lib/app/message-api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OnDataFormatFunc } from '../typing/event/index.js';
|
|
1
2
|
import { ClientAPIMessageResult } from '../typing/client/index.js';
|
|
2
3
|
import { DataEnums } from '../typing/message/index.js';
|
|
3
4
|
import '../global.js';
|
|
@@ -8,7 +9,12 @@ import '../global.js';
|
|
|
8
9
|
* @returns {DataEnums[]} - 返回格式化后的数据数组。
|
|
9
10
|
* @throws {Error} - 如果 data 无效,抛出错误。
|
|
10
11
|
*/
|
|
11
|
-
declare const
|
|
12
|
+
declare const format: OnDataFormatFunc;
|
|
13
|
+
/**
|
|
14
|
+
* 废弃
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
17
|
+
declare const createSendDataFormat: OnDataFormatFunc;
|
|
12
18
|
/**
|
|
13
19
|
* 向指定频道发送消息。
|
|
14
20
|
* @param {string} channel_id - 目标频道的 ID。
|
|
@@ -24,4 +30,4 @@ declare const sendToChannel: (channel_id: string, data: DataEnums[]) => Promise<
|
|
|
24
30
|
*/
|
|
25
31
|
declare const sendToUser: (user_id: string, data: DataEnums[]) => Promise<ClientAPIMessageResult[]>;
|
|
26
32
|
|
|
27
|
-
export { createSendDataFormat, sendToChannel, sendToUser };
|
|
33
|
+
export { createSendDataFormat, format, sendToChannel, sendToUser };
|
package/lib/app/message-api.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ResultCode } from '../core/code.js';
|
|
|
6
6
|
* @returns {DataEnums[]} - 返回格式化后的数据数组。
|
|
7
7
|
* @throws {Error} - 如果 data 无效,抛出错误。
|
|
8
8
|
*/
|
|
9
|
-
const
|
|
9
|
+
const format = (...data) => {
|
|
10
10
|
if (!data || data.length === 0) {
|
|
11
11
|
logger.error({
|
|
12
12
|
code: ResultCode.FailParams,
|
|
@@ -17,6 +17,12 @@ const createSendDataFormat = (...data) => {
|
|
|
17
17
|
}
|
|
18
18
|
return data;
|
|
19
19
|
};
|
|
20
|
+
global.format = format;
|
|
21
|
+
/**
|
|
22
|
+
* 废弃
|
|
23
|
+
* @deprecated
|
|
24
|
+
*/
|
|
25
|
+
const createSendDataFormat = format;
|
|
20
26
|
/**
|
|
21
27
|
* 向指定频道发送消息。
|
|
22
28
|
* @param {string} channel_id - 目标频道的 ID。
|
|
@@ -52,4 +58,4 @@ const sendToUser = async (user_id, data) => {
|
|
|
52
58
|
return await alemonjsBot.api.active.send.user(user_id, data);
|
|
53
59
|
};
|
|
54
60
|
|
|
55
|
-
export { createSendDataFormat, sendToChannel, sendToUser };
|
|
61
|
+
export { createSendDataFormat, format, sendToChannel, sendToUser };
|
package/lib/global.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnResponseFunc, OnResponseReversalFunc, OnMiddlewareFunc, OnMiddlewareReversalFunc, DefineChildrenFunc, DefinePlatformFunc } from './typing/event/index.js';
|
|
1
|
+
import { OnResponseFunc, OnResponseReversalFunc, OnMiddlewareFunc, OnMiddlewareReversalFunc, DefineChildrenFunc, DefinePlatformFunc, OnSelectsFunc, OnDataFormatFunc } from './typing/event/index.js';
|
|
2
2
|
import { ClientAPI } from './typing/client/index.js';
|
|
3
3
|
import { StoreChildrenApp } from './typing/store/res.js';
|
|
4
4
|
import { StateSubscribeMap, SubscribeKeysMap } from './typing/subscribe/index.js';
|
|
@@ -68,6 +68,14 @@ declare global {
|
|
|
68
68
|
* 定义一个平台
|
|
69
69
|
*/
|
|
70
70
|
var definePlatform: DefinePlatformFunc;
|
|
71
|
+
/**
|
|
72
|
+
* 定义选择器
|
|
73
|
+
*/
|
|
74
|
+
var onSelects: OnSelectsFunc;
|
|
75
|
+
/**
|
|
76
|
+
* 定义数据格式
|
|
77
|
+
*/
|
|
78
|
+
var format: OnDataFormatFunc;
|
|
71
79
|
}
|
|
72
80
|
declare const logger: any;
|
|
73
81
|
declare const core: {
|
package/lib/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { PublicEventMessageCreate, PublicEventMessageDelete, PublicEventMessageR
|
|
|
10
10
|
export { PrivateEventMessageCreate, PrivateEventMessageDelete, PrivateEventMessageUpdate } from './typing/event/message/private.message.js';
|
|
11
11
|
export { PrivateEventRequestFriendAdd, PrivateEventRequestGuildAdd } from './typing/event/request/index.js';
|
|
12
12
|
export { ActionsEventEnum } from './typing/event/actions.js';
|
|
13
|
-
export { Current, CurrentResult, CurrentResultValue, DefineBot, DefineBotCallback, DefineBotValue, DefineChildrenCallback, DefineChildrenFunc, DefineChildrenValue, DefinePlatformCallback, DefinePlatformFunc, DefinePlatformValue, OnMiddlewareFunc, OnMiddlewareReversalFunc, OnMiddlewareValue, OnResponseFunc, OnResponseReversalFunc, OnResponseValue } from './typing/event/index.js';
|
|
13
|
+
export { Current, CurrentResult, CurrentResultValue, DefineBot, DefineBotCallback, DefineBotValue, DefineChildrenCallback, DefineChildrenFunc, DefineChildrenValue, DefinePlatformCallback, DefinePlatformFunc, DefinePlatformValue, OnDataFormatFunc, OnMiddlewareFunc, OnMiddlewareReversalFunc, OnMiddlewareValue, OnResponseFunc, OnResponseReversalFunc, OnResponseValue, OnSelectsFunc } from './typing/event/index.js';
|
|
14
14
|
export { EventKeys, Events, EventsEnum, EventsKeyEnum, EventsMessageCreate, EventsMessageCreateEnum, EventsMessageCreateKeys } from './typing/event/map.js';
|
|
15
15
|
export { LoggerUtils } from './typing/logger/index.js';
|
|
16
16
|
export { ClientAPI, ClientAPIMessageResult } from './typing/client/index.js';
|
|
@@ -24,11 +24,11 @@ export { defineChildren } from './app/define-chidren.js';
|
|
|
24
24
|
export { OnMiddleware, onMiddleware } from './app/event-middleware.js';
|
|
25
25
|
export { OnProcessor, onProcessor } from './app/event-processor.js';
|
|
26
26
|
export { OnResponse, onResponse } from './app/event-response.js';
|
|
27
|
-
export { createSelects, unChildren, unMount, useMention, useSend } from './app/hook-use-api.js';
|
|
27
|
+
export { createSelects, onSelects, unChildren, unMount, useMention, useSend, useSends } from './app/hook-use-api.js';
|
|
28
28
|
export { eventState, onState, unEventState, unState, useState } from './app/hook-use-state.js';
|
|
29
29
|
export { useObserver, useSubscribe } from './app/hook-use-subscribe.js';
|
|
30
30
|
export { loadChildren, loadChildrenFile, loadModule, moduleChildrenFiles } from './app/load.js';
|
|
31
|
-
export { createSendDataFormat, sendToChannel, sendToUser } from './app/message-api.js';
|
|
31
|
+
export { createSendDataFormat, format, sendToChannel, sendToUser } from './app/message-api.js';
|
|
32
32
|
export { Ark, BT, Image, ImageFile, ImageURL, Link, MD, Mention, Text } from './app/message-format.js';
|
|
33
33
|
export { ChildrenApp, Core, Logger, Middleware, ProcessorEventAutoClearMap, ProcessorEventUserAudoClearMap, Response, State, StateSubscribe, SubscribeList } from './app/store.js';
|
|
34
34
|
export { ErrorModule, Result, createEventName, createHash, createResult, getInputExportPath, getRecursiveDirFiles, showErrorModule, stringToNumber, useUserHashKey } from './app/utils.js';
|
package/lib/index.js
CHANGED
|
@@ -7,11 +7,11 @@ export { defineChildren } from './app/define-chidren.js';
|
|
|
7
7
|
export { OnMiddleware, onMiddleware } from './app/event-middleware.js';
|
|
8
8
|
export { OnProcessor, onProcessor } from './app/event-processor.js';
|
|
9
9
|
export { OnResponse, onResponse } from './app/event-response.js';
|
|
10
|
-
export { createSelects, unChildren, unMount, useMention, useSend } from './app/hook-use-api.js';
|
|
10
|
+
export { createSelects, onSelects, unChildren, unMount, useMention, useSend, useSends } from './app/hook-use-api.js';
|
|
11
11
|
export { eventState, onState, unEventState, unState, useState } from './app/hook-use-state.js';
|
|
12
12
|
export { useObserver, useSubscribe } from './app/hook-use-subscribe.js';
|
|
13
13
|
export { loadChildren, loadChildrenFile, loadModule, moduleChildrenFiles } from './app/load.js';
|
|
14
|
-
export { createSendDataFormat, sendToChannel, sendToUser } from './app/message-api.js';
|
|
14
|
+
export { createSendDataFormat, format, sendToChannel, sendToUser } from './app/message-api.js';
|
|
15
15
|
export { Ark, BT, Image, ImageFile, ImageURL, Link, MD, Mention, Text } from './app/message-format.js';
|
|
16
16
|
export { ChildrenApp, Core, Logger, Middleware, ProcessorEventAutoClearMap, ProcessorEventUserAudoClearMap, Response, State, StateSubscribe, SubscribeList } from './app/store.js';
|
|
17
17
|
export { ErrorModule, createEventName, createHash, createResult, getInputExportPath, getRecursiveDirFiles, showErrorModule, stringToNumber, useUserHashKey } from './app/utils.js';
|
package/lib/jsx.d.ts
CHANGED
|
@@ -85,6 +85,11 @@ declare const BT: React.FC<BTProps> & {
|
|
|
85
85
|
}>;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
declare function Format(_props: {
|
|
89
|
+
children?: React.ReactNode;
|
|
90
|
+
}): React.ReactElement<{
|
|
91
|
+
dataType: string;
|
|
92
|
+
}, string | React.JSXElementConstructor<any>>;
|
|
88
93
|
/**
|
|
89
94
|
* 转换数据
|
|
90
95
|
* ***
|
|
@@ -104,6 +109,12 @@ declare function JSX(...arg: React.JSX.Element[]): DataEnums[];
|
|
|
104
109
|
* @returns
|
|
105
110
|
*/
|
|
106
111
|
declare const useSend: <T extends EventKeys>(e: Events[T]) => (...arg: React.JSX.Element[]) => Promise<Result | ClientAPIMessageResult[]>;
|
|
112
|
+
/**
|
|
113
|
+
* 发送消息
|
|
114
|
+
* @param e
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
declare const useSends: <T extends EventKeys>(e: Events[T]) => ((arg: React.JSX.Element) => Promise<Result | ClientAPIMessageResult[]>)[];
|
|
107
118
|
/**
|
|
108
119
|
*
|
|
109
120
|
* @param channel_id
|
|
@@ -119,4 +130,4 @@ declare const sendToChannel: (channel_id: string, data: React.JSX.Element[]) =>
|
|
|
119
130
|
*/
|
|
120
131
|
declare const sendToUser: (user_id: string, data: React.JSX.Element[]) => Promise<ClientAPIMessageResult[]>;
|
|
121
132
|
|
|
122
|
-
export { BT, Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend };
|
|
133
|
+
export { BT, Format, Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend, useSends };
|
package/lib/jsx.js
CHANGED
|
@@ -100,6 +100,11 @@ BT.group = ButtonGroup;
|
|
|
100
100
|
BT.template = ButtonTemplate;
|
|
101
101
|
// BT.row 子组件
|
|
102
102
|
BT.row = ButtonRows;
|
|
103
|
+
function Format(_props) {
|
|
104
|
+
return React.createElement('div', {
|
|
105
|
+
dataType: 'Format'
|
|
106
|
+
});
|
|
107
|
+
}
|
|
103
108
|
/**
|
|
104
109
|
* 转换数据
|
|
105
110
|
* ***
|
|
@@ -184,6 +189,24 @@ function JSX(...arg) {
|
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
191
|
}
|
|
192
|
+
else if (dataType === 'Format') {
|
|
193
|
+
// Format 的 children 就是直接复用 JSX
|
|
194
|
+
let children = [];
|
|
195
|
+
if (Array.isArray(props?.children)) {
|
|
196
|
+
children = props?.children;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
children = [props?.children];
|
|
200
|
+
}
|
|
201
|
+
if (children.length > 0) {
|
|
202
|
+
const format = JSX(...children);
|
|
203
|
+
format.forEach((item) => {
|
|
204
|
+
if (item) {
|
|
205
|
+
data.push(item);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
187
210
|
}
|
|
188
211
|
if (data.length === 0) {
|
|
189
212
|
logger.warn({
|
|
@@ -203,6 +226,16 @@ const useSend = (e) => {
|
|
|
203
226
|
const Send = useSend$1(e);
|
|
204
227
|
return (...arg) => Send(...JSX(...arg));
|
|
205
228
|
};
|
|
229
|
+
/**
|
|
230
|
+
* 发送消息
|
|
231
|
+
* @param e
|
|
232
|
+
* @returns
|
|
233
|
+
*/
|
|
234
|
+
const useSends = (e) => {
|
|
235
|
+
const Send = useSend$1(e);
|
|
236
|
+
const send = (arg) => Send(...JSX(arg));
|
|
237
|
+
return [send];
|
|
238
|
+
};
|
|
206
239
|
/**
|
|
207
240
|
*
|
|
208
241
|
* @param channel_id
|
|
@@ -222,4 +255,4 @@ const sendToUser = async (user_id, data) => {
|
|
|
222
255
|
return sendToUser$1(user_id, JSX(...data));
|
|
223
256
|
};
|
|
224
257
|
|
|
225
|
-
export { BT, Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend };
|
|
258
|
+
export { BT, Format, Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend, useSends };
|
package/lib/main.js
CHANGED
|
@@ -8,10 +8,12 @@ import './app/define-chidren.js';
|
|
|
8
8
|
import './app/event-middleware.js';
|
|
9
9
|
import './app/event-processor.js';
|
|
10
10
|
import './app/event-response.js';
|
|
11
|
+
import './app/hook-use-api.js';
|
|
12
|
+
import { useState } from './app/hook-use-state.js';
|
|
11
13
|
import { ResultCode } from './core/code.js';
|
|
12
14
|
import 'node:fs';
|
|
13
15
|
import 'log4js';
|
|
14
|
-
import
|
|
16
|
+
import './app/message-api.js';
|
|
15
17
|
import './app/message-format.js';
|
|
16
18
|
import { file_prefix_common, default_login, default_platform_prefix, default_platform_common_prefix, file_prefix_framework } from './core/variable.js';
|
|
17
19
|
|
|
@@ -54,7 +56,9 @@ const start = async (input, pm) => {
|
|
|
54
56
|
const platform$1 = pm ?? cfg.argv?.platform ?? cfg.value?.platform;
|
|
55
57
|
const login$1 = platform$1 ? platform$1.replace(file_prefix_common, '') : null;
|
|
56
58
|
const login = login$1 ?? cfg.argv?.login ?? cfg.value?.login ?? default_login;
|
|
57
|
-
const prefix = platform$1 && file_prefix_framework.test(platform$1)
|
|
59
|
+
const prefix = platform$1 && file_prefix_framework.test(platform$1)
|
|
60
|
+
? default_platform_prefix
|
|
61
|
+
: default_platform_common_prefix;
|
|
58
62
|
const platform = `${prefix}${login}`;
|
|
59
63
|
// 启动机器人
|
|
60
64
|
try {
|
|
@@ -70,6 +70,14 @@ type DefinePlatformValue = {
|
|
|
70
70
|
* 定义一个平台
|
|
71
71
|
*/
|
|
72
72
|
type DefinePlatformFunc = (callback: DefinePlatformCallback) => DefinePlatformValue;
|
|
73
|
+
/**
|
|
74
|
+
* 定义选择器
|
|
75
|
+
*/
|
|
76
|
+
type OnSelectsFunc = <T extends EventKeys[] | EventKeys>(values: T) => T;
|
|
77
|
+
/**
|
|
78
|
+
* 定义数据格式
|
|
79
|
+
*/
|
|
80
|
+
type OnDataFormatFunc = (...data: DataEnums[]) => DataEnums[];
|
|
73
81
|
/**
|
|
74
82
|
* 废弃,请使用 DefinePlatformCallback
|
|
75
83
|
* @deprecated
|
|
@@ -86,4 +94,4 @@ type DefineBotValue = DefinePlatformValue;
|
|
|
86
94
|
*/
|
|
87
95
|
type DefineBot = DefinePlatformFunc;
|
|
88
96
|
|
|
89
|
-
export type { Current, CurrentResult, CurrentResultValue, DefineBot, DefineBotCallback, DefineBotValue, DefineChildrenCallback, DefineChildrenFunc, DefineChildrenValue, DefinePlatformCallback, DefinePlatformFunc, DefinePlatformValue, OnMiddlewareFunc, OnMiddlewareReversalFunc, OnMiddlewareValue, OnResponseFunc, OnResponseReversalFunc, OnResponseValue };
|
|
97
|
+
export type { Current, CurrentResult, CurrentResultValue, DefineBot, DefineBotCallback, DefineBotValue, DefineChildrenCallback, DefineChildrenFunc, DefineChildrenValue, DefinePlatformCallback, DefinePlatformFunc, DefinePlatformValue, OnDataFormatFunc, OnMiddlewareFunc, OnMiddlewareReversalFunc, OnMiddlewareValue, OnResponseFunc, OnResponseReversalFunc, OnResponseValue, OnSelectsFunc };
|