alemonjs 2.0.4 → 2.0.5-alpha.2
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/app/message-format.d.ts +19 -8
- package/lib/app/message-format.js +55 -11
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/jsx.d.ts +40 -15
- package/lib/jsx.js +109 -16
- package/lib/typing/message/index.d.ts +32 -19
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataText,
|
|
1
|
+
import { DataText, DataImageURL, DataImageFile, DataImage, DataMention, DataButton, ButtonRow, DataButtonGroup } from '../typing/message/index.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 文本消息
|
|
@@ -7,12 +7,6 @@ import { DataText, DataImage, DataImageURL, DataImageFile, DataMention } from '.
|
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
9
|
declare const Text: (val: DataText["value"], options?: DataText["options"]) => DataText;
|
|
10
|
-
/**
|
|
11
|
-
* 图片消息
|
|
12
|
-
* @param val
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
declare const Image: (val: DataImage["value"]) => DataImage;
|
|
16
10
|
/**
|
|
17
11
|
* 图片链接,http 或 https 开头
|
|
18
12
|
* @param val
|
|
@@ -25,6 +19,17 @@ declare const ImageURL: (val: DataImageURL["value"]) => DataImageURL;
|
|
|
25
19
|
* @returns
|
|
26
20
|
*/
|
|
27
21
|
declare const ImageFile: (val: DataImageFile["value"]) => DataImageFile;
|
|
22
|
+
/**
|
|
23
|
+
* 图片消息
|
|
24
|
+
* @param val
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
declare const Image: {
|
|
28
|
+
(val: DataImage["value"]): DataImage;
|
|
29
|
+
url: (val: DataImageURL["value"]) => DataImageURL;
|
|
30
|
+
file: (val: DataImageFile["value"]) => DataImageFile;
|
|
31
|
+
};
|
|
32
|
+
|
|
28
33
|
/**
|
|
29
34
|
* 提及
|
|
30
35
|
* @param UserId 默认 @ 所有人
|
|
@@ -32,5 +37,11 @@ declare const ImageFile: (val: DataImageFile["value"]) => DataImageFile;
|
|
|
32
37
|
* @returns
|
|
33
38
|
*/
|
|
34
39
|
declare const Mention: (UserId?: DataMention["value"], options?: DataMention["options"]) => DataMention;
|
|
40
|
+
declare const BT: {
|
|
41
|
+
(title: string, data: DataButton["options"]["data"], options?: Omit<DataButton["options"], "data">): DataButton;
|
|
42
|
+
group(...rows: ButtonRow[]): DataButtonGroup;
|
|
43
|
+
template(value: DataButtonGroup["options"]["template_id"]): DataButtonGroup;
|
|
44
|
+
row(...buttons: DataButton[]): ButtonRow;
|
|
45
|
+
};
|
|
35
46
|
|
|
36
|
-
export { Image, ImageFile, ImageURL, Mention, Text };
|
|
47
|
+
export { BT, Image, ImageFile, ImageURL, Mention, Text };
|
|
@@ -12,38 +12,40 @@ const Text = (val, options) => {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* 图片链接,http 或 https 开头
|
|
16
16
|
* @param val
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
19
|
+
const ImageURL = (val) => {
|
|
20
20
|
return {
|
|
21
|
-
type: '
|
|
21
|
+
type: 'ImageURL',
|
|
22
22
|
value: val
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* 本地图片文件
|
|
27
27
|
* @param val
|
|
28
28
|
* @returns
|
|
29
29
|
*/
|
|
30
|
-
const
|
|
30
|
+
const ImageFile = (val) => {
|
|
31
31
|
return {
|
|
32
|
-
type: '
|
|
32
|
+
type: 'ImageFile',
|
|
33
33
|
value: val
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 图片消息
|
|
38
38
|
* @param val
|
|
39
39
|
* @returns
|
|
40
40
|
*/
|
|
41
|
-
const
|
|
41
|
+
const Image = (val) => {
|
|
42
42
|
return {
|
|
43
|
-
type: '
|
|
43
|
+
type: 'Image',
|
|
44
44
|
value: val
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
+
Image.url = ImageURL;
|
|
48
|
+
Image.file = ImageFile;
|
|
47
49
|
/**
|
|
48
50
|
* 提及
|
|
49
51
|
* @param UserId 默认 @ 所有人
|
|
@@ -54,11 +56,53 @@ const Mention = (UserId, options) => {
|
|
|
54
56
|
return {
|
|
55
57
|
type: 'Mention',
|
|
56
58
|
value: UserId,
|
|
57
|
-
//
|
|
58
59
|
options: options ?? {
|
|
59
60
|
belong: 'user'
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
};
|
|
64
|
+
const BT = (title, data, options) => {
|
|
65
|
+
return {
|
|
66
|
+
type: 'Button',
|
|
67
|
+
value: title,
|
|
68
|
+
options: {
|
|
69
|
+
data,
|
|
70
|
+
...options
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
BT.group = function Group(...rows) {
|
|
75
|
+
return {
|
|
76
|
+
type: 'BT.group',
|
|
77
|
+
value: rows
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
BT.template = function Template(value) {
|
|
81
|
+
return {
|
|
82
|
+
type: 'BT.group',
|
|
83
|
+
value: [],
|
|
84
|
+
options: {
|
|
85
|
+
template_id: value
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
BT.row = function Row(...buttons) {
|
|
90
|
+
return {
|
|
91
|
+
type: 'BT.row',
|
|
92
|
+
value: buttons
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
// const Send = (...x: DataButtonGroup[]) => {
|
|
96
|
+
// return x;
|
|
97
|
+
// };
|
|
98
|
+
// Send(
|
|
99
|
+
// BT.template('123'),
|
|
100
|
+
// BT.group(
|
|
101
|
+
// BT.row(BT("开始", "/开始游戏")),
|
|
102
|
+
// BT.row(BT("百度一下", "https://baidu.com", { isLink: true })),
|
|
103
|
+
// BT.row(BT("是否同意", { click: "/同意", confirm: "/同意", cancel: "/不同意" })),
|
|
104
|
+
// BT.row(BT("哈哈", "/哈哈", { autoEnter: false, showList: true, toolTip: '不支持' }))
|
|
105
|
+
// )
|
|
106
|
+
// )
|
|
63
107
|
|
|
64
|
-
export { Image, ImageFile, ImageURL, Mention, Text };
|
|
108
|
+
export { BT, Image, ImageFile, ImageURL, Mention, Text };
|
package/lib/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { Current, CurrentResult, DefineBot, DefineBotCallback, DefineBotValue, D
|
|
|
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 } from './typing/client/index.js';
|
|
17
|
-
export { DataEnums, DataImage, DataImageFile, DataImageURL, DataMap, DataMention, DataText, MessageDataFormat
|
|
17
|
+
export { ButtonRow, DataButton, DataButtonGroup, DataEnums, DataImage, DataImageFile, DataImageURL, DataMap, DataMention, DataText, MessageDataFormat } from './typing/message/index.js';
|
|
18
18
|
export { StoreChildrenApp, StoreMiddleware, StoreMiddlewareItem, StoreResponse, StoreResponseItem } from './typing/store/res.js';
|
|
19
19
|
export { StateSubscribeMap, SubscribeKeysMap, SubscribeMap, SubscribeValue } from './typing/subscribe/index.js';
|
|
20
20
|
export { core, logger } from './global.js';
|
|
@@ -29,7 +29,7 @@ export { eventState, onState, unEventState, unState, useState } from './app/hook
|
|
|
29
29
|
export { useObserver, useSubscribe } from './app/hook-use-subscribe.js';
|
|
30
30
|
export { loadChildren, loadChildrenFile, loadModule, moduleChildrenFiles } from './app/load.js';
|
|
31
31
|
export { createSendDataFormat, sendToChannel, sendToUser } from './app/message-api.js';
|
|
32
|
-
export { Image, ImageFile, ImageURL, Mention, Text } from './app/message-format.js';
|
|
32
|
+
export { BT, Image, ImageFile, ImageURL, Mention, Text } from './app/message-format.js';
|
|
33
33
|
export { ChildrenApp, Core, Logger, Middleware, Response, State, StateSubscribe, SubscribeList } from './app/store.js';
|
|
34
34
|
export { ErrorModule, createEventName, createHash, getInputExportPath, getRecursiveDirFiles, showErrorModule, stringToNumber, useUserHashKey } from './app/utils.js';
|
|
35
35
|
export { run, start } from './main.js';
|
package/lib/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { eventState, onState, unEventState, unState, useState } from './app/hook
|
|
|
12
12
|
export { useObserver, useSubscribe } from './app/hook-use-subscribe.js';
|
|
13
13
|
export { loadChildren, loadChildrenFile, loadModule, moduleChildrenFiles } from './app/load.js';
|
|
14
14
|
export { createSendDataFormat, sendToChannel, sendToUser } from './app/message-api.js';
|
|
15
|
-
export { Image, ImageFile, ImageURL, Mention, Text } from './app/message-format.js';
|
|
15
|
+
export { BT, Image, ImageFile, ImageURL, Mention, Text } from './app/message-format.js';
|
|
16
16
|
export { ChildrenApp, Core, Logger, Middleware, Response, State, StateSubscribe, SubscribeList } from './app/store.js';
|
|
17
17
|
export { ErrorModule, createEventName, createHash, getInputExportPath, getRecursiveDirFiles, showErrorModule, stringToNumber, useUserHashKey } from './app/utils.js';
|
|
18
18
|
export { run, start } from './main.js';
|
package/lib/jsx.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EventKeys, Events } from './typing/event/map.js';
|
|
3
|
-
import { DataText, DataImageURL, DataImageFile,
|
|
3
|
+
import { DataText, DataImage, DataImageURL, DataImageFile, DataMention, DataEnums, DataButton } from './typing/message/index.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -8,21 +8,25 @@ import { DataText, DataImageURL, DataImageFile, DataImage, DataMention, DataEnum
|
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
declare function Text(_props: {
|
|
11
|
-
children
|
|
11
|
+
children?: DataText['value'] | DataText['value'][];
|
|
12
|
+
style?: DataText['options']['style'];
|
|
13
|
+
} | {
|
|
14
|
+
value?: DataText['value'] | DataText['value'][];
|
|
12
15
|
style?: DataText['options']['style'];
|
|
13
16
|
}): React.ReactElement<{
|
|
14
17
|
dataType: string;
|
|
15
18
|
}, string | React.JSXElementConstructor<any>>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
19
|
+
declare const Image: React.FC<{
|
|
20
|
+
value: DataImage['value'];
|
|
21
|
+
}> & {
|
|
22
|
+
url: React.FC<{
|
|
23
|
+
src: DataImageURL['value'];
|
|
24
|
+
}>;
|
|
25
|
+
file: React.FC<{
|
|
26
|
+
src: DataImageURL['value'];
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
|
|
26
30
|
/**
|
|
27
31
|
*
|
|
28
32
|
* @param _props
|
|
@@ -38,8 +42,8 @@ declare function ImageFile(_props: {
|
|
|
38
42
|
* @param _props
|
|
39
43
|
* @returns
|
|
40
44
|
*/
|
|
41
|
-
declare function
|
|
42
|
-
|
|
45
|
+
declare function ImageURL(_props: {
|
|
46
|
+
src: DataImageURL['value'];
|
|
43
47
|
}): React.ReactElement<{
|
|
44
48
|
dataType: string;
|
|
45
49
|
}, string | React.JSXElementConstructor<any>>;
|
|
@@ -54,6 +58,27 @@ declare function Mention(_props: {
|
|
|
54
58
|
}): React.ReactElement<{
|
|
55
59
|
dataType: string;
|
|
56
60
|
}, string | React.JSXElementConstructor<any>>;
|
|
61
|
+
interface BTProps {
|
|
62
|
+
text: DataButton['value'];
|
|
63
|
+
data: DataButton['options']['data'];
|
|
64
|
+
autoEnter?: DataButton['options']['autoEnter'];
|
|
65
|
+
toolTip?: DataButton['options']['toolTip'];
|
|
66
|
+
showList?: DataButton['options']['showList'];
|
|
67
|
+
isLink?: DataButton['options']['isLink'];
|
|
68
|
+
children?: DataButton['value'];
|
|
69
|
+
}
|
|
70
|
+
declare const BT: React.FC<BTProps> & {
|
|
71
|
+
group: React.FC<{
|
|
72
|
+
children?: React.ReactNode;
|
|
73
|
+
}>;
|
|
74
|
+
row: React.FC<{
|
|
75
|
+
children?: React.ReactNode;
|
|
76
|
+
}>;
|
|
77
|
+
template: React.FC<{
|
|
78
|
+
id: string;
|
|
79
|
+
}>;
|
|
80
|
+
};
|
|
81
|
+
|
|
57
82
|
/**
|
|
58
83
|
* 转换数据
|
|
59
84
|
* ***
|
|
@@ -88,4 +113,4 @@ declare const sendToChannel: (channel_id: string, data: React.JSX.Element[]) =>
|
|
|
88
113
|
*/
|
|
89
114
|
declare const sendToUser: (user_id: string, data: React.JSX.Element[]) => Promise<any[]>;
|
|
90
115
|
|
|
91
|
-
export { Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend };
|
|
116
|
+
export { BT, Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend };
|
package/lib/jsx.js
CHANGED
|
@@ -10,7 +10,7 @@ import 'node:fs';
|
|
|
10
10
|
import 'log4js';
|
|
11
11
|
import './app/load.js';
|
|
12
12
|
import { sendToChannel as sendToChannel$1, sendToUser as sendToUser$1 } from './app/message-api.js';
|
|
13
|
-
import { Text as Text$1, ImageURL as ImageURL$1, ImageFile as ImageFile$1, Image as Image$1, Mention as Mention$1 } from './app/message-format.js';
|
|
13
|
+
import { Text as Text$1, ImageURL as ImageURL$1, ImageFile as ImageFile$1, Image as Image$1, Mention as Mention$1, BT as BT$1 } from './app/message-format.js';
|
|
14
14
|
import './app/utils.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -23,16 +23,22 @@ function Text(_props) {
|
|
|
23
23
|
dataType: 'Text'
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const Image = _props => {
|
|
27
|
+
return React.createElement('div', {
|
|
28
|
+
dataType: 'Image'
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
// BT.group 子组件
|
|
32
|
+
Image.url = _props => {
|
|
32
33
|
return React.createElement('div', {
|
|
33
34
|
dataType: 'ImageURL'
|
|
34
35
|
});
|
|
35
|
-
}
|
|
36
|
+
};
|
|
37
|
+
Image.file = _props => {
|
|
38
|
+
return React.createElement('div', {
|
|
39
|
+
dataType: 'ImageFile'
|
|
40
|
+
});
|
|
41
|
+
};
|
|
36
42
|
/**
|
|
37
43
|
*
|
|
38
44
|
* @param _props
|
|
@@ -48,9 +54,9 @@ function ImageFile(_props) {
|
|
|
48
54
|
* @param _props
|
|
49
55
|
* @returns
|
|
50
56
|
*/
|
|
51
|
-
function
|
|
57
|
+
function ImageURL(_props) {
|
|
52
58
|
return React.createElement('div', {
|
|
53
|
-
dataType: '
|
|
59
|
+
dataType: 'ImageURL'
|
|
54
60
|
});
|
|
55
61
|
}
|
|
56
62
|
/**
|
|
@@ -63,6 +69,32 @@ function Mention(_props) {
|
|
|
63
69
|
dataType: 'Mention'
|
|
64
70
|
});
|
|
65
71
|
}
|
|
72
|
+
const BT = _props => {
|
|
73
|
+
return React.createElement('div', {
|
|
74
|
+
dataType: 'Button'
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
function ButtonGroup(_props) {
|
|
78
|
+
return React.createElement('div', {
|
|
79
|
+
dataType: 'BT.group'
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function ButtonRows(_props) {
|
|
83
|
+
return React.createElement('div', {
|
|
84
|
+
dataType: 'BT.row'
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function ButtonTemplate(_props) {
|
|
88
|
+
return React.createElement('div', {
|
|
89
|
+
dataType: 'BT.group'
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// BT.group 子组件
|
|
93
|
+
BT.group = ButtonGroup;
|
|
94
|
+
// BT.template 子组件
|
|
95
|
+
BT.template = ButtonTemplate;
|
|
96
|
+
// BT.row 子组件
|
|
97
|
+
BT.row = ButtonRows;
|
|
66
98
|
/**
|
|
67
99
|
* 转换数据
|
|
68
100
|
* ***
|
|
@@ -81,11 +113,16 @@ function JSX(...arg) {
|
|
|
81
113
|
const props = item.props;
|
|
82
114
|
const dataType = item.type()?.props?.dataType;
|
|
83
115
|
if (dataType === 'Text') {
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
116
|
+
if (props?.value) {
|
|
117
|
+
data.push(Text$1(props.value, {
|
|
118
|
+
style: props?.style
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
else if (props?.children) {
|
|
122
|
+
data.push(Text$1(Array.isArray(props.children) ? props.children.join('') : props.children, {
|
|
123
|
+
style: props?.style
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
89
126
|
}
|
|
90
127
|
else if (dataType === 'ImageURL') {
|
|
91
128
|
data.push(ImageURL$1(props.src));
|
|
@@ -104,6 +141,45 @@ function JSX(...arg) {
|
|
|
104
141
|
}
|
|
105
142
|
: null));
|
|
106
143
|
}
|
|
144
|
+
else if (dataType === 'BT.group') {
|
|
145
|
+
const id = props?.id;
|
|
146
|
+
if (id) {
|
|
147
|
+
data.push(BT$1.template(id));
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
console.log('Button', props, item.type());
|
|
151
|
+
if (Array.isArray(props?.children)) {
|
|
152
|
+
const rows = [];
|
|
153
|
+
for (const child of props?.children) {
|
|
154
|
+
// 拿到每个子组件
|
|
155
|
+
const bts = [];
|
|
156
|
+
if (Array.isArray(child.children)) {
|
|
157
|
+
for (const chi of child.children) {
|
|
158
|
+
// const type = chi.children
|
|
159
|
+
const value = chi.props?.text;
|
|
160
|
+
const data = chi.props?.data;
|
|
161
|
+
const options = {};
|
|
162
|
+
if (chi.props?.autoEnter) {
|
|
163
|
+
options['autoEnter'] = chi.props?.autoEnter ? true : false;
|
|
164
|
+
}
|
|
165
|
+
if (chi.props?.toolTip) {
|
|
166
|
+
options['toolTip'] = chi.props?.toolTip ?? '';
|
|
167
|
+
}
|
|
168
|
+
if (chi.props?.showList) {
|
|
169
|
+
options['showList'] = chi.props?.showList ? true : false;
|
|
170
|
+
}
|
|
171
|
+
if (chi.props?.isLink) {
|
|
172
|
+
options['isLink'] = chi.props?.isLink ? true : false;
|
|
173
|
+
}
|
|
174
|
+
bts.push(BT$1(value, data, options));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
rows.push(BT$1.row(...bts));
|
|
178
|
+
}
|
|
179
|
+
data.push(BT$1.group(...rows));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
107
183
|
}
|
|
108
184
|
if (data.length === 0) {
|
|
109
185
|
logger.error('Invalid data: data must be a non-empty array');
|
|
@@ -138,5 +214,22 @@ const sendToChannel = async (channel_id, data) => {
|
|
|
138
214
|
const sendToUser = async (user_id, data) => {
|
|
139
215
|
return sendToUser$1(user_id, JSX(...data));
|
|
140
216
|
};
|
|
217
|
+
// const Send = (..._x: any[]) => {
|
|
218
|
+
// //
|
|
219
|
+
// }
|
|
220
|
+
// Send(
|
|
221
|
+
// <Text value="" />,
|
|
222
|
+
// <Text >xxxx</Text>,
|
|
223
|
+
// <Image.url src="" />,
|
|
224
|
+
// <Image.file src="" />,
|
|
225
|
+
// <BT.template id="12121" />,
|
|
226
|
+
// <BT.group>
|
|
227
|
+
// <BT.row><BT text="登录" data="/登录游戏" /><BT text="退出" data="/退出游戏" /></BT.row>
|
|
228
|
+
// <BT.row><BT text="是否同意" data={{ "click": "/点击", "confirm": "/同意", "cancel": "/不同意" }} /></BT.row>
|
|
229
|
+
// <BT.row><BT text="百度一下" data="htts://baidu.com" isLink /></BT.row>
|
|
230
|
+
// <BT.row><BT text="自动" data="/自动发出" autoEnter /></BT.row>
|
|
231
|
+
// <BT.row><BT text="禁用的" data="/点不了" toolTip="不支持点击" /></BT.row>
|
|
232
|
+
// </BT.group>
|
|
233
|
+
// )
|
|
141
234
|
|
|
142
|
-
export { Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend };
|
|
235
|
+
export { BT, Image, ImageFile, ImageURL, JSX, Mention, Text, sendToChannel, sendToUser, useSend };
|
|
@@ -43,31 +43,44 @@ type DataMention = {
|
|
|
43
43
|
payload?: User | Guild | Channel | 'everyone';
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
+
type DataButton = {
|
|
47
|
+
type: 'Button';
|
|
48
|
+
value: string | {
|
|
49
|
+
title: string;
|
|
50
|
+
label: string;
|
|
51
|
+
};
|
|
52
|
+
options?: {
|
|
53
|
+
toolTip?: string;
|
|
54
|
+
autoEnter?: boolean;
|
|
55
|
+
showList?: boolean;
|
|
56
|
+
data?: string | {
|
|
57
|
+
click: string;
|
|
58
|
+
confirm: string;
|
|
59
|
+
cancel: string;
|
|
60
|
+
};
|
|
61
|
+
isLink?: boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
type ButtonRow = {
|
|
65
|
+
type: 'BT.row';
|
|
66
|
+
value: DataButton[];
|
|
67
|
+
};
|
|
68
|
+
type DataButtonGroup = {
|
|
69
|
+
type: 'BT.group';
|
|
70
|
+
value: ButtonRow[];
|
|
71
|
+
options?: {
|
|
72
|
+
template_id?: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
46
75
|
type DataMap = {
|
|
47
76
|
Text: DataText;
|
|
48
77
|
Image: DataImage;
|
|
49
78
|
ImageURL: DataImageURL;
|
|
50
79
|
ImageFile: DataImageFile;
|
|
51
80
|
Mention: DataMention;
|
|
81
|
+
ButtonGroup: DataButtonGroup;
|
|
52
82
|
};
|
|
53
|
-
type
|
|
54
|
-
Text: string | undefined;
|
|
55
|
-
Image: Buffer[] | undefined;
|
|
56
|
-
Link: any;
|
|
57
|
-
Mention: {
|
|
58
|
-
value: string;
|
|
59
|
-
typing: string;
|
|
60
|
-
name: string;
|
|
61
|
-
avatar: string;
|
|
62
|
-
bot: boolean;
|
|
63
|
-
}[] | undefined;
|
|
64
|
-
Button: any;
|
|
65
|
-
File: any;
|
|
66
|
-
Voice: any;
|
|
67
|
-
Video: any;
|
|
68
|
-
ButtonBox: any;
|
|
69
|
-
};
|
|
70
|
-
type DataEnums = DataText | DataImage | DataImageURL | DataImageFile | DataMention;
|
|
83
|
+
type DataEnums = DataText | DataImage | DataImageURL | DataImageFile | DataMention | DataButtonGroup;
|
|
71
84
|
type MessageDataFormat = DataEnums[];
|
|
72
85
|
|
|
73
|
-
export type { DataEnums, DataImage, DataImageFile, DataImageURL, DataMap, DataMention, DataText, MessageDataFormat
|
|
86
|
+
export type { ButtonRow, DataButton, DataButtonGroup, DataEnums, DataImage, DataImageFile, DataImageURL, DataMap, DataMention, DataText, MessageDataFormat };
|