alemonjs 2.0.5-alpha.3 → 2.0.5
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 +86 -2
- package/lib/app/message-format.js +323 -2
- package/lib/index.d.ts +9 -2
- package/lib/index.js +1 -1
- package/lib/jsx.d.ts +5 -1
- package/lib/typing/message/ark.d.ts +46 -0
- package/lib/typing/message/button.d.ts +31 -0
- package/lib/typing/message/image.d.ts +23 -0
- package/lib/typing/message/index.d.ts +12 -83
- package/lib/typing/message/link.d.ts +12 -0
- package/lib/typing/message/markdown.d.ts +81 -0
- package/lib/typing/message/mention.d.ts +16 -0
- package/lib/typing/message/text.d.ts +12 -0
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataButton, ButtonRow, DataButtonGroup } from '../typing/message/button.js';
|
|
2
|
+
import { DataArkListTip, DataArkListContent, DataArkList, DataArkListItem, DataArkCard, DataArkBigCard } from '../typing/message/ark.js';
|
|
3
|
+
import { DataMarkDown, DataMarkdownTemplate, DataMarkdownText, DataMarkdownTitle, DataMarkdownSubtitle, DataMarkdownBold, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownStrikethrough, DataMarkdownLink, DataMarkdownImage, DataMarkdownList, DataMarkdownListItem, DataMarkdownBlockquote, DataMarkdownDivider, DataMarkdownNewline } from '../typing/message/markdown.js';
|
|
4
|
+
import { DataImageURL, DataImageFile, DataImage } from '../typing/message/image.js';
|
|
5
|
+
import { DataText } from '../typing/message/text.js';
|
|
6
|
+
import { DataMention } from '../typing/message/mention.js';
|
|
7
|
+
import { DataLink } from '../typing/message/link.js';
|
|
2
8
|
|
|
3
9
|
/**
|
|
4
10
|
* 文本消息
|
|
@@ -7,6 +13,13 @@ import { DataText, DataImageURL, DataImageFile, DataImage, DataMention, DataButt
|
|
|
7
13
|
* @returns
|
|
8
14
|
*/
|
|
9
15
|
declare const Text: (val: DataText["value"], options?: DataText["options"]) => DataText;
|
|
16
|
+
/**
|
|
17
|
+
* 链接消息
|
|
18
|
+
* @param val 要显示的文本
|
|
19
|
+
* @param options 内容选项
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
declare const Link: (val: DataLink["value"], options?: DataText["options"]) => DataText;
|
|
10
23
|
/**
|
|
11
24
|
* 图片链接,http 或 https 开头
|
|
12
25
|
* @param val
|
|
@@ -44,4 +57,75 @@ declare const BT: {
|
|
|
44
57
|
row(...buttons: DataButton[]): ButtonRow;
|
|
45
58
|
};
|
|
46
59
|
|
|
47
|
-
|
|
60
|
+
declare const Ark: {
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param values 要显示的文本
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
list: (values_0: DataArkListTip, values_1: DataArkListContent) => DataArkList;
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param options 提示信息
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
listTip: (options: DataArkListTip["value"]) => DataArkListTip;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param values 实际内容
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
listContent: (...values: DataArkListContent["value"]) => DataArkListContent;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @param value 列表项内容
|
|
82
|
+
* @returns
|
|
83
|
+
*/
|
|
84
|
+
listItem: (value: DataArkListItem["value"]) => DataArkListItem;
|
|
85
|
+
/**
|
|
86
|
+
* @param value 卡片内容
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
89
|
+
Card: (value: DataArkCard["value"]) => DataArkCard;
|
|
90
|
+
/**
|
|
91
|
+
* @param value 大卡片内容
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
94
|
+
BigCard: (value: DataArkBigCard["value"]) => DataArkBigCard;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* @param values 要显示的文本
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
declare const MD: {
|
|
102
|
+
(...values: DataMarkDown["value"]): DataMarkDown;
|
|
103
|
+
template(templateId: DataMarkdownTemplate["value"], params?: DataMarkdownTemplate["options"]["params"]): {
|
|
104
|
+
type: string;
|
|
105
|
+
value: string;
|
|
106
|
+
options: {
|
|
107
|
+
params: {
|
|
108
|
+
[key: string]: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
text(text: string): DataMarkdownText;
|
|
113
|
+
title(text: string): DataMarkdownTitle;
|
|
114
|
+
subtitle(text: string): DataMarkdownSubtitle;
|
|
115
|
+
bold(text: string): DataMarkdownBold;
|
|
116
|
+
italic(text: string): DataMarkdownItalic;
|
|
117
|
+
italicStar(text: string): DataMarkdownItalicStar;
|
|
118
|
+
strikethrough(text: string): DataMarkdownStrikethrough;
|
|
119
|
+
link(text: string, url: string): DataMarkdownLink;
|
|
120
|
+
image(url: string, options?: {
|
|
121
|
+
width?: number;
|
|
122
|
+
height?: number;
|
|
123
|
+
}): DataMarkdownImage;
|
|
124
|
+
list(...items: any[]): DataMarkdownList;
|
|
125
|
+
listItem(indexOrText: number | string, text?: string): DataMarkdownListItem;
|
|
126
|
+
blockquote(text: string): DataMarkdownBlockquote;
|
|
127
|
+
divider(): DataMarkdownDivider;
|
|
128
|
+
newline(value?: boolean): DataMarkdownNewline;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { Ark, BT, Image, ImageFile, ImageURL, Link, MD, Mention, Text };
|
|
@@ -11,6 +11,19 @@ const Text = (val, options) => {
|
|
|
11
11
|
options
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* 链接消息
|
|
16
|
+
* @param val 要显示的文本
|
|
17
|
+
* @param options 内容选项
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
const Link = (val, options) => {
|
|
21
|
+
return {
|
|
22
|
+
type: 'Text',
|
|
23
|
+
value: val,
|
|
24
|
+
options
|
|
25
|
+
};
|
|
26
|
+
};
|
|
14
27
|
/**
|
|
15
28
|
* 图片链接,http 或 https 开头
|
|
16
29
|
* @param val
|
|
@@ -92,10 +105,318 @@ BT.row = function Row(...buttons) {
|
|
|
92
105
|
value: buttons
|
|
93
106
|
};
|
|
94
107
|
};
|
|
95
|
-
//
|
|
108
|
+
// Ark 函数
|
|
109
|
+
const Ark = {
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @param values 要显示的文本
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
list: (...values) => {
|
|
116
|
+
return {
|
|
117
|
+
type: 'Ark.list',
|
|
118
|
+
value: values
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
*
|
|
123
|
+
* @param options 提示信息
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
126
|
+
listTip: (options) => {
|
|
127
|
+
return {
|
|
128
|
+
type: 'Ark.listTip',
|
|
129
|
+
value: options
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param values 实际内容
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
|
+
listContent: (...values) => {
|
|
138
|
+
return {
|
|
139
|
+
type: 'Ark.listContent',
|
|
140
|
+
value: values
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* @param value 列表项内容
|
|
146
|
+
* @returns
|
|
147
|
+
*/
|
|
148
|
+
listItem: (value) => {
|
|
149
|
+
return {
|
|
150
|
+
type: 'Ark.listItem',
|
|
151
|
+
value: value
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* @param value 卡片内容
|
|
156
|
+
* @returns
|
|
157
|
+
*/
|
|
158
|
+
Card: (value) => {
|
|
159
|
+
return {
|
|
160
|
+
type: 'Ark.Card',
|
|
161
|
+
value: value
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* @param value 大卡片内容
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
BigCard: (value) => {
|
|
169
|
+
return {
|
|
170
|
+
type: 'Ark.BigCard',
|
|
171
|
+
value
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
*
|
|
177
|
+
* @param values 要显示的文本
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
const MD = (...values) => {
|
|
181
|
+
return {
|
|
182
|
+
type: 'Markdown',
|
|
183
|
+
value: values
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
*
|
|
188
|
+
* @param templateId 模板 ID
|
|
189
|
+
* @param params 模板参数
|
|
190
|
+
* @returns
|
|
191
|
+
*/
|
|
192
|
+
MD.template = (templateId, params) => {
|
|
193
|
+
return {
|
|
194
|
+
type: 'MD.template',
|
|
195
|
+
value: templateId,
|
|
196
|
+
options: {
|
|
197
|
+
params
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
*
|
|
203
|
+
* @param text 要显示的文本
|
|
204
|
+
* @returns
|
|
205
|
+
*/
|
|
206
|
+
MD.text = (text) => {
|
|
207
|
+
return {
|
|
208
|
+
type: 'MD.text',
|
|
209
|
+
value: text
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
*
|
|
214
|
+
* @param text 要显示的文本
|
|
215
|
+
* @returns
|
|
216
|
+
*/
|
|
217
|
+
MD.title = (text) => {
|
|
218
|
+
return {
|
|
219
|
+
type: 'MD.title',
|
|
220
|
+
value: text
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
*
|
|
225
|
+
* @param text 要显示的文本
|
|
226
|
+
* @returns
|
|
227
|
+
*/
|
|
228
|
+
MD.subtitle = (text) => {
|
|
229
|
+
return {
|
|
230
|
+
type: 'MD.subtitle',
|
|
231
|
+
value: text
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
*
|
|
236
|
+
* @param text 要显示的文本
|
|
237
|
+
* @returns
|
|
238
|
+
*/
|
|
239
|
+
MD.bold = (text) => {
|
|
240
|
+
return {
|
|
241
|
+
type: 'MD.bold',
|
|
242
|
+
value: text
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
*
|
|
247
|
+
* @param text 要显示的文本
|
|
248
|
+
* @returns
|
|
249
|
+
*/
|
|
250
|
+
MD.italic = (text) => {
|
|
251
|
+
return {
|
|
252
|
+
type: 'MD.italic',
|
|
253
|
+
value: text
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
*
|
|
258
|
+
* @param text 要显示的文本
|
|
259
|
+
* @returns
|
|
260
|
+
*/
|
|
261
|
+
MD.italicStar = (text) => {
|
|
262
|
+
return {
|
|
263
|
+
type: 'MD.italicStar',
|
|
264
|
+
value: text
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
*
|
|
269
|
+
* @param text 要显示的文本
|
|
270
|
+
* @returns
|
|
271
|
+
*/
|
|
272
|
+
MD.strikethrough = (text) => {
|
|
273
|
+
return {
|
|
274
|
+
type: 'MD.strikethrough',
|
|
275
|
+
value: text
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
*
|
|
280
|
+
* @param text 要显示的文本
|
|
281
|
+
* @param url 链接地址
|
|
282
|
+
* @returns
|
|
283
|
+
*/
|
|
284
|
+
MD.link = (text, url) => {
|
|
285
|
+
return {
|
|
286
|
+
type: 'MD.link',
|
|
287
|
+
value: { text, url }
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
*
|
|
292
|
+
* @param url 图片地址
|
|
293
|
+
* @param options 图片选项
|
|
294
|
+
* @returns
|
|
295
|
+
*/
|
|
296
|
+
MD.image = (url, options) => {
|
|
297
|
+
return {
|
|
298
|
+
type: 'MD.image',
|
|
299
|
+
value: url,
|
|
300
|
+
options
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
*
|
|
305
|
+
* @param items
|
|
306
|
+
* @returns
|
|
307
|
+
*/
|
|
308
|
+
MD.list = (...items) => {
|
|
309
|
+
return {
|
|
310
|
+
type: 'MD.list',
|
|
311
|
+
value: items
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
*
|
|
316
|
+
* @param indexOrText
|
|
317
|
+
* @param text
|
|
318
|
+
* @returns
|
|
319
|
+
*/
|
|
320
|
+
MD.listItem = (indexOrText, text) => {
|
|
321
|
+
return {
|
|
322
|
+
type: 'MD.listItem',
|
|
323
|
+
value: typeof indexOrText === 'number' ? { index: indexOrText, text } : indexOrText
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
*
|
|
328
|
+
* @param text 块引用的文本内容
|
|
329
|
+
* @returns
|
|
330
|
+
*/
|
|
331
|
+
MD.blockquote = (text) => {
|
|
332
|
+
return {
|
|
333
|
+
type: 'MD.blockquote',
|
|
334
|
+
value: text
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
*
|
|
339
|
+
* @returns
|
|
340
|
+
*/
|
|
341
|
+
MD.divider = () => {
|
|
342
|
+
return {
|
|
343
|
+
type: 'MD.divider'
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* @param value 是否换多行
|
|
348
|
+
* @returns
|
|
349
|
+
*/
|
|
350
|
+
MD.newline = (value = false) => {
|
|
351
|
+
return {
|
|
352
|
+
type: 'MD.newline',
|
|
353
|
+
value: value
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
// const Send = (...x: any[]) => {
|
|
96
357
|
// return x;
|
|
97
358
|
// };
|
|
98
359
|
// Send(
|
|
360
|
+
// Ark.list(
|
|
361
|
+
// Ark.listTip({ desc: "选择卡", prompt: "选择卡片" }),
|
|
362
|
+
// Ark.listContent(
|
|
363
|
+
// )
|
|
364
|
+
// ),
|
|
365
|
+
// Ark.Card({
|
|
366
|
+
// title: "标题标题标题标题标题标题标题标题",
|
|
367
|
+
// cover: "图片地址",
|
|
368
|
+
// jump_url: "要跳转的链接",
|
|
369
|
+
// subtitle: "子标题",
|
|
370
|
+
// decs: "备注",
|
|
371
|
+
// prompt: "提示",
|
|
372
|
+
// metadecs: "描述描述描述风好大换热",
|
|
373
|
+
// }),
|
|
374
|
+
// Ark.BigCard({
|
|
375
|
+
// title: '标题标题标题标题标题标题标题标题',
|
|
376
|
+
// subtitle: '子标题',
|
|
377
|
+
// cover: 'https://www.baidu.com/img/bd_logo1.png',
|
|
378
|
+
// jump_url: 'https://www.baidu.com',
|
|
379
|
+
// }),
|
|
380
|
+
// MD(
|
|
381
|
+
// MD.title("标题标题标题标题标题标题标题标题"),
|
|
382
|
+
// // 副标题
|
|
383
|
+
// MD.subtitle("子标题"),
|
|
384
|
+
// // 加粗
|
|
385
|
+
// MD.bold("加粗"),
|
|
386
|
+
// // 斜体
|
|
387
|
+
// MD.italic("斜体"),
|
|
388
|
+
// // 星号斜体
|
|
389
|
+
// MD.italicStar("星号斜体"),
|
|
390
|
+
// // 删除线
|
|
391
|
+
// MD.strikethrough("删除线"),
|
|
392
|
+
// // 链接
|
|
393
|
+
// MD.link("链接", "https://www.baidu.com"),
|
|
394
|
+
// // 图片
|
|
395
|
+
// MD.image("https://www.baidu.com/img/bd_logo1.png", { width: 100, height: 100 }),
|
|
396
|
+
// // 有序列表
|
|
397
|
+
// MD.list(
|
|
398
|
+
// MD.listItem(1, "有序列表"),
|
|
399
|
+
// MD.listItem(2, "有序列表"),
|
|
400
|
+
// MD.listItem(3, "有序列表"),
|
|
401
|
+
// ),
|
|
402
|
+
// // 无序列表
|
|
403
|
+
// MD.list(
|
|
404
|
+
// MD.listItem("无序列表"),
|
|
405
|
+
// MD.listItem("无序列表"),
|
|
406
|
+
// MD.listItem("无序列表"),
|
|
407
|
+
// ),
|
|
408
|
+
// // 块引用
|
|
409
|
+
// MD.blockquote("块引用"),
|
|
410
|
+
// // 水平分割线
|
|
411
|
+
// MD.divider(),
|
|
412
|
+
// // 换行
|
|
413
|
+
// MD.newline(),
|
|
414
|
+
// ),
|
|
415
|
+
// MD.template('123', {
|
|
416
|
+
// "title": "123",
|
|
417
|
+
// "image": "https://www.baidu.com/img/bd_logo1.png",
|
|
418
|
+
// "para1": "123",
|
|
419
|
+
// }),
|
|
99
420
|
// BT.template('123'),
|
|
100
421
|
// BT.group(
|
|
101
422
|
// BT.row(BT("开始", "/开始游戏")),
|
|
@@ -105,4 +426,4 @@ BT.row = function Row(...buttons) {
|
|
|
105
426
|
// )
|
|
106
427
|
// )
|
|
107
428
|
|
|
108
|
-
export { BT, Image, ImageFile, ImageURL, Mention, Text };
|
|
429
|
+
export { Ark, BT, Image, ImageFile, ImageURL, Link, MD, 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 {
|
|
17
|
+
export { DataEnums, 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,14 @@ 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 { BT, Image, ImageFile, ImageURL, Mention, Text } from './app/message-format.js';
|
|
32
|
+
export { Ark, BT, Image, ImageFile, ImageURL, Link, MD, 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';
|
|
36
|
+
export { DataText } from './typing/message/text.js';
|
|
37
|
+
export { DataLink } from './typing/message/link.js';
|
|
38
|
+
export { DataMention } from './typing/message/mention.js';
|
|
39
|
+
export { DataImage, DataImageFile, DataImageURL } from './typing/message/image.js';
|
|
40
|
+
export { ButtonRow, DataButton, DataButtonGroup } from './typing/message/button.js';
|
|
41
|
+
export { DataArkBigCard, DataArkCard, DataArkList, DataArkListContent, DataArkListItem, DataArkListTip } from './typing/message/ark.js';
|
|
42
|
+
export { DataMarkDown, DataMarkdownBlockquote, DataMarkdownBold, DataMarkdownDivider, DataMarkdownImage, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownLink, DataMarkdownList, DataMarkdownListItem, DataMarkdownNewline, DataMarkdownStrikethrough, DataMarkdownSubtitle, DataMarkdownTemplate, DataMarkdownText, DataMarkdownTitle } from './typing/message/markdown.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 { BT, Image, ImageFile, ImageURL, Mention, Text } from './app/message-format.js';
|
|
15
|
+
export { Ark, BT, Image, ImageFile, ImageURL, Link, MD, 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,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EventKeys, Events } from './typing/event/map.js';
|
|
3
|
-
import {
|
|
3
|
+
import { DataEnums } from './typing/message/index.js';
|
|
4
|
+
import { DataText } from './typing/message/text.js';
|
|
5
|
+
import { DataImage, DataImageURL, DataImageFile } from './typing/message/image.js';
|
|
6
|
+
import { DataMention } from './typing/message/mention.js';
|
|
7
|
+
import { DataButton } from './typing/message/button.js';
|
|
4
8
|
|
|
5
9
|
/**
|
|
6
10
|
*
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type DataArkListTip = {
|
|
2
|
+
type: 'Ark.listTip';
|
|
3
|
+
value: {
|
|
4
|
+
desc: string;
|
|
5
|
+
prompt: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
type DataArkListItem = {
|
|
9
|
+
type: 'Ark.listItem';
|
|
10
|
+
value: string | {
|
|
11
|
+
title: string;
|
|
12
|
+
link: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type DataArkListContent = {
|
|
16
|
+
type: 'Ark.listContent';
|
|
17
|
+
value: DataArkListItem[];
|
|
18
|
+
};
|
|
19
|
+
type DataArkList = {
|
|
20
|
+
type: 'Ark.list';
|
|
21
|
+
value: [DataArkListTip, DataArkListContent];
|
|
22
|
+
};
|
|
23
|
+
type DataArkCard = {
|
|
24
|
+
type: 'Ark.Card';
|
|
25
|
+
value: {
|
|
26
|
+
title: string;
|
|
27
|
+
cover: string;
|
|
28
|
+
link: string;
|
|
29
|
+
subtitle: string;
|
|
30
|
+
decs: string;
|
|
31
|
+
prompt: string;
|
|
32
|
+
metadecs: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type DataArkBigCard = {
|
|
36
|
+
type: 'Ark.BigCard';
|
|
37
|
+
value: {
|
|
38
|
+
title: string;
|
|
39
|
+
subtitle: string;
|
|
40
|
+
cover: string;
|
|
41
|
+
link: string;
|
|
42
|
+
prompt: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type { DataArkBigCard, DataArkCard, DataArkList, DataArkListContent, DataArkListItem, DataArkListTip };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type DataButton = {
|
|
2
|
+
type: 'Button';
|
|
3
|
+
value: string | {
|
|
4
|
+
title: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
options?: {
|
|
8
|
+
toolTip?: string;
|
|
9
|
+
autoEnter?: boolean;
|
|
10
|
+
showList?: boolean;
|
|
11
|
+
data?: string | {
|
|
12
|
+
click: string;
|
|
13
|
+
confirm: string;
|
|
14
|
+
cancel: string;
|
|
15
|
+
};
|
|
16
|
+
isLink?: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type ButtonRow = {
|
|
20
|
+
type: 'BT.row';
|
|
21
|
+
value: DataButton[];
|
|
22
|
+
};
|
|
23
|
+
type DataButtonGroup = {
|
|
24
|
+
type: 'BT.group';
|
|
25
|
+
value: ButtonRow[];
|
|
26
|
+
options?: {
|
|
27
|
+
template_id?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type { ButtonRow, DataButton, DataButtonGroup };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图片数据
|
|
3
|
+
*/
|
|
4
|
+
type DataImage = {
|
|
5
|
+
type: 'Image';
|
|
6
|
+
value: Buffer;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* 图片链接
|
|
10
|
+
*/
|
|
11
|
+
type DataImageURL = {
|
|
12
|
+
type: 'ImageURL';
|
|
13
|
+
value: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 图片文件
|
|
17
|
+
*/
|
|
18
|
+
type DataImageFile = {
|
|
19
|
+
type: 'ImageFile';
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type { DataImage, DataImageFile, DataImageURL };
|
|
@@ -1,86 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { DataButtonGroup } from './button.js';
|
|
2
|
+
export { ButtonRow, DataButton } from './button.js';
|
|
3
|
+
import { DataArkList, DataArkCard, DataArkBigCard } from './ark.js';
|
|
4
|
+
export { DataArkListContent, DataArkListItem, DataArkListTip } from './ark.js';
|
|
5
|
+
import { DataMarkDown, DataMarkdownTemplate } from './markdown.js';
|
|
6
|
+
export { DataMarkdownBlockquote, DataMarkdownBold, DataMarkdownDivider, DataMarkdownImage, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownLink, DataMarkdownList, DataMarkdownListItem, DataMarkdownNewline, DataMarkdownStrikethrough, DataMarkdownSubtitle, DataMarkdownText, DataMarkdownTitle } from './markdown.js';
|
|
7
|
+
import { DataImage, DataImageURL, DataImageFile } from './image.js';
|
|
8
|
+
import { DataText } from './text.js';
|
|
9
|
+
import { DataMention } from './mention.js';
|
|
10
|
+
import { DataLink } from './link.js';
|
|
3
11
|
|
|
4
|
-
|
|
5
|
-
* 文本数据
|
|
6
|
-
*/
|
|
7
|
-
type DataText = {
|
|
8
|
-
type: 'Text';
|
|
9
|
-
value: string;
|
|
10
|
-
options?: {
|
|
11
|
-
style?: 'none' | 'bold' | 'block' | 'strikethrough' | 'boldItalic' | 'italic';
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* 图片数据
|
|
16
|
-
*/
|
|
17
|
-
type DataImage = {
|
|
18
|
-
type: 'Image';
|
|
19
|
-
value: Buffer;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* 图片链接
|
|
23
|
-
*/
|
|
24
|
-
type DataImageURL = {
|
|
25
|
-
type: 'ImageURL';
|
|
26
|
-
value: string;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* 图片文件
|
|
30
|
-
*/
|
|
31
|
-
type DataImageFile = {
|
|
32
|
-
type: 'ImageFile';
|
|
33
|
-
value: string;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* 提及数据
|
|
37
|
-
*/
|
|
38
|
-
type DataMention = {
|
|
39
|
-
type: 'Mention';
|
|
40
|
-
value?: string;
|
|
41
|
-
options?: {
|
|
42
|
-
belong?: 'user' | 'guild' | 'channel' | 'everyone';
|
|
43
|
-
payload?: User | Guild | Channel | 'everyone';
|
|
44
|
-
};
|
|
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
|
-
};
|
|
75
|
-
type DataMap = {
|
|
76
|
-
Text: DataText;
|
|
77
|
-
Image: DataImage;
|
|
78
|
-
ImageURL: DataImageURL;
|
|
79
|
-
ImageFile: DataImageFile;
|
|
80
|
-
Mention: DataMention;
|
|
81
|
-
ButtonGroup: DataButtonGroup;
|
|
82
|
-
};
|
|
83
|
-
type DataEnums = DataText | DataImage | DataImageURL | DataImageFile | DataMention | DataButtonGroup;
|
|
12
|
+
type DataEnums = DataText | DataLink | DataImage | DataImageURL | DataImageFile | DataMention | DataButtonGroup | DataArkList | DataArkCard | DataArkBigCard | DataMarkDown | DataMarkdownTemplate;
|
|
84
13
|
type MessageDataFormat = DataEnums[];
|
|
85
14
|
|
|
86
|
-
export
|
|
15
|
+
export { DataArkBigCard, DataArkCard, DataArkList, DataButtonGroup, type DataEnums, DataImage, DataImageFile, DataImageURL, DataLink, DataMarkDown, DataMarkdownTemplate, DataMention, DataText, type MessageDataFormat };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
type DataMarkdownTemplate = {
|
|
2
|
+
type: 'MD.template';
|
|
3
|
+
value: string;
|
|
4
|
+
options: {
|
|
5
|
+
params: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
type DataMarkdownText = {
|
|
11
|
+
type: 'MD.text';
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
type DataMarkdownTitle = {
|
|
15
|
+
type: 'MD.title';
|
|
16
|
+
value: string;
|
|
17
|
+
};
|
|
18
|
+
type DataMarkdownSubtitle = {
|
|
19
|
+
type: 'MD.subtitle';
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
type DataMarkdownBold = {
|
|
23
|
+
type: 'MD.bold';
|
|
24
|
+
value: string;
|
|
25
|
+
};
|
|
26
|
+
type DataMarkdownItalic = {
|
|
27
|
+
type: 'MD.italic';
|
|
28
|
+
value: string;
|
|
29
|
+
};
|
|
30
|
+
type DataMarkdownItalicStar = {
|
|
31
|
+
type: 'MD.italicStar';
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
type DataMarkdownStrikethrough = {
|
|
35
|
+
type: 'MD.strikethrough';
|
|
36
|
+
value: string;
|
|
37
|
+
};
|
|
38
|
+
type DataMarkdownLink = {
|
|
39
|
+
type: 'MD.link';
|
|
40
|
+
value: {
|
|
41
|
+
text: string;
|
|
42
|
+
url: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
type DataMarkdownImage = {
|
|
46
|
+
type: 'MD.image';
|
|
47
|
+
value: string;
|
|
48
|
+
options?: {
|
|
49
|
+
width?: number;
|
|
50
|
+
height?: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
type DataMarkdownListItem = {
|
|
54
|
+
type: 'MD.listItem';
|
|
55
|
+
value: string | {
|
|
56
|
+
index: number;
|
|
57
|
+
text?: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
type DataMarkdownList = {
|
|
61
|
+
type: 'MD.list';
|
|
62
|
+
value: DataMarkdownListItem[];
|
|
63
|
+
};
|
|
64
|
+
type DataMarkdownBlockquote = {
|
|
65
|
+
type: 'MD.blockquote';
|
|
66
|
+
value: string;
|
|
67
|
+
};
|
|
68
|
+
type DataMarkdownDivider = {
|
|
69
|
+
type: 'MD.divider';
|
|
70
|
+
};
|
|
71
|
+
type DataMarkdownNewline = {
|
|
72
|
+
type: 'MD.newline';
|
|
73
|
+
value: boolean;
|
|
74
|
+
};
|
|
75
|
+
type DataMarkDownBalue = DataMarkdownText | DataMarkdownTitle | DataMarkdownSubtitle | DataMarkdownBold | DataMarkdownTemplate | DataMarkdownItalic | DataMarkdownItalicStar | DataMarkdownStrikethrough | DataMarkdownLink | DataMarkdownImage | DataMarkdownList | DataMarkdownListItem | DataMarkdownBlockquote | DataMarkdownDivider | DataMarkdownNewline;
|
|
76
|
+
type DataMarkDown = {
|
|
77
|
+
type: 'Markdown';
|
|
78
|
+
value: DataMarkDownBalue[];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type { DataMarkDown, DataMarkdownBlockquote, DataMarkdownBold, DataMarkdownDivider, DataMarkdownImage, DataMarkdownItalic, DataMarkdownItalicStar, DataMarkdownLink, DataMarkdownList, DataMarkdownListItem, DataMarkdownNewline, DataMarkdownStrikethrough, DataMarkdownSubtitle, DataMarkdownTemplate, DataMarkdownText, DataMarkdownTitle };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { User } from '../event/base/user.js';
|
|
2
|
+
import { Guild, Channel } from '../event/base/guild.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 提及数据
|
|
6
|
+
*/
|
|
7
|
+
type DataMention = {
|
|
8
|
+
type: 'Mention';
|
|
9
|
+
value?: string;
|
|
10
|
+
options?: {
|
|
11
|
+
belong?: 'user' | 'guild' | 'channel' | 'everyone';
|
|
12
|
+
payload?: User | Guild | Channel | 'everyone';
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type { DataMention };
|